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
8a1da2ba5725c4f8307633f48a3743bcb0be5626
298
py
Python
core/departments/translation.py
IvanRch/bsuphys
105715cde8fc8e9a42019ed4b650fe00b94fa132
[ "Apache-2.0" ]
1
2022-01-04T07:04:46.000Z
2022-01-04T07:04:46.000Z
core/departments/translation.py
IvanRch/bsuphys
105715cde8fc8e9a42019ed4b650fe00b94fa132
[ "Apache-2.0" ]
1
2020-02-17T19:06:03.000Z
2020-02-17T19:06:03.000Z
core/departments/translation.py
IvanRch/bsuphys
105715cde8fc8e9a42019ed4b650fe00b94fa132
[ "Apache-2.0" ]
1
2021-07-08T13:21:04.000Z
2021-07-08T13:21:04.000Z
from modeltranslation.translator import register, TranslationOptions from .models import Department @register(Department) class PostTranslationOptions(TranslationOptions): fields = ('name', 'short_description', 'description', 'thesis_themes', 'science_directions', 'publications', 'courses')
37.25
123
0.802013
26
298
9.076923
0.769231
0
0
0
0
0
0
0
0
0
0
0
0.090604
298
7
124
42.571429
0.870849
0
0
0
0
0
0.275168
0
0
0
0
0
0
1
0
false
0
0.4
0
0.8
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
8a1ec2720cd5e5fc952363090a13d99343e7bc6e
75
py
Python
BinaryMatrix.py
alexandreLamarre/Prime-Matrix-Factorization
32c33c570fe4cf2fd1bba9ca5927f720173176bb
[ "MIT" ]
null
null
null
BinaryMatrix.py
alexandreLamarre/Prime-Matrix-Factorization
32c33c570fe4cf2fd1bba9ca5927f720173176bb
[ "MIT" ]
null
null
null
BinaryMatrix.py
alexandreLamarre/Prime-Matrix-Factorization
32c33c570fe4cf2fd1bba9ca5927f720173176bb
[ "MIT" ]
null
null
null
class BinaryMatrix: def __init__(self, binary): self.m = binary
25
31
0.653333
9
75
5
0.777778
0
0
0
0
0
0
0
0
0
0
0
0.253333
75
3
32
25
0.803571
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
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
4
8a242cd30ae2826fd27abc16e2ae829dab476381
22
py
Python
circ2/version.py
lardenoije/CIRCexplorer2
1fb2eca2d1da8be720204d6931a72088670e3a3b
[ "MIT" ]
644
2015-01-28T10:29:40.000Z
2022-03-30T06:27:32.000Z
circ2/version.py
lardenoije/CIRCexplorer2
1fb2eca2d1da8be720204d6931a72088670e3a3b
[ "MIT" ]
185
2015-01-04T23:06:14.000Z
2022-03-28T08:30:30.000Z
circ2/version.py
lardenoije/CIRCexplorer2
1fb2eca2d1da8be720204d6931a72088670e3a3b
[ "MIT" ]
58
2015-01-01T15:28:54.000Z
2022-02-26T22:15:43.000Z
__version__ = '2.3.3'
11
21
0.636364
4
22
2.5
0.75
0
0
0
0
0
0
0
0
0
0
0.157895
0.136364
22
1
22
22
0.368421
0
0
0
0
0
0.227273
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
8a5f61f1486d9280dce10143e0a0d77f1699ac6c
155
py
Python
src/app1/urls.py
SheelSanghvi/inventory-management-web
1e848aa833e2418c588e8d2eaa98782e89ed3952
[ "MIT" ]
3
2020-06-12T18:29:21.000Z
2021-12-26T21:14:59.000Z
src/app1/urls.py
Preet538-neitzen/inventory-management-web
1e848aa833e2418c588e8d2eaa98782e89ed3952
[ "MIT" ]
9
2020-02-29T04:04:42.000Z
2022-02-26T23:26:17.000Z
src/app1/urls.py
Preet538-neitzen/inventory-management-web
1e848aa833e2418c588e8d2eaa98782e89ed3952
[ "MIT" ]
17
2020-02-24T17:18:44.000Z
2021-04-08T08:37:30.000Z
from django.urls import path, include urlpatterns = [ # path("auth/", include("djoser.urls")), path("auth/", include("djoser.urls.authtoken")), ]
22.142857
52
0.651613
18
155
5.611111
0.555556
0.158416
0.29703
0.415842
0.49505
0
0
0
0
0
0
0
0.148387
155
6
53
25.833333
0.765152
0.245161
0
0
0
0
0.226087
0.182609
0
0
0
0
0
1
0
false
0
0.25
0
0.25
0
1
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
8a6425c4513f6baa2f8a2f22f2a82b329e659a09
88
py
Python
codingbat.com/Warmup-2/last2.py
ahmedelq/PythonicAlgorithms
ce10dbb6e1fd0ea5c922a932b0f920236aa411bf
[ "MIT" ]
null
null
null
codingbat.com/Warmup-2/last2.py
ahmedelq/PythonicAlgorithms
ce10dbb6e1fd0ea5c922a932b0f920236aa411bf
[ "MIT" ]
null
null
null
codingbat.com/Warmup-2/last2.py
ahmedelq/PythonicAlgorithms
ce10dbb6e1fd0ea5c922a932b0f920236aa411bf
[ "MIT" ]
null
null
null
def last2(str): return sum([1 for i in range(len(str) - 2) if str[i:i+2] == str[-2:]])
44
72
0.579545
20
88
2.55
0.65
0.156863
0
0
0
0
0
0
0
0
0
0.068493
0.170455
88
2
72
44
0.630137
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
0
0
0
4
8a7ed7cd2b676d92d8d3386576f319216f63599d
195
py
Python
bedsensor.py
ContinuumBridge/nocturne_bedsensor
ab5eb11f1b32e5a05a3dc4635e8f67915ba79896
[ "MIT" ]
null
null
null
bedsensor.py
ContinuumBridge/nocturne_bedsensor
ab5eb11f1b32e5a05a3dc4635e8f67915ba79896
[ "MIT" ]
null
null
null
bedsensor.py
ContinuumBridge/nocturne_bedsensor
ab5eb11f1b32e5a05a3dc4635e8f67915ba79896
[ "MIT" ]
null
null
null
#!/usr/bin/env python # bedsensor.py # Copyright (C) ContinuumBridge Limited, 2015 - All Rights Reserved # Written by Peter Claydon # import sys from bedsensor_a import Adaptor Adaptor(sys.argv)
21.666667
67
0.774359
28
195
5.357143
0.857143
0
0
0
0
0
0
0
0
0
0
0.02381
0.138462
195
8
68
24.375
0.869048
0.635897
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
0
0
0
4
8a829685c1c39f0c2853428f85634828d81932f9
986
py
Python
src/synack/db/models/config.py
bamhm182/synackapi
b0552243d254f8226cc963837eb848c217c73d80
[ "MIT" ]
6
2022-01-26T10:17:02.000Z
2022-02-13T11:59:33.000Z
src/synack/db/models/config.py
bamhm182/synackapi
b0552243d254f8226cc963837eb848c217c73d80
[ "MIT" ]
null
null
null
src/synack/db/models/config.py
bamhm182/synackapi
b0552243d254f8226cc963837eb848c217c73d80
[ "MIT" ]
null
null
null
"""db/models/Config.py Database Model for the Config item """ import sqlalchemy as sa from sqlalchemy.orm import declarative_base Base = declarative_base() class Config(Base): __tablename__ = 'config' id = sa.Column(sa.Integer, autoincrement=True, primary_key=True) api_token = sa.Column(sa.VARCHAR(200), default='') debug = sa.Column(sa.BOOLEAN, default=False) email = sa.Column(sa.VARCHAR(150), default='') http_proxy = sa.Column(sa.VARCHAR(50), default='http://localhost:8080') https_proxy = sa.Column(sa.VARCHAR(50), default='http://localhost:8080') login = sa.Column(sa.BOOLEAN, default=True) notifications_token = sa.Column(sa.VARCHAR(1000), default='') otp_secret = sa.Column(sa.VARCHAR(50), default='') password = sa.Column(sa.VARCHAR(150), default='') template_dir = sa.Column(sa.VARCHAR(250), default='~/Templates') user_id = sa.Column(sa.VARCHAR(20), default='') use_proxies = sa.Column(sa.BOOLEAN, default=False)
36.518519
76
0.699797
137
986
4.927007
0.408759
0.154074
0.192593
0.226667
0.447407
0.346667
0.142222
0.142222
0.142222
0.142222
0
0.037736
0.139959
986
26
77
37.923077
0.758255
0.055781
0
0
0
0
0.063853
0
0
0
0
0
0
1
0
false
0.055556
0.111111
0
0.944444
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
1
0
0
1
0
0
4
8a837811e660d17ed43001f4f85a12bcbb241f6a
389
py
Python
sympy/printing/lambdarepr.py
fperez/sympy
7d8d096215c8f65ba1d4a9c09af78ec0c3844518
[ "BSD-3-Clause" ]
null
null
null
sympy/printing/lambdarepr.py
fperez/sympy
7d8d096215c8f65ba1d4a9c09af78ec0c3844518
[ "BSD-3-Clause" ]
null
null
null
sympy/printing/lambdarepr.py
fperez/sympy
7d8d096215c8f65ba1d4a9c09af78ec0c3844518
[ "BSD-3-Clause" ]
1
2021-11-10T06:39:41.000Z
2021-11-10T06:39:41.000Z
from str import StrPrinter class LambdaPrinter(StrPrinter): """ This printer converts expressions into strings that can be used by lambdify. """ def _print_Matrix(self, expr): return "Matrix([%s])"%expr._format_str(self._print, ",") def lambdarepr(expr): """ Returns a string usable for lambdifying. """ return LambdaPrinter().doprint(expr)
21.611111
70
0.663239
45
389
5.622222
0.755556
0
0
0
0
0
0
0
0
0
0
0
0.22108
389
17
71
22.882353
0.834984
0.300771
0
0
0
0
0.054852
0
0
0
0
0
0
1
0.333333
false
0
0.166667
0.166667
1
0.5
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
1
0
4
8a8659df0c35f7a201f79f46c078753f27bd8895
34
py
Python
einkd/drivers/__init__.py
trickeydan/einkd
ca5bbdde8c5a6ab31ffa6745b42cb69a19eb1090
[ "MIT" ]
null
null
null
einkd/drivers/__init__.py
trickeydan/einkd
ca5bbdde8c5a6ab31ffa6745b42cb69a19eb1090
[ "MIT" ]
null
null
null
einkd/drivers/__init__.py
trickeydan/einkd
ca5bbdde8c5a6ab31ffa6745b42cb69a19eb1090
[ "MIT" ]
null
null
null
"""Drivers for e-ink displays."""
17
33
0.647059
5
34
4.4
1
0
0
0
0
0
0
0
0
0
0
0
0.117647
34
1
34
34
0.733333
0.794118
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
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
8a92be7121c880abb1492a53166a214bac4d6e52
85
py
Python
hknweb/exams/apps.py
anthonymaltsev/hknweb
7490fbb166208ba14463445ff0149292ca3c37ba
[ "MIT" ]
20
2018-01-07T02:15:43.000Z
2021-09-15T04:25:50.000Z
hknweb/exams/apps.py
anthonymaltsev/hknweb
7490fbb166208ba14463445ff0149292ca3c37ba
[ "MIT" ]
292
2018-02-01T18:31:18.000Z
2022-03-30T22:15:08.000Z
hknweb/exams/apps.py
anthonymaltsev/hknweb
7490fbb166208ba14463445ff0149292ca3c37ba
[ "MIT" ]
85
2017-11-13T06:33:13.000Z
2022-03-30T20:32:55.000Z
from django.apps import AppConfig class ExamsConfig(AppConfig): name = "exams"
14.166667
33
0.741176
10
85
6.3
0.9
0
0
0
0
0
0
0
0
0
0
0
0.176471
85
5
34
17
0.9
0
0
0
0
0
0.058824
0
0
0
0
0
0
1
0
false
0
0.333333
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
0
0
1
0
1
0
0
4
8ab3e176f3d3515a2843764e3a05a4f8912425ce
275
py
Python
bfg9000/exceptions.py
thomasrockhu/bfg9000
1cd1226eab9bed2fc2ec6acccf7864fdcf2ed31a
[ "BSD-3-Clause" ]
null
null
null
bfg9000/exceptions.py
thomasrockhu/bfg9000
1cd1226eab9bed2fc2ec6acccf7864fdcf2ed31a
[ "BSD-3-Clause" ]
1
2020-11-14T10:30:15.000Z
2020-11-14T10:30:15.000Z
bfg9000/exceptions.py
thomasrockhu/bfg9000
1cd1226eab9bed2fc2ec6acccf7864fdcf2ed31a
[ "BSD-3-Clause" ]
null
null
null
from subprocess import CalledProcessError # noqa: F401 class PackageResolutionError(Exception): pass class VersionError(Exception): pass class PackageVersionError(PackageResolutionError, VersionError): pass class ToolNotFoundError(LookupError): pass
15.277778
64
0.781818
23
275
9.347826
0.608696
0.125581
0.167442
0
0
0
0
0
0
0
0
0.013043
0.163636
275
17
65
16.176471
0.921739
0.036364
0
0.444444
0
0
0
0
0
0
0
0
0
1
0
true
0.444444
0.111111
0
0.555556
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
1
0
0
1
0
0
4
0a3b2f4acfc9e44a303385f948140df7e45324af
66
py
Python
datahints/__init__.py
litek/datahints
fd6807f002d43266db1510ee96d1d3fe006bd4a3
[ "MIT" ]
null
null
null
datahints/__init__.py
litek/datahints
fd6807f002d43266db1510ee96d1d3fe006bd4a3
[ "MIT" ]
null
null
null
datahints/__init__.py
litek/datahints
fd6807f002d43266db1510ee96d1d3fe006bd4a3
[ "MIT" ]
null
null
null
from .datahints import DataType, DataFrameMeta, DataFrame, Series
33
65
0.833333
7
66
7.857143
1
0
0
0
0
0
0
0
0
0
0
0
0.106061
66
1
66
66
0.932203
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
0
0
0
4
0a49c427961dece73fe890b2ce25bcca3309e07f
218
py
Python
device_server/model/auth.py
voegtlel/depot-device-server
bd32b07872fe9729bfaecea094d6547684c916f2
[ "MIT" ]
null
null
null
device_server/model/auth.py
voegtlel/depot-device-server
bd32b07872fe9729bfaecea094d6547684c916f2
[ "MIT" ]
null
null
null
device_server/model/auth.py
voegtlel/depot-device-server
bd32b07872fe9729bfaecea094d6547684c916f2
[ "MIT" ]
null
null
null
from pydantic import BaseModel as PydanticBaseModel from device_server.model.base import BaseModel class CardModel(BaseModel): card_id: str class AuthenticationResult(PydanticBaseModel): redirect_uri: str
18.166667
51
0.811927
25
218
6.96
0.72
0.172414
0
0
0
0
0
0
0
0
0
0
0.142202
218
11
52
19.818182
0.930481
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.333333
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
4
0a53c79f6b25c81c9b4166e6c89fead088e78ee8
184
py
Python
abc/abc125/abc125b.py
c-yan/atcoder
940e49d576e6a2d734288fadaf368e486480a948
[ "MIT" ]
1
2019-08-21T00:49:34.000Z
2019-08-21T00:49:34.000Z
abc/abc125/abc125b.py
c-yan/atcoder
940e49d576e6a2d734288fadaf368e486480a948
[ "MIT" ]
null
null
null
abc/abc125/abc125b.py
c-yan/atcoder
940e49d576e6a2d734288fadaf368e486480a948
[ "MIT" ]
null
null
null
N = int(input()) V = list(map(int, input().split())) C = list(map(int, input().split())) result = 0 for i in range(N): if V[i] > C[i]: result += V[i] - C[i] print(result)
18.4
35
0.527174
34
184
2.852941
0.470588
0.247423
0.206186
0.309278
0.412371
0
0
0
0
0
0
0.006993
0.222826
184
9
36
20.444444
0.671329
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0
0
0
0.125
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
0a66f84cf222b5d8c16ce64a8286c55b7ad6cc18
106
py
Python
distiller/fac_scraper/apps.py
18F/FAC-Distiller-
dd0bba9ddbead28d6bcf3487f5a090b10232565a
[ "CC0-1.0" ]
2
2020-08-07T00:22:10.000Z
2020-08-07T00:22:16.000Z
distiller/fac_scraper/apps.py
18F/FAC-Distiller-
dd0bba9ddbead28d6bcf3487f5a090b10232565a
[ "CC0-1.0" ]
95
2020-01-14T20:31:59.000Z
2021-06-10T18:23:13.000Z
distiller/fac_scraper/apps.py
isabella232/FAC-Distiller
fe38e8fdf6589a20dbd80001dc9ca2bdf13305f5
[ "CC0-1.0" ]
2
2020-09-25T07:05:06.000Z
2021-01-12T09:19:38.000Z
from django.apps import AppConfig class FacScraperConfig(AppConfig): name = 'distiller.fac_scraper'
17.666667
34
0.783019
12
106
6.833333
0.916667
0
0
0
0
0
0
0
0
0
0
0
0.141509
106
5
35
21.2
0.901099
0
0
0
0
0
0.198113
0.198113
0
0
0
0
0
1
0
false
0
0.333333
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
0
0
1
0
1
0
0
4
6a70c0688f3702aef62bf3258efc54b5235433cf
142
py
Python
Leetcode/1189. Maximum Number of Balloons/solution2.py
asanoviskhak/Outtalent
c500e8ad498f76d57eb87a9776a04af7bdda913d
[ "MIT" ]
51
2020-07-12T21:27:47.000Z
2022-02-11T19:25:36.000Z
Leetcode/1189. Maximum Number of Balloons/solution2.py
CrazySquirrel/Outtalent
8a10b23335d8e9f080e5c39715b38bcc2916ff00
[ "MIT" ]
null
null
null
Leetcode/1189. Maximum Number of Balloons/solution2.py
CrazySquirrel/Outtalent
8a10b23335d8e9f080e5c39715b38bcc2916ff00
[ "MIT" ]
32
2020-07-27T13:54:24.000Z
2021-12-25T18:12:50.000Z
class Solution: def maxNumberOfBalloons(self, text: str) -> int: return min(text.count(c) // 'balloon'.count(c) for c in 'balon')
35.5
72
0.647887
20
142
4.6
0.8
0.130435
0
0
0
0
0
0
0
0
0
0
0.197183
142
3
73
47.333333
0.807018
0
0
0
0
0
0.084507
0
0
0
0
0
0
1
0.333333
false
0
0
0.333333
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
0
0
0
4
6a7a65ec7a2165f8a9ca1633e56a7e2c31e5e6af
1,509
py
Python
users/forms.py
sty16/django-educational-website
741925af23485d7c0ea9a8553646fc5b5af75258
[ "MIT" ]
null
null
null
users/forms.py
sty16/django-educational-website
741925af23485d7c0ea9a8553646fc5b5af75258
[ "MIT" ]
12
2020-02-12T03:22:46.000Z
2022-03-12T00:11:10.000Z
users/forms.py
sty16/django-educational-website
741925af23485d7c0ea9a8553646fc5b5af75258
[ "MIT" ]
null
null
null
from django.contrib.auth.forms import UserCreationForm from django import forms from captcha.fields import CaptchaField from .models import User class RegisterForm(forms.Form): username = forms.CharField(required=True,initial='') email = forms.EmailField(required=True,initial='') password = forms.CharField(required=True, min_length=5,initial='') # 验证码 captcha = CaptchaField(error_messages={'invalid':'验证码错误'}) class Meta(UserCreationForm.Meta): model = User fields = ("username", "email") class LoginForm(forms.Form): username = forms.CharField(required=True) password = forms.CharField(required=True,min_length=5) class VerifyForm(forms.Form): username = forms.CharField(required=True,initial='') mobile = forms.CharField(required=True,initial='') password = forms.CharField(required=True,initial='') send = forms.BooleanField(required=False, initial=False) code = forms.CharField(required=False,initial='') class Meta(UserCreationForm.Meta): model = User class UploadImageForm(forms.ModelForm): '''用户更改图像''' class Meta: model = User fields = ['image'] class ModifyPwdForm(forms.Form): code = forms.CharField(max_length=10,required=True) password1 = forms.CharField(required=True) password2 = forms.CharField(required=True) class UserInfoForm(forms.ModelForm): '''个人中心信息修改''' class Meta: model = User fields = ['nickname','gender','birthday','address']
32.106383
70
0.699801
166
1,509
6.337349
0.331325
0.146388
0.209125
0.222433
0.425856
0.360266
0.288023
0.247148
0
0
0
0.004796
0.170974
1,509
47
71
32.106383
0.836131
0.013254
0
0.285714
0
0
0.039892
0
0
0
0
0
0
1
0
false
0.142857
0.114286
0
0.8
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
1
0
0
1
0
0
4
6aa4c581ef7b1bf592af6d10deec7c708d0ab617
211
py
Python
ch_04/PythonForTheLab/Controller/dummy_controller.py
PFTL/py4lab
e1ba563c3ffa14e85710c42c65a2975924060369
[ "MIT" ]
9
2020-04-28T02:58:23.000Z
2021-09-05T22:00:47.000Z
ch_04/PythonForTheLab/Controller/dummy_controller.py
PFTL/py4lab
e1ba563c3ffa14e85710c42c65a2975924060369
[ "MIT" ]
null
null
null
ch_04/PythonForTheLab/Controller/dummy_controller.py
PFTL/py4lab
e1ba563c3ffa14e85710c42c65a2975924060369
[ "MIT" ]
3
2020-07-04T17:15:02.000Z
2021-03-03T07:49:09.000Z
print('This is the dummy Controller') def dummy_example(): print('This is a function in the dummy Controller') if __name__ == '__main__': print('This is printed only from __main__') dummy_example()
26.375
55
0.7109
30
211
4.533333
0.566667
0.198529
0.242647
0
0
0
0
0
0
0
0
0
0.184834
211
8
56
26.375
0.790698
0
0
0
0
0
0.528302
0
0
0
0
0
0
1
0.166667
true
0
0
0
0.166667
0.5
0
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
0
0
0
1
0
4
6aa9ab5a2c84971d99b4bf4fdfe28d7927be00df
6,196
py
Python
installer/core/terraform/resources/aws/rds.py
jonico/pacbot
ecb94fb987147098bc5b359772fad264619b3099
[ "Apache-2.0" ]
1,165
2018-10-05T19:07:34.000Z
2022-03-28T19:34:27.000Z
installer/core/terraform/resources/aws/rds.py
jonico/pacbot
ecb94fb987147098bc5b359772fad264619b3099
[ "Apache-2.0" ]
334
2018-10-10T14:00:41.000Z
2022-03-19T16:32:08.000Z
installer/core/terraform/resources/aws/rds.py
jtimberlake/pacbot
5a25dc15882324583860630e773af2e2647dd5fa
[ "Apache-2.0" ]
268
2018-10-05T19:53:25.000Z
2022-03-31T07:39:47.000Z
from core.terraform.resources import TerraformResource from core.config import Settings from core.providers.aws.boto3 import rds class RDSResource(TerraformResource): """ Base resource class for Terraform AWS RDS resource Attributes: resource_instance_name (str): Type of resource instance available_args (dict): Instance configurations """ resource_instance_name = "aws_db_instance" OUTPUT_LIST = ['endpoint'] setup_time = 600 available_args = { 'identifier': {'required': True, 'prefix': True, 'sep': '-'}, 'allocated_storage': {'required': True}, 'storage_type': {'required': True}, 'engine': {'required': True}, 'engine_version': {'required': True, }, 'instance_class': {'required': True, }, 'name': {'required': True}, 'username': {'required': True}, 'password': {'required': True}, 'db_subnet_group_name': {'required': False}, 'option_group_name': {'required': False}, 'skip_final_snapshot': {'required': True}, 'parameter_group_name': {'required': False}, 'vpc_security_group_ids': {'required': False}, 'final_snapshot_identifier': {'required': False}, 'tags': {'required': False}, 'apply_immediately': {'required': False} } def check_exists_before(self, input, tf_outputs): """ Check if the resource is already exists in AWS Args: input (instance): input object tf_outputs (dict): Terraform output dictionary Returns: exists (boolean): True if already exists in AWS else False checked_details (dict): Status of the existence check """ checked_details = {'attr': "identifier", 'value': self.get_input_attr('identifier')} exists = False if not self.resource_in_tf_output(tf_outputs): exists = rds.check_rds_instance_exists( checked_details['value'], input.AWS_AUTH_CRED) return exists, checked_details class RDSOptionGroupResource(TerraformResource): """ Base resource class for Terraform AWS RDS option group resource Attributes: resource_instance_name (str): Type of resource instance available_args (dict): Instance configurations """ resource_instance_name = "aws_db_option_group" setup_time = 60 available_args = { 'name': {'required': True, 'prefix': True, 'sep': '-'}, 'engine_name': {'required': True}, 'major_engine_version': {'required': True}, 'option_group_description': {'required': False}, 'tags': {'required': False} } option_group_description = Settings.RESOURCE_DESCRIPTION def check_exists_before(self, input, tf_outputs): """ Check if the resource is already exists in AWS Args: input (instance): input object tf_outputs (dict): Terraform output dictionary Returns: exists (boolean): True if already exists in AWS else False checked_details (dict): Status of the existence check """ checked_details = {'attr': "name", 'value': self.get_input_attr('name')} exists = False if not self.resource_in_tf_output(tf_outputs): exists = rds.check_rds_option_group_exists( checked_details['value'], input.AWS_AUTH_CRED) return exists, checked_details class RDSParameterGroupResource(TerraformResource): """ Base resource class for Terraform AWS parameter group resource Attributes: resource_instance_name (str): Type of resource instance available_args (dict): Instance configurations """ resource_instance_name = "aws_db_parameter_group" setup_time = 60 available_args = { 'name': {'required': True, 'prefix': True, 'sep': '-'}, 'family': {'required': True}, 'description': {'required': False}, 'tags': {'required': False} } description = Settings.RESOURCE_DESCRIPTION def check_exists_before(self, input, tf_outputs): """ Check if the resource is already exists in AWS Args: input (instance): input object tf_outputs (dict): Terraform output dictionary Returns: exists (boolean): True if already exists in AWS else False checked_details (dict): Status of the existence check """ checked_details = {'attr': "name", 'value': self.get_input_attr('name')} exists = False if not self.resource_in_tf_output(tf_outputs): exists = rds.check_rds_parameter_group_exists( checked_details['value'], input.AWS_AUTH_CRED) return exists, checked_details class RDSSubnetGroupResource(TerraformResource): """ Base resource class for Terraform AWS RDS Subnet group resource Attributes: resource_instance_name (str): Type of resource instance available_args (dict): Instance configurations """ resource_instance_name = "aws_db_subnet_group" setup_time = 60 available_args = { 'name': {'required': True, 'prefix': True, 'sep': '-'}, 'subnet_ids': {'required': True}, 'description': {'required': False}, 'tags': {'required': False} } description = Settings.RESOURCE_DESCRIPTION def check_exists_before(self, input, tf_outputs): """ Check if the resource is already exists in AWS Args: input (instance): input object tf_outputs (dict): Terraform output dictionary Returns: exists (boolean): True if already exists in AWS else False checked_details (dict): Status of the existence check """ checked_details = {'attr': "name", 'value': self.get_input_attr('name')} exists = False if not self.resource_in_tf_output(tf_outputs): exists = rds.check_rds_subnet_group_exists( checked_details['value'], input.AWS_AUTH_CRED) return exists, checked_details
33.491892
92
0.624112
657
6,196
5.659056
0.144597
0.054868
0.043034
0.038731
0.781065
0.760624
0.749597
0.736417
0.694459
0.694459
0
0.002212
0.270497
6,196
184
93
33.673913
0.820354
0.293899
0
0.494382
0
0
0.205173
0.023355
0
0
0
0
0
1
0.044944
false
0.011236
0.033708
0
0.348315
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
0
0
0
0
0
0
4
6ab980dd8a96c5663e5823dd4691f061d90767df
255
py
Python
env/lib/python3.8/site-packages/django_redis/compressors/base.py
avdhari/enigma
b7e965a91ca5f0e929c4c719d695f15ccb8b5a2c
[ "MIT" ]
4
2021-01-07T14:25:15.000Z
2021-02-01T10:36:10.000Z
env/lib/python3.8/site-packages/django_redis/compressors/base.py
avdhari/enigma
b7e965a91ca5f0e929c4c719d695f15ccb8b5a2c
[ "MIT" ]
13
2020-03-24T17:53:51.000Z
2022-02-10T20:01:14.000Z
env/lib/python3.8/site-packages/django_redis/compressors/base.py
avdhari/enigma
b7e965a91ca5f0e929c4c719d695f15ccb8b5a2c
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- class BaseCompressor(object): def __init__(self, options): self._options = options def compress(self, value): raise NotImplementedError def decompress(self, value): raise NotImplementedError
19.615385
33
0.65098
25
255
6.44
0.6
0.136646
0.173913
0.409938
0
0
0
0
0
0
0
0.005208
0.247059
255
12
34
21.25
0.833333
0.082353
0
0.285714
0
0
0
0
0
0
0
0
0
1
0.428571
false
0
0
0
0.571429
0
1
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
4
6abe860242ee4a8b08fe31105769f9c89b24e182
727
py
Python
18/1.py
deadnotxaa/homework
c56b1298f0f3198ff1be919e369256c67f54915f
[ "MIT" ]
null
null
null
18/1.py
deadnotxaa/homework
c56b1298f0f3198ff1be919e369256c67f54915f
[ "MIT" ]
null
null
null
18/1.py
deadnotxaa/homework
c56b1298f0f3198ff1be919e369256c67f54915f
[ "MIT" ]
null
null
null
n = 10 a = [] s = [[0] * n for i in range(n)] s2 = [[0] * n for i in range(n)] for i in range(n): a.append(list(map(int, input().split()))) s[0][0] = a[0][0] s2[0][0] = a[0][0] for j in range(1, n): s[0][j] = s[0][j - 1] + a[0][j] for i in range(1, n): s[i][0] = s[i - 1][0] + a[i][0] for i in range(n): for j in range(n): if i and j: s[i][j] = max(s[i - 1][j], s[i][j - 1]) + a[i][j] for j in range(1, n): s2[0][j] = s2[0][j - 1] + a[0][j] for i in range(1, n): s2[i][0] = s2[i - 1][0] + a[i][0] for i in range(n): for j in range(n): if i and j: s2[i][j] = min(s2[i - 1][j], s2[i][j - 1]) + a[i][j] print(s[n - 1][n - 1], s2[n - 1][n - 1], sep="")
20.194444
64
0.41403
177
727
1.700565
0.135593
0.255814
0.139535
0.255814
0.684385
0.631229
0.465116
0.372093
0.372093
0.372093
0
0.098039
0.298487
727
35
65
20.771429
0.492157
0
0
0.44
0
0
0
0
0
0
0
0
0
1
0
false
0
0
0
0
0.04
0
0
1
null
1
0
1
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
0
0
0
0
0
0
0
0
4
6ac0b37d210fbe17be8687b96e1725482cf6efd8
158
py
Python
mne/io/hitachi/__init__.py
LukeTheHecker/mne-python
7d508e4fded73b5beb73564e4a01169530e058a8
[ "BSD-3-Clause" ]
1
2021-06-07T09:40:55.000Z
2021-06-07T09:40:55.000Z
mne/io/hitachi/__init__.py
LukeTheHecker/mne-python
7d508e4fded73b5beb73564e4a01169530e058a8
[ "BSD-3-Clause" ]
2
2020-09-18T00:09:20.000Z
2020-11-10T17:47:10.000Z
mne/io/hitachi/__init__.py
LukeTheHecker/mne-python
7d508e4fded73b5beb73564e4a01169530e058a8
[ "BSD-3-Clause" ]
1
2021-01-07T23:08:52.000Z
2021-01-07T23:08:52.000Z
"""fNIRS module for conversion to FIF.""" # Author: Eric Larson <larson.eric.d@gmail.com> # # License: BSD (3-clause) from .hitachi import read_raw_hitachi
19.75
47
0.721519
24
158
4.666667
0.875
0
0
0
0
0
0
0
0
0
0
0.007353
0.139241
158
7
48
22.571429
0.816176
0.670886
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
0
0
0
4
6ac1d0267b8f5068e701e47439cad5b56617c501
695
py
Python
symphony/cli/pyinventory/graphql/equipment_position_definition_fragment.py
aharonnovo/magma
d96a272ee58fea436cc94990c7ad05c4edc76341
[ "BSD-3-Clause" ]
null
null
null
symphony/cli/pyinventory/graphql/equipment_position_definition_fragment.py
aharonnovo/magma
d96a272ee58fea436cc94990c7ad05c4edc76341
[ "BSD-3-Clause" ]
null
null
null
symphony/cli/pyinventory/graphql/equipment_position_definition_fragment.py
aharonnovo/magma
d96a272ee58fea436cc94990c7ad05c4edc76341
[ "BSD-3-Clause" ]
null
null
null
#!/usr/bin/env python3 # @generated AUTOGENERATED file. Do not Change! from dataclasses import dataclass from datetime import datetime from gql.gql.datetime_utils import DATETIME_FIELD from gql.gql.graphql_client import GraphqlClient from functools import partial from numbers import Number from typing import Any, Callable, List, Mapping, Optional from dataclasses_json import DataClassJsonMixin QUERY: str = """ fragment EquipmentPositionDefinitionFragment on EquipmentPositionDefinition { id name index visibleLabel } """ @dataclass class EquipmentPositionDefinitionFragment(DataClassJsonMixin): id: str name: str index: Optional[int] visibleLabel: Optional[str]
23.166667
77
0.8
78
695
7.076923
0.576923
0.054348
0.036232
0
0
0
0
0
0
0
0
0.001681
0.143885
695
29
78
23.965517
0.92605
0.096403
0
0
1
0
0.186901
0.099042
0
0
0
0
0
1
0
true
0
0.363636
0
0.590909
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
4
6ac2ad88d5cb48df882065ccf4bf6128c1d5034b
310
py
Python
repos/system_upgrade/common/models/installeddesktopsfacts.py
sm00th/leapp-repository
1c171ec3a5f9260a3c6f84a9b15cad78a875ac61
[ "Apache-2.0" ]
21
2018-11-20T15:58:39.000Z
2022-03-15T19:57:24.000Z
repos/system_upgrade/common/models/installeddesktopsfacts.py
sm00th/leapp-repository
1c171ec3a5f9260a3c6f84a9b15cad78a875ac61
[ "Apache-2.0" ]
732
2018-11-21T18:33:26.000Z
2022-03-31T16:16:24.000Z
repos/system_upgrade/common/models/installeddesktopsfacts.py
sm00th/leapp-repository
1c171ec3a5f9260a3c6f84a9b15cad78a875ac61
[ "Apache-2.0" ]
85
2018-11-20T17:55:00.000Z
2022-03-29T09:40:31.000Z
from leapp.models import Model, fields from leapp.topics import SystemFactsTopic class InstalledDesktopsFacts(Model): """ The model includes fact about installe """ topic = SystemFactsTopic gnome_installed = fields.Boolean(default=False) kde_installed = fields.Boolean(default=False)
25.833333
51
0.751613
34
310
6.794118
0.647059
0.077922
0.190476
0.251082
0.294372
0
0
0
0
0
0
0
0.174194
310
11
52
28.181818
0.902344
0.122581
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.333333
0
1
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
4
6acfcafc78883cf594bf3d5a36c81d3eebaf1b48
389
py
Python
mocking/PurchaseOrder.py
susanacm/pyUnitTestingExamples
de99d713757521f35050b61b3405eafd81e8fe92
[ "MIT" ]
null
null
null
mocking/PurchaseOrder.py
susanacm/pyUnitTestingExamples
de99d713757521f35050b61b3405eafd81e8fe92
[ "MIT" ]
null
null
null
mocking/PurchaseOrder.py
susanacm/pyUnitTestingExamples
de99d713757521f35050b61b3405eafd81e8fe92
[ "MIT" ]
null
null
null
from mocking.Store import Store """ Mocking example """ class PurchaseOrder: def __init__(self, product_name:str, amount:int)->None: self.product_name = product_name self.amount = amount def buy(self, store:Store)->None: if store.are_there_enough_products(self.product_name, self.amount): store.remove_products(self.product_name, self.amount)
27.785714
75
0.70437
51
389
5.117647
0.45098
0.210728
0.229885
0.241379
0.252874
0.252874
0
0
0
0
0
0
0.190231
389
14
76
27.785714
0.828571
0
0
0
0
0
0
0
0
0
0
0
0
1
0.25
false
0
0.125
0
0.5
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
4
6ad49b7d7f4668cd82d2be71993d9db40d6caf97
95
py
Python
departures/apps.py
raq929/mbta-project
5bcdc7f324b9994765eaed64961e75e3efefa3f4
[ "MIT" ]
null
null
null
departures/apps.py
raq929/mbta-project
5bcdc7f324b9994765eaed64961e75e3efefa3f4
[ "MIT" ]
4
2020-02-11T23:43:10.000Z
2021-06-10T19:16:25.000Z
departures/apps.py
raq929/mbta-project
5bcdc7f324b9994765eaed64961e75e3efefa3f4
[ "MIT" ]
null
null
null
from django.apps import AppConfig class DeparturesConfig(AppConfig): name = 'departures'
15.833333
34
0.768421
10
95
7.3
0.9
0
0
0
0
0
0
0
0
0
0
0
0.157895
95
5
35
19
0.9125
0
0
0
0
0
0.105263
0
0
0
0
0
0
1
0
false
0
0.333333
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
0
0
1
0
1
0
0
4
0a7274a5dc9acfed329e76ae8036322146b2d390
263
py
Python
Script/Player.py
PyRectangle/GreyRectangle
21c19002f52563a096566e9166040815005b830b
[ "MIT" ]
3
2017-09-28T16:53:09.000Z
2018-03-18T20:01:41.000Z
Script/Player.py
PyRectangle/GreyRectangle
21c19002f52563a096566e9166040815005b830b
[ "MIT" ]
null
null
null
Script/Player.py
PyRectangle/GreyRectangle
21c19002f52563a096566e9166040815005b830b
[ "MIT" ]
null
null
null
from Constants import * class Player: def __init__(self, main): self._main = main def setSpawn(self, x, y): self._main.player.spawn = [x, y - 29 / BLOCK_SIZE] def climb(self, climb): self._main.player.climb = climb
20.230769
58
0.589354
35
263
4.2
0.485714
0.217687
0.190476
0
0
0
0
0
0
0
0
0.010811
0.296578
263
12
59
21.916667
0.783784
0
0
0
0
0
0
0
0
0
0
0
0
1
0.375
false
0
0.125
0
0.625
0
0
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
4
0a877b36b3a33df795420cf2cb85dd63819696b4
124
py
Python
sample/collect/service_imp/rules/data_2_array_rule.py
SelfDown/omnis-collect3
84f16ed108e4295719cf943b573aeb4ae3fe9c75
[ "MIT" ]
null
null
null
sample/collect/service_imp/rules/data_2_array_rule.py
SelfDown/omnis-collect3
84f16ed108e4295719cf943b573aeb4ae3fe9c75
[ "MIT" ]
null
null
null
sample/collect/service_imp/rules/data_2_array_rule.py
SelfDown/omnis-collect3
84f16ed108e4295719cf943b573aeb4ae3fe9c75
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- """ @Time: 2021/6/18 15:17 @Author: zzhang zzhang@cenboomh.com @File: Data2ArrayRule.py @desc: """
13.777778
35
0.629032
18
124
4.333333
0.944444
0
0
0
0
0
0
0
0
0
0
0.121495
0.137097
124
8
36
15.5
0.607477
0.91129
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
0a8eb282634cc552ab582abce3a25254bef7fc61
385
py
Python
app/models/arcane_items.py
neuralhalation/flask-call-of-cthulhu
59e1afc9ac1244106fe3439f9a37f16dcfc15d52
[ "MIT" ]
null
null
null
app/models/arcane_items.py
neuralhalation/flask-call-of-cthulhu
59e1afc9ac1244106fe3439f9a37f16dcfc15d52
[ "MIT" ]
null
null
null
app/models/arcane_items.py
neuralhalation/flask-call-of-cthulhu
59e1afc9ac1244106fe3439f9a37f16dcfc15d52
[ "MIT" ]
null
null
null
import app.functions.add_remove as ar def arcane_item(name, description): return ar.new("arcane_item", name=name, description=description) def add_arcane_item(arcane_item, arcane_items=[]): return ar.add_to_list(arcane_item, arcane_items) def remove_arcane_item(name, arcane_items): return ar.remove_by_obj_key_and_val_key("arcane_item", "name", name, arcane_items)
25.666667
86
0.781818
60
385
4.65
0.366667
0.250896
0.200717
0.129032
0
0
0
0
0
0
0
0
0.114286
385
14
87
27.5
0.818182
0
0
0
0
0
0.067708
0
0
0
0
0
0
1
0.428571
false
0
0.142857
0.428571
1
0
0
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
0
0
0
4
0a950eec7f0d45fa9eb70ccd743235311926ecff
262
py
Python
lib/python2.7/site-packages/easy_thumbnails/__init__.py
darshanxyz/shop
213c2dffca9f03a1939ce25ba4ede83e9c865a26
[ "MIT" ]
null
null
null
lib/python2.7/site-packages/easy_thumbnails/__init__.py
darshanxyz/shop
213c2dffca9f03a1939ce25ba4ede83e9c865a26
[ "MIT" ]
null
null
null
lib/python2.7/site-packages/easy_thumbnails/__init__.py
darshanxyz/shop
213c2dffca9f03a1939ce25ba4ede83e9c865a26
[ "MIT" ]
null
null
null
VERSION = (2, 4, 2, 'final', 0) def get_version(*args, **kwargs): # Don't litter django/__init__.py with all the get_version stuff. # Only import if it's actually called. from .get_version import get_version return get_version(*args, **kwargs)
29.111111
69
0.687023
41
262
4.170732
0.682927
0.292398
0.163743
0.233918
0
0
0
0
0
0
0
0.018957
0.194656
262
8
70
32.75
0.791469
0.381679
0
0
0
0
0.031447
0
0
0
0
0
0
1
0.25
false
0
0.25
0
0.75
0
0
0
0
null
1
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
4
0ad4e534351a06c2b08f592a3fb67d58a3b0efe5
2,276
py
Python
tests/expected/badchars.py
cytopia/fuzza
46dd4841a1f987bcc0141f9fdfc4fc57ffaae24f
[ "MIT" ]
30
2020-01-18T19:52:59.000Z
2022-03-14T17:52:14.000Z
tests/expected/badchars.py
cytopia/fuzza
46dd4841a1f987bcc0141f9fdfc4fc57ffaae24f
[ "MIT" ]
null
null
null
tests/expected/badchars.py
cytopia/fuzza
46dd4841a1f987bcc0141f9fdfc4fc57ffaae24f
[ "MIT" ]
8
2020-04-24T17:56:49.000Z
2021-06-26T01:25:59.000Z
#!/usr/bin/env python """fuzza autogenerated.""" from __future__ import print_function import socket def str2b(data): """Unescape P2/P3 and convert to bytes if Python3.""" # Python2: Unescape control chars try: return data.decode('string_escape') except AttributeError: pass except UnicodeDecodeError: pass # Python3: Unescape control chars and convert to byte try: return data.encode("utf-8").decode('unicode-escape').encode("latin1") except UnicodeDecodeError: pass s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) len_overflow = 2700 # Use pattern_create.rb and pattern_offset.rb to find exact offset eip = "B"*4 # Ignore for badchar detection badchars = ( "\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10" "\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f\x20" "\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\x2d\x2e\x2f\x30" "\x31\x32\x33\x34\x35\x36\x37\x38\x39\x3a\x3b\x3c\x3d\x3e\x3f\x40" "\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f\x50" "\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5a\x5b\x5c\x5d\x5e\x5f\x60" "\x61\x62\x63\x64\x65\x66\x67\x68\x69\x6a\x6b\x6c\x6d\x6e\x6f\x70" "\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f\x80" "\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90" "\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0" "\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0" "\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0" "\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0" "\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0" "\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0" "\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff" ) buffer = "A"*len_overflow + eip + badchars print('Trying to send %s bytes buffer...' % (str(len(buffer)))) try: s.connect(('mail.example.tld', 110)) s.recv(1024) s.send(str2b('USER test\r\n')) s.recv(1024) s.send(str2b('PASS ' + buffer + '\r\n')) s.recv(1024) s.send(str2b('QUIT\r\n')) print('done') except: print('Could not connect') s.close()
37.933333
91
0.662127
411
2,276
3.63747
0.829684
0.010033
0.01806
0.020067
0.040803
0.040803
0.028094
0.028094
0
0
0
0.178883
0.142794
2,276
59
92
38.576271
0.587391
0.117311
0
0.229167
1
0.333333
0.581745
0.511535
0
0
0
0
0
1
0.020833
false
0.083333
0.041667
0
0.104167
0.083333
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
1
0
1
null
0
0
0
0
0
0
0
1
0
0
0
0
0
4
0ae62858a28b29bed55955974f70b31b875ea204
152
py
Python
bcscanner_webapi/apps.py
debmalyabiswas1/BusinessCardScanner
9350141bbe59387f8ded798601377f85f4f4dc19
[ "Apache-2.0" ]
3
2020-03-09T10:21:54.000Z
2020-12-09T13:55:46.000Z
bcscanner_webapi/apps.py
debmalyabiswas1/BusinessCardScanner
9350141bbe59387f8ded798601377f85f4f4dc19
[ "Apache-2.0" ]
2
2021-10-12T22:52:25.000Z
2021-10-12T23:03:30.000Z
bcscanner_webapi/apps.py
debmalyabiswas1/BusinessCardScanner
9350141bbe59387f8ded798601377f85f4f4dc19
[ "Apache-2.0" ]
1
2020-04-02T11:42:52.000Z
2020-04-02T11:42:52.000Z
# Copyright Philip Morris Products S.A. 2019 from django.apps import AppConfig class BcscannerWebapiConfig(AppConfig): name = 'bcscanner_webapi'
19
44
0.782895
18
152
6.555556
0.944444
0
0
0
0
0
0
0
0
0
0
0.031008
0.151316
152
7
45
21.714286
0.883721
0.276316
0
0
0
0
0.148148
0
0
0
0
0
0
1
0
false
0
0.333333
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
0
0
1
0
1
0
0
4
0ae8ad8b9c3b0e92197f67a6a8e6263320100501
423
py
Python
test_envdiff.py
ndevenish/envdiff
2d235e1353497f094ce27178602aa90d9fc2432c
[ "BSD-2-Clause" ]
null
null
null
test_envdiff.py
ndevenish/envdiff
2d235e1353497f094ce27178602aa90d9fc2432c
[ "BSD-2-Clause" ]
null
null
null
test_envdiff.py
ndevenish/envdiff
2d235e1353497f094ce27178602aa90d9fc2432c
[ "BSD-2-Clause" ]
null
null
null
#!/usr/bin/env python from envdiff import contains_sublist, sublist_index def test_sublist(): assert contains_sublist([1,2,3,4,5], [5]) assert index_of_sublist([1,2,3,4,5], [5]) == 4 assert contains_sublist([1,2,3,4,5], [2,3]) assert index_of_sublist([1,2,3,4,5], [2,3]) == 1 assert not contains_sublist([1,2,3,4,5], [6]) assert not contains_sublist([], [6]) assert contains_sublist([1,2,3,4,5], [])
26.4375
51
0.652482
79
423
3.341772
0.265823
0.060606
0.204545
0.227273
0.583333
0.583333
0.583333
0.5
0.189394
0
0
0.10989
0.13948
423
16
52
26.4375
0.615385
0.047281
0
0
0
0
0
0
0
0
0
0
0.777778
1
0.111111
true
0
0.111111
0
0.222222
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
0
0
0
0
0
0
4
0aff9b59cf321dfb9d1f1d06032bf489db5e9b79
119
py
Python
seasonal_events/admin.py
hackerspace-ntnu/website
0c296cb39759778aaf0c296027345a658414b397
[ "MIT" ]
25
2016-04-13T20:25:37.000Z
2021-11-26T14:41:00.000Z
seasonal_events/admin.py
hackerspace-ntnu/website
0c296cb39759778aaf0c296027345a658414b397
[ "MIT" ]
358
2016-02-20T21:13:27.000Z
2022-03-31T20:06:03.000Z
seasonal_events/admin.py
hackerspace-ntnu/website
0c296cb39759778aaf0c296027345a658414b397
[ "MIT" ]
7
2016-04-18T14:03:15.000Z
2022-02-04T14:19:47.000Z
from django.contrib import admin from .models import Season # Register your models here. admin.site.register(Season)
17
32
0.798319
17
119
5.588235
0.647059
0
0
0
0
0
0
0
0
0
0
0
0.134454
119
6
33
19.833333
0.92233
0.218487
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
0
0
0
4
7c11c914b75e65542de5dc242f3f42964b6f97a5
312
py
Python
dialogue/models.py
waynewu6250/ChatBoxer
ae73604d4778b3b5223049e73e696ad66239c0ff
[ "MIT" ]
7
2019-04-18T14:40:37.000Z
2021-05-11T08:36:21.000Z
dialogue/models.py
waynewu6250/ChatBoxer
ae73604d4778b3b5223049e73e696ad66239c0ff
[ "MIT" ]
6
2020-06-05T20:20:50.000Z
2021-06-10T17:48:56.000Z
dialogue/models.py
waynewu6250/ChatBoxer
ae73604d4778b3b5223049e73e696ad66239c0ff
[ "MIT" ]
2
2019-04-28T15:00:31.000Z
2019-08-16T08:50:26.000Z
from django.db import models # Create your models here. class Dialogue(models.Model): text = models.TextField() user_id = models.TextField(max_length=15 ,null=True ) mode = models.TextField(max_length=7) result = models.TextField(null=True) created = models.DateTimeField(auto_now_add=True)
31.2
57
0.737179
43
312
5.232558
0.651163
0.266667
0.16
0.213333
0
0
0
0
0
0
0
0.011407
0.157051
312
9
58
34.666667
0.844106
0.076923
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.142857
0
1
0
0
0
0
null
1
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
4
7c17db2eb3cde732486087cbefd7a5bab64fe4f9
162
py
Python
srl/__init__.py
pocokhc/simple_rl
765f12f392f87e6897027905d74f1bced6a2b7bf
[ "MIT" ]
1
2022-03-01T09:16:57.000Z
2022-03-01T09:16:57.000Z
srl/__init__.py
pocokhc/simple_rl
765f12f392f87e6897027905d74f1bced6a2b7bf
[ "MIT" ]
null
null
null
srl/__init__.py
pocokhc/simple_rl
765f12f392f87e6897027905d74f1bced6a2b7bf
[ "MIT" ]
null
null
null
from . import base, envs, rl, runner, utils from .version import VERSION as __version__ # noqa F402 __all__ = ["rl", "runner", "envs", "base", "utils", "test"]
32.4
59
0.666667
22
162
4.545455
0.590909
0.16
0
0
0
0
0
0
0
0
0
0.022222
0.166667
162
4
60
40.5
0.718519
0.055556
0
0
0
0
0.165563
0
0
0
0
0
0
1
0
false
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
0
0
1
0
1
0
0
4
7c192dc98e55c2d9fdbcefeb43c762dacd014f88
112
py
Python
verbthegreatnoun/apps.py
notkrd/languagegames
d0d5a0a0673c039de4f699c1fe5cfd60b8eeaa70
[ "MIT" ]
null
null
null
verbthegreatnoun/apps.py
notkrd/languagegames
d0d5a0a0673c039de4f699c1fe5cfd60b8eeaa70
[ "MIT" ]
null
null
null
verbthegreatnoun/apps.py
notkrd/languagegames
d0d5a0a0673c039de4f699c1fe5cfd60b8eeaa70
[ "MIT" ]
null
null
null
from django.apps import AppConfig class VerbthegreatnounConfig(AppConfig): name = 'verbthegreatnoun'
18.666667
41
0.758929
10
112
8.5
0.9
0
0
0
0
0
0
0
0
0
0
0
0.178571
112
5
42
22.4
0.923913
0
0
0
0
0
0.149533
0
0
0
0
0
0
1
0
false
0
0.333333
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
0
0
1
0
1
0
0
4
7c3873a100b0a1177fc7fe640cde18fdd699ea53
529
py
Python
gclda/tests/utils.py
tsalo/python_gclda
599a71196d50b53cd20059ec7ba593570ecc1a30
[ "Apache-2.0" ]
1
2019-03-11T12:28:09.000Z
2019-03-11T12:28:09.000Z
gclda/tests/utils.py
tsalo/gclda
599a71196d50b53cd20059ec7ba593570ecc1a30
[ "Apache-2.0" ]
16
2017-08-04T22:12:03.000Z
2020-04-26T19:58:40.000Z
gclda/tests/utils.py
tsalo/gclda
599a71196d50b53cd20059ec7ba593570ecc1a30
[ "Apache-2.0" ]
3
2017-10-26T03:16:42.000Z
2020-02-21T16:41:49.000Z
# emacs: -*- mode: python-mode; py-indent-offset: 4; tab-width: 4; indent-tabs-mode: nil -*- # ex: set sts=4 ts=4 sw=4 et: """ Utility functions for testing python_gclda. """ from os.path import abspath, dirname, join, sep def get_test_data_path(): """ Returns the path to test datasets, terminated with separator. Test-related data are kept in tests folder in "data". Based on function by Yaroslav Halchenko used in Neurosynth Python package. """ return abspath(join(dirname(__file__), "data") + sep)
31.117647
92
0.693762
80
529
4.4875
0.725
0
0
0
0
0
0
0
0
0
0
0.011601
0.185255
529
16
93
33.0625
0.821346
0.669187
0
0
0
0
0.027972
0
0
0
0
0
0
1
0.333333
true
0
0.333333
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
1
0
1
0
1
0
0
4
7c59637bed94e48437c13e489119fe101fae3b20
322
py
Python
galini/error.py
cog-imperial/galini
b27e62b4e981818624f8dc315f0cadee2f7cbed2
[ "Apache-2.0" ]
14
2020-02-17T14:24:16.000Z
2022-03-18T03:21:32.000Z
galini/error.py
JackaChou/galini
b27e62b4e981818624f8dc315f0cadee2f7cbed2
[ "Apache-2.0" ]
7
2020-09-26T19:52:59.000Z
2022-01-10T21:00:44.000Z
galini/error.py
JackaChou/galini
b27e62b4e981818624f8dc315f0cadee2f7cbed2
[ "Apache-2.0" ]
5
2020-03-13T16:00:49.000Z
2022-02-10T10:19:10.000Z
"""GALINI exceptions module.""" class DomainError(ValueError): """Invalid function domain.""" pass class InvalidFileExtensionError(Exception): """Exception for invalid input file extension.""" pass class InvalidPythonInputError(Exception): """Exception for invalid python input file.""" pass
18.941176
53
0.708075
30
322
7.6
0.6
0.078947
0.184211
0.245614
0
0
0
0
0
0
0
0
0.177019
322
16
54
20.125
0.860377
0.419255
0
0.5
0
0
0
0
0
0
0
0
0
1
0
true
0.5
0
0
0.5
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
1
0
0
0
0
0
4
7c59ea73a3f6a390d3c3640ce0e3a67291d6b14b
128
py
Python
trivio/__init__.py
CuzImSyntax/TrivIO
7587cd60a22c724f2394ebcb76f5bde197b3d243
[ "MIT" ]
2
2021-06-07T17:19:01.000Z
2021-06-07T17:19:54.000Z
trivio/__init__.py
CuzImSyntax/TrivIO
7587cd60a22c724f2394ebcb76f5bde197b3d243
[ "MIT" ]
null
null
null
trivio/__init__.py
CuzImSyntax/TrivIO
7587cd60a22c724f2394ebcb76f5bde197b3d243
[ "MIT" ]
null
null
null
from .client import Client from .enums import Type, Category, Difficulty from .exceptions import NoResultFound, InvalidParameter
42.666667
55
0.84375
15
128
7.2
0.666667
0
0
0
0
0
0
0
0
0
0
0
0.109375
128
3
55
42.666667
0.947368
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
0
0
0
4
7c6d6f3f70b563b19dfc48ba80bdb8ee6f8a0548
219
py
Python
raspberryPiCPUTemperatureReading.py
bobjects/google-spreadsheet-temperature-logger
91861ddc7f651288116a727b17c9b9ffdbd15ea3
[ "MIT" ]
null
null
null
raspberryPiCPUTemperatureReading.py
bobjects/google-spreadsheet-temperature-logger
91861ddc7f651288116a727b17c9b9ffdbd15ea3
[ "MIT" ]
null
null
null
raspberryPiCPUTemperatureReading.py
bobjects/google-spreadsheet-temperature-logger
91861ddc7f651288116a727b17c9b9ffdbd15ea3
[ "MIT" ]
null
null
null
from cpuTemperatureReading import CPUTemperatureReading class RaspberryPiCPUTemperatureReading(CPUTemperatureReading): @property def procFileName(self): return "/sys/class/thermal/thermal_zone0/temp"
24.333333
62
0.799087
18
219
9.666667
0.777778
0
0
0
0
0
0
0
0
0
0
0.005291
0.136986
219
8
63
27.375
0.915344
0
0
0
0
0
0.169725
0.169725
0
0
0
0
0
1
0.2
false
0
0.2
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
0
1
1
0
0
4
7c80dee55a6280c8bec86691d98c4f96bdba75af
129
py
Python
resttest/conf.py
netguru/resttest
ada71b4d04f88e1cef1eb3798f87b866a7dabbaf
[ "MIT" ]
null
null
null
resttest/conf.py
netguru/resttest
ada71b4d04f88e1cef1eb3798f87b866a7dabbaf
[ "MIT" ]
null
null
null
resttest/conf.py
netguru/resttest
ada71b4d04f88e1cef1eb3798f87b866a7dabbaf
[ "MIT" ]
2
2019-05-21T09:39:20.000Z
2019-07-25T14:20:22.000Z
# TODO Find a way to actually configure these :D BASE_URL = 'http://localhost:8000/' MAILCATCHER_URL = 'http://localhost:1080/'
25.8
48
0.728682
19
129
4.842105
0.842105
0.152174
0.347826
0
0
0
0
0
0
0
0
0.071429
0.131783
129
4
49
32.25
0.75
0.356589
0
0
0
0
0.54321
0
0
0
0
0.25
0
1
0
false
0
0
0
0
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
1
0
0
0
0
0
0
0
0
0
0
4
7c955a6bb4e750e7656e2409532c114a00d2cc8c
151
py
Python
lang/py/cookbook/v2/source/cb2_2_10_sol_1.py
ch1huizong/learning
632267634a9fd84a5f5116de09ff1e2681a6cc85
[ "MIT" ]
null
null
null
lang/py/cookbook/v2/source/cb2_2_10_sol_1.py
ch1huizong/learning
632267634a9fd84a5f5116de09ff1e2681a6cc85
[ "MIT" ]
null
null
null
lang/py/cookbook/v2/source/cb2_2_10_sol_1.py
ch1huizong/learning
632267634a9fd84a5f5116de09ff1e2681a6cc85
[ "MIT" ]
null
null
null
import cStringIO, zipfile class ZipString(ZipFile): def __init__(self, datastring): ZipFile.__init__(self, cStringIO.StringIO(datastring))
30.2
62
0.754967
16
151
6.625
0.625
0.150943
0
0
0
0
0
0
0
0
0
0
0.145695
151
4
63
37.75
0.821705
0
0
0
0
0
0
0
0
0
0
0
0
1
0.25
false
0
0.25
0
0.75
0
1
0
0
null
0
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
4
7cd12f406d8262edf4f55f210419093611105c9b
1,035
py
Python
cvxpy/constraints/__init__.py
quantopian/cvxpy
7deee4d172470aa8f629dab7fead50467afa75ff
[ "Apache-2.0" ]
5
2017-08-31T01:37:00.000Z
2022-03-24T04:23:09.000Z
cvxpy/constraints/__init__.py
quantopian/cvxpy
7deee4d172470aa8f629dab7fead50467afa75ff
[ "Apache-2.0" ]
null
null
null
cvxpy/constraints/__init__.py
quantopian/cvxpy
7deee4d172470aa8f629dab7fead50467afa75ff
[ "Apache-2.0" ]
6
2017-02-09T19:37:07.000Z
2021-01-07T00:17:54.000Z
""" Copyright 2017 Steven Diamond 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. """ from cvxpy.constraints.bool_constr import BoolConstr from cvxpy.constraints.eq_constraint import EqConstraint from cvxpy.constraints.exponential import ExpCone from cvxpy.constraints.int_constr import IntConstr from cvxpy.constraints.leq_constraint import LeqConstraint from cvxpy.constraints.psd_constraint import PSDConstraint from cvxpy.constraints.second_order import SOC from cvxpy.constraints.semidefinite import SDP from cvxpy.constraints.soc_axis import SOC_Axis
39.807692
72
0.829952
152
1,035
5.598684
0.572368
0.095182
0.211516
0.037603
0
0
0
0
0
0
0
0.00882
0.123672
1,035
25
73
41.4
0.929438
0.535266
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
4
6b1af6ad2d2ac18b24eee9eb35d8570862d6fca2
170
py
Python
pymilvus/client/configs.py
sarvex/pymilvus
8cd5ef54eb8d3f1598d36288008b9dc5a6ae34e2
[ "Apache-2.0" ]
417
2019-06-21T02:25:25.000Z
2022-03-25T04:27:28.000Z
pymilvus/client/configs.py
sarvex/pymilvus
8cd5ef54eb8d3f1598d36288008b9dc5a6ae34e2
[ "Apache-2.0" ]
681
2019-06-18T11:03:53.000Z
2022-03-31T14:29:17.000Z
pymilvus/client/configs.py
sarvex/pymilvus
8cd5ef54eb8d3f1598d36288008b9dc5a6ae34e2
[ "Apache-2.0" ]
193
2019-06-14T07:46:55.000Z
2022-03-14T16:02:22.000Z
# TODO(dragondriver): add more default configs to here class DefaultConfigs: MaxSearchResultSize = 100 * 1024 * 1024 WaitTimeDurationWhenLoad = 0.5 # in seconds
34
54
0.747059
19
170
6.684211
0.947368
0
0
0
0
0
0
0
0
0
0
0.094203
0.188235
170
4
55
42.5
0.826087
0.370588
0
0
0
0
0
0
0
0
0
0.25
0
1
0
false
0
0
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
1
0
0
0
0
0
0
0
1
0
0
4
86119db4036fbebcfc894a152144f51b189c373e
336
py
Python
protobuf-json-read-only/test_writer.py
availabs/gtfsr2siri
8f6c517c7cbbf7800ead3b84ee12892cb5ae696b
[ "MIT" ]
1
2017-06-22T05:32:35.000Z
2017-06-22T05:32:35.000Z
protobuf-json-read-only/test_writer.py
availabs/gtfsr2siri
8f6c517c7cbbf7800ead3b84ee12892cb5ae696b
[ "MIT" ]
null
null
null
protobuf-json-read-only/test_writer.py
availabs/gtfsr2siri
8f6c517c7cbbf7800ead3b84ee12892cb5ae696b
[ "MIT" ]
null
null
null
#! /usr/bin/env python import os, sys # set import path to app root sys.path.insert(0, os.path.dirname(os.path.dirname(__file__))) import protobuf_json_writer from pprint import pprint import test_pb2 as pb_test # print protobuf_json_writer._msg2json(pb_test.TestMessage.DESCRIPTOR) print protobuf_json_writer.proto2json(pb_test)
21
70
0.806548
54
336
4.740741
0.555556
0.140625
0.210938
0.179688
0
0
0
0
0
0
0
0.013333
0.107143
336
16
71
21
0.84
0.35119
0
0
0
0
0
0
0
0
0
0
0
0
null
null
0
0.666667
null
null
0.333333
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
1
0
0
0
1
0
0
0
0
4
862487174ed631396c83b015428818b28917ae34
148
py
Python
ChangePop/otro.py
JaviBite/travis_python_test
bc00f2e0c03efe0fc2876c6db4e813335f72f2d4
[ "MIT" ]
null
null
null
ChangePop/otro.py
JaviBite/travis_python_test
bc00f2e0c03efe0fc2876c6db4e813335f72f2d4
[ "MIT" ]
1
2019-11-02T05:18:38.000Z
2019-11-02T05:18:38.000Z
ChangePop/otro.py
unizar-30226-2019-06/ChangePop-Web
e61bd25a84334096dcf9306f61543a0521f68fcc
[ "MIT" ]
null
null
null
from flask import Blueprint, url_for bp = Blueprint('otro', __name__) @bp.route('/otro') def index(): return 'otro!' + url_for('otro.index')
16.444444
42
0.668919
21
148
4.428571
0.619048
0.129032
0
0
0
0
0
0
0
0
0
0
0.155405
148
8
43
18.5
0.744
0
0
0
0
0
0.162162
0
0
0
0
0
0
1
0.2
false
0
0.2
0.2
0.6
0.4
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
0
1
1
0
0
4
862d8fead876b1adae71be127519d03ed84ae6af
115
py
Python
backend/attention_keeper/model/city.py
bennibloo/cuHacking-2021
b3add3013f5024f402ac74ca57662d798c7b2ad4
[ "MIT" ]
null
null
null
backend/attention_keeper/model/city.py
bennibloo/cuHacking-2021
b3add3013f5024f402ac74ca57662d798c7b2ad4
[ "MIT" ]
null
null
null
backend/attention_keeper/model/city.py
bennibloo/cuHacking-2021
b3add3013f5024f402ac74ca57662d798c7b2ad4
[ "MIT" ]
null
null
null
from attention_keeper.view.api import db class City(db.Model): name = db.Column(db.String, primary_key=True)
19.166667
49
0.747826
19
115
4.421053
0.842105
0
0
0
0
0
0
0
0
0
0
0
0.13913
115
5
50
23
0.848485
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.333333
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
0
0
1
0
1
0
0
4
86435e7331f0b266c2b7df0fcdcdce8106638a70
174
py
Python
Python/Associação_eclat.py
filipeaguiarrod/Formacao-Cientista-de-Dados-com-Python-e-R
c9b72f93b2a6ead49641d765fe2a0f23ffb4b1bf
[ "MIT" ]
null
null
null
Python/Associação_eclat.py
filipeaguiarrod/Formacao-Cientista-de-Dados-com-Python-e-R
c9b72f93b2a6ead49641d765fe2a0f23ffb4b1bf
[ "MIT" ]
null
null
null
Python/Associação_eclat.py
filipeaguiarrod/Formacao-Cientista-de-Dados-com-Python-e-R
c9b72f93b2a6ead49641d765fe2a0f23ffb4b1bf
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- """ Created on Fri Apr 17 15:39:35 2020 @author: rodri """ #https://github.com/Vachik-Dave/Data-Mining/tree/master/Eclat%20Algorithm%20in%20Python
17.4
87
0.689655
27
174
4.444444
1
0
0
0
0
0
0
0
0
0
0
0.123377
0.114943
174
9
88
19.333333
0.655844
0.91954
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
868c7c50ec2770cf02845091e6eb14a2f8f7c816
13,648
py
Python
sdk/servicebus/azure-servicebus/tests/async_tests/mgmt_tests/test_mgmt_topics_async.py
conniey/azure-sdk-for-python
f779de8e53dbec033f98f976284e6d9491fd60b3
[ "MIT" ]
2
2019-05-17T21:24:53.000Z
2020-02-12T11:13:42.000Z
sdk/servicebus/azure-servicebus/tests/async_tests/mgmt_tests/test_mgmt_topics_async.py
conniey/azure-sdk-for-python
f779de8e53dbec033f98f976284e6d9491fd60b3
[ "MIT" ]
null
null
null
sdk/servicebus/azure-servicebus/tests/async_tests/mgmt_tests/test_mgmt_topics_async.py
conniey/azure-sdk-for-python
f779de8e53dbec033f98f976284e6d9491fd60b3
[ "MIT" ]
2
2020-05-21T22:51:22.000Z
2020-05-26T20:53:01.000Z
#------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. #-------------------------------------------------------------------------- import logging import pytest import datetime import msrest from azure.servicebus.aio.management import ServiceBusManagementClient from azure.servicebus.management import TopicProperties from utilities import get_logger from azure.core.exceptions import HttpResponseError, ResourceExistsError from devtools_testutils import AzureMgmtTestCase, CachedResourceGroupPreparer from servicebus_preparer import ( CachedServiceBusNamespacePreparer, ServiceBusNamespacePreparer ) from mgmt_test_utilities_async import async_pageable_to_list, clear_topics _logger = get_logger(logging.DEBUG) class ServiceBusManagementClientTopicAsyncTests(AzureMgmtTestCase): @CachedResourceGroupPreparer(name_prefix='servicebustest') @CachedServiceBusNamespacePreparer(name_prefix='servicebustest') async def test_async_mgmt_topic_create_by_name(self, servicebus_namespace_connection_string, **kwargs): mgmt_service = ServiceBusManagementClient.from_connection_string(servicebus_namespace_connection_string) await clear_topics(mgmt_service) topic_name = "topic_testaddf" try: await mgmt_service.create_topic(topic_name) topic = await mgmt_service.get_topic(topic_name) assert topic.name == topic_name assert topic.entity_availability_status == 'Available' assert topic.status == 'Active' finally: await mgmt_service.delete_topic(topic_name) @CachedResourceGroupPreparer(name_prefix='servicebustest') @CachedServiceBusNamespacePreparer(name_prefix='servicebustest') async def test_async_mgmt_topic_create_with_topic_description(self, servicebus_namespace_connection_string, **kwargs): mgmt_service = ServiceBusManagementClient.from_connection_string(servicebus_namespace_connection_string) await clear_topics(mgmt_service) topic_name = "iweidk" try: await mgmt_service.create_topic( name=topic_name, auto_delete_on_idle=datetime.timedelta(minutes=10), default_message_time_to_live=datetime.timedelta(minutes=11), duplicate_detection_history_time_window=datetime.timedelta(minutes=12), enable_batched_operations=True, enable_express=True, enable_partitioning=True, enable_subscription_partitioning=True, is_anonymous_accessible=True, max_size_in_megabytes=3072 ) topic = await mgmt_service.get_topic(topic_name) assert topic.name == topic_name assert topic.auto_delete_on_idle == datetime.timedelta(minutes=10) assert topic.default_message_time_to_live == datetime.timedelta(minutes=11) assert topic.duplicate_detection_history_time_window == datetime.timedelta(minutes=12) assert topic.enable_batched_operations assert topic.enable_express assert topic.enable_partitioning assert topic.enable_subscription_partitioning assert topic.is_anonymous_accessible assert topic.max_size_in_megabytes % 3072 == 0 finally: await mgmt_service.delete_topic(topic_name) @CachedResourceGroupPreparer(name_prefix='servicebustest') @CachedServiceBusNamespacePreparer(name_prefix='servicebustest') async def test_async_mgmt_topic_create_duplicate(self, servicebus_namespace_connection_string, **kwargs): mgmt_service = ServiceBusManagementClient.from_connection_string(servicebus_namespace_connection_string) await clear_topics(mgmt_service) topic_name = "dqkodq" try: await mgmt_service.create_topic(topic_name) with pytest.raises(ResourceExistsError): await mgmt_service.create_topic(topic_name) finally: await mgmt_service.delete_topic(topic_name) @CachedResourceGroupPreparer(name_prefix='servicebustest') @CachedServiceBusNamespacePreparer(name_prefix='servicebustest') async def test_async_mgmt_topic_update_success(self, servicebus_namespace_connection_string, **kwargs): mgmt_service = ServiceBusManagementClient.from_connection_string(servicebus_namespace_connection_string) await clear_topics(mgmt_service) topic_name = "fjrui" try: topic_description = await mgmt_service.create_topic(topic_name) # Try updating one setting. topic_description.default_message_time_to_live = datetime.timedelta(minutes=2) await mgmt_service.update_topic(topic_description) topic_description = await mgmt_service.get_topic(topic_name) assert topic_description.default_message_time_to_live == datetime.timedelta(minutes=2) # Now try updating all settings. topic_description.auto_delete_on_idle = datetime.timedelta(minutes=10) topic_description.default_message_time_to_live = datetime.timedelta(minutes=11) topic_description.duplicate_detection_history_time_window = datetime.timedelta(minutes=12) topic_description.enable_batched_operations = True topic_description.enable_express = True # topic_description.enable_partitioning = True # Cannot be changed after creation topic_description.is_anonymous_accessible = True topic_description.max_size_in_megabytes = 3072 # topic_description.requires_duplicate_detection = True # Read only # topic_description.requires_session = True # Cannot be changed after creation topic_description.support_ordering = True await mgmt_service.update_topic(topic_description) topic_description = await mgmt_service.get_topic(topic_name) assert topic_description.auto_delete_on_idle == datetime.timedelta(minutes=10) assert topic_description.default_message_time_to_live == datetime.timedelta(minutes=11) assert topic_description.duplicate_detection_history_time_window == datetime.timedelta(minutes=12) assert topic_description.enable_batched_operations == True assert topic_description.enable_express == True # assert topic_description.enable_partitioning == True assert topic_description.is_anonymous_accessible == True assert topic_description.max_size_in_megabytes == 3072 # assert topic_description.requires_duplicate_detection == True # assert topic_description.requires_session == True assert topic_description.support_ordering == True finally: await mgmt_service.delete_topic(topic_name) @CachedResourceGroupPreparer(name_prefix='servicebustest') @CachedServiceBusNamespacePreparer(name_prefix='servicebustest') async def test_async_mgmt_topic_update_invalid(self, servicebus_namespace_connection_string, **kwargs): mgmt_service = ServiceBusManagementClient.from_connection_string(servicebus_namespace_connection_string) await clear_topics(mgmt_service) topic_name = "dfjfj" try: topic_description = await mgmt_service.create_topic(topic_name) # handle a null update properly. with pytest.raises(AttributeError): await mgmt_service.update_topic(None) # handle an invalid type update properly. with pytest.raises(AttributeError): await mgmt_service.update_topic(Exception("test")) # change the name to a topic that doesn't exist; should fail. topic_description.name = "iewdm" with pytest.raises(HttpResponseError): await mgmt_service.update_topic(topic_description) topic_description.name = topic_name # change the name to a topic with an invalid name exist; should fail. topic_description.name = '' with pytest.raises(msrest.exceptions.ValidationError): await mgmt_service.update_topic(topic_description) topic_description.name = topic_name # change to a setting with an invalid value; should still fail. topic_description.duplicate_detection_history_time_window = datetime.timedelta(days=25) with pytest.raises(HttpResponseError): await mgmt_service.update_topic(topic_description) topic_description.duplicate_detection_history_time_window = datetime.timedelta(minutes=5) finally: await mgmt_service.delete_topic(topic_name) @CachedResourceGroupPreparer(name_prefix='servicebustest') @CachedServiceBusNamespacePreparer(name_prefix='servicebustest') async def test_async_mgmt_topic_delete(self, servicebus_namespace_connection_string): mgmt_service = ServiceBusManagementClient.from_connection_string(servicebus_namespace_connection_string) await clear_topics(mgmt_service) await mgmt_service.create_topic('test_topic') topics = await async_pageable_to_list(mgmt_service.list_topics()) assert len(topics) == 1 await mgmt_service.create_topic('txt/.-_123') topics = await async_pageable_to_list(mgmt_service.list_topics()) assert len(topics) == 2 description = await mgmt_service.get_topic('test_topic') await mgmt_service.delete_topic(description) topics = await async_pageable_to_list(mgmt_service.list_topics()) assert len(topics) == 1 and topics[0].name == 'txt/.-_123' description = await mgmt_service.get_topic('txt/.-_123') await mgmt_service.delete_topic(description) topics = await async_pageable_to_list(mgmt_service.list_topics()) assert len(topics) == 0 @CachedResourceGroupPreparer(name_prefix='servicebustest') @CachedServiceBusNamespacePreparer(name_prefix='servicebustest') async def test_async_mgmt_topic_list(self, servicebus_namespace_connection_string, **kwargs): mgmt_service = ServiceBusManagementClient.from_connection_string(servicebus_namespace_connection_string) await clear_topics(mgmt_service) topics = await async_pageable_to_list(mgmt_service.list_topics()) assert len(topics) == 0 await mgmt_service.create_topic("test_topic_1") await mgmt_service.create_topic("test_topic_2") topics = await async_pageable_to_list(mgmt_service.list_topics()) assert len(topics) == 2 assert topics[0].name == "test_topic_1" assert topics[1].name == "test_topic_2" await mgmt_service.delete_topic("test_topic_1") await mgmt_service.delete_topic("test_topic_2") topics = await async_pageable_to_list(mgmt_service.list_topics()) assert len(topics) == 0 @CachedResourceGroupPreparer(name_prefix='servicebustest') @CachedServiceBusNamespacePreparer(name_prefix='servicebustest') async def test_async_mgmt_topic_list_runtime_info(self, servicebus_namespace_connection_string, **kwargs): mgmt_service = ServiceBusManagementClient.from_connection_string(servicebus_namespace_connection_string) await clear_topics(mgmt_service) topics = await async_pageable_to_list(mgmt_service.list_topics()) topics_infos = await async_pageable_to_list(mgmt_service.list_topics_runtime_info()) assert len(topics) == len(topics_infos) == 0 await mgmt_service.create_topic("test_topic") topics = await async_pageable_to_list(mgmt_service.list_topics()) topics_infos = await async_pageable_to_list(mgmt_service.list_topics_runtime_info()) assert len(topics) == 1 and len(topics_infos) == 1 assert topics[0].name == topics_infos[0].name == "test_topic" info = topics_infos[0] assert info.accessed_at is not None assert info.updated_at is not None assert info.subscription_count is 0 assert info.size_in_bytes == 0 assert info.scheduled_message_count == 0 await mgmt_service.delete_topic("test_topic") topics_infos = await async_pageable_to_list(mgmt_service.list_topics_runtime_info()) assert len(topics_infos) == 0 @CachedResourceGroupPreparer(name_prefix='servicebustest') @CachedServiceBusNamespacePreparer(name_prefix='servicebustest') async def test_async_mgmt_topic_get_runtime_info_basic(self, servicebus_namespace_connection_string): mgmt_service = ServiceBusManagementClient.from_connection_string(servicebus_namespace_connection_string) await clear_topics(mgmt_service) await mgmt_service.create_topic("test_topic") try: topic_runtime_info = await mgmt_service.get_topic_runtime_info("test_topic") assert topic_runtime_info assert topic_runtime_info.name == "test_topic" assert topic_runtime_info.created_at is not None assert topic_runtime_info.accessed_at is not None assert topic_runtime_info.updated_at is not None assert topic_runtime_info.subscription_count is 0 assert topic_runtime_info.size_in_bytes == 0 assert topic_runtime_info.scheduled_message_count == 0 finally: await mgmt_service.delete_topic("test_topic")
51.501887
122
0.723916
1,487
13,648
6.268325
0.119032
0.079069
0.063513
0.067589
0.816114
0.773415
0.703036
0.665808
0.628044
0.60884
0
0.007714
0.202081
13,648
264
123
51.69697
0.848209
0.073344
0
0.471154
0
0
0.039918
0
0
0
0
0
0.230769
1
0
false
0
0.052885
0
0.057692
0
0
0
0
null
0
0
0
1
1
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
869c6a1d323ef70d2fdb02c0902dce84223cd22f
891
py
Python
ops.py
zengxinzhy/HiDT
3a223d727e6888dfcdfd5e81bd83df428d3a5596
[ "BSD-3-Clause" ]
null
null
null
ops.py
zengxinzhy/HiDT
3a223d727e6888dfcdfd5e81bd83df428d3a5596
[ "BSD-3-Clause" ]
null
null
null
ops.py
zengxinzhy/HiDT
3a223d727e6888dfcdfd5e81bd83df428d3a5596
[ "BSD-3-Clause" ]
null
null
null
# coreml conversion from coremltools.converters.mil import register_torch_op from coremltools.converters.mil.frontend.torch.ops import _get_inputs from coremltools.converters.mil.mil import Builder as mb from coremltools.converters.mil.mil.ops.registry import SSAOpRegistry from coremltools.converters.mil.mil.ops.defs._op_reqs import * from coremltools.converters.mil.mil.types.symbolic import ( any_symbolic, ) from coremltools.converters.mil.backend.nn.mil_to_nn_mapping_registry import MIL_TO_NN_MAPPING_REGISTRY, register_mil_to_nn_mapping from coremltools.converters.mil.backend.nn.op_mapping import make_input from coremltools.converters.mil.frontend.torch.torch_op_registry import _TORCH_OPS_REGISTRY inference_size = 256 @register_torch_op def type_as(context, node): inputs = _get_inputs(context, node) context.add(mb.cast(x=inputs[0], dtype='fp32'), node.name)
35.64
131
0.832772
131
891
5.419847
0.335878
0.190141
0.316901
0.35493
0.464789
0.315493
0
0
0
0
0
0.007371
0.08642
891
24
132
37.125
0.864865
0.01908
0
0
0
0
0.004603
0
0
0
0
0
0
1
0.0625
false
0
0.5625
0
0.625
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
0
1
0
0
4
86a1f5ad0e211be53aa18f9725757d5670d9cf45
134
py
Python
examples/graphics/histogram.py
MWTA/Natural-Language-Processing-Python
2cc074f67f6897e802dc239d0c5cdd06a4d24a80
[ "MIT" ]
null
null
null
examples/graphics/histogram.py
MWTA/Natural-Language-Processing-Python
2cc074f67f6897e802dc239d0c5cdd06a4d24a80
[ "MIT" ]
null
null
null
examples/graphics/histogram.py
MWTA/Natural-Language-Processing-Python
2cc074f67f6897e802dc239d0c5cdd06a4d24a80
[ "MIT" ]
null
null
null
import matplotlib.pyplot as plt from bokeh.sampledata.iris import flowers as dados plt.hist(dados['sepal_length'], bins=12) plt.show()
33.5
50
0.798507
22
134
4.818182
0.772727
0
0
0
0
0
0
0
0
0
0
0.016393
0.089552
134
4
51
33.5
0.852459
0
0
0
0
0
0.088889
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
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
0
0
0
4
86d2f68993804c4f0a510c4840dae6f5216cdee5
63,767
py
Python
core/domain/suggestion_services_test.py
queencai/oppia
c9a36db9c258588b04be9bc26f3d2efef7d21abc
[ "Apache-2.0" ]
null
null
null
core/domain/suggestion_services_test.py
queencai/oppia
c9a36db9c258588b04be9bc26f3d2efef7d21abc
[ "Apache-2.0" ]
null
null
null
core/domain/suggestion_services_test.py
queencai/oppia
c9a36db9c258588b04be9bc26f3d2efef7d21abc
[ "Apache-2.0" ]
null
null
null
# Copyright 2018 The Oppia Authors. All Rights Reserved. # # 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 suggestion related services.""" from __future__ import absolute_import # pylint: disable=import-only-modules from __future__ import unicode_literals # pylint: disable=import-only-modules from core.domain import exp_domain from core.domain import exp_fetchers from core.domain import exp_services from core.domain import feedback_services from core.domain import question_domain from core.domain import rights_manager from core.domain import skill_services from core.domain import state_domain from core.domain import story_domain from core.domain import story_services from core.domain import suggestion_registry from core.domain import suggestion_services from core.domain import topic_services from core.domain import user_services from core.platform import models from core.tests import test_utils import feconf import python_utils import utils (suggestion_models, feedback_models) = models.Registry.import_models([ models.NAMES.suggestion, models.NAMES.feedback]) class SuggestionServicesUnitTests(test_utils.GenericTestBase): """Test the functions in suggestion_services.""" score_category = ( suggestion_models.SCORE_TYPE_CONTENT + suggestion_models.SCORE_CATEGORY_DELIMITER + 'Algebra') target_id = 'exp1' target_version_at_submission = 1 change = { 'cmd': exp_domain.CMD_EDIT_STATE_PROPERTY, 'property_name': exp_domain.STATE_PROPERTY_CONTENT, 'state_name': 'state_1', 'new_value': { 'content_id': 'content', 'html': 'new suggestion content' } } AUTHOR_EMAIL = 'author@example.com' REVIEWER_EMAIL = 'reviewer@example.com' NORMAL_USER_EMAIL = 'normal@example.com' THREAD_ID = 'exploration.exp1.thread_1' COMMIT_MESSAGE = 'commit message' EMPTY_COMMIT_MESSAGE = ' ' suggestion_id = THREAD_ID def setUp(self): super(SuggestionServicesUnitTests, self).setUp() self.signup(self.AUTHOR_EMAIL, 'author') self.author_id = self.get_user_id_from_email(self.AUTHOR_EMAIL) self.signup(self.REVIEWER_EMAIL, 'reviewer') self.reviewer_id = self.get_user_id_from_email(self.REVIEWER_EMAIL) self.signup(self.NORMAL_USER_EMAIL, 'normaluser') self.normal_user_id = self.get_user_id_from_email( self.NORMAL_USER_EMAIL) self.save_new_valid_exploration( self.target_id, self.author_id, category='Algebra') def mock_generate_new_thread_id(self, unused_entity_type, unused_entity_id): return self.THREAD_ID class MockExploration(python_utils.OBJECT): """Mocks an exploration. To be used only for testing.""" def __init__(self, exploration_id, states): self.id = exploration_id self.states = states self.category = 'Algebra' # All mock explorations created for testing. explorations = [ MockExploration('exp1', {'state_1': {}, 'state_2': {}}) ] def mock_get_exploration_by_id(self, exp_id): for exp in self.explorations: if exp.id == exp_id: return exp def mock_pre_accept_validate_does_nothing(self): pass def mock_get_change_list_does_nothing(self): pass def mock_accept_does_nothing(self, unused_arg): pass def test_create_new_suggestion_successfully(self): expected_suggestion_dict = { 'suggestion_id': 'exploration.exp1.thread_1', 'suggestion_type': ( suggestion_models.SUGGESTION_TYPE_EDIT_STATE_CONTENT), 'target_type': suggestion_models.TARGET_TYPE_EXPLORATION, 'target_id': self.target_id, 'target_version_at_submission': self.target_version_at_submission, 'status': suggestion_models.STATUS_IN_REVIEW, 'author_name': 'author', 'change': { 'cmd': exp_domain.CMD_EDIT_STATE_PROPERTY, 'property_name': exp_domain.STATE_PROPERTY_CONTENT, 'state_name': 'state_1', 'new_value': { 'content_id': 'content', 'html': 'new suggestion content' }, 'old_value': None }, 'score_category': self.score_category } with self.swap( feedback_models.GeneralFeedbackThreadModel, 'generate_new_thread_id', self.mock_generate_new_thread_id): with self.swap( exp_fetchers, 'get_exploration_by_id', self.mock_get_exploration_by_id): suggestion_services.create_suggestion( suggestion_models.SUGGESTION_TYPE_EDIT_STATE_CONTENT, suggestion_models.TARGET_TYPE_EXPLORATION, self.target_id, self.target_version_at_submission, self.author_id, self.change, 'test description') observed_suggestion = suggestion_services.get_suggestion_by_id( self.suggestion_id) self.assertDictContainsSubset( expected_suggestion_dict, observed_suggestion.to_dict()) def test_cannot_create_suggestion_with_invalid_suggestion_type(self): with self.assertRaisesRegexp(Exception, 'Invalid suggestion type'): suggestion_services.create_suggestion( 'invalid_suggestion_type', suggestion_models.TARGET_TYPE_EXPLORATION, self.target_id, self.target_version_at_submission, self.author_id, self.change, 'test description') def test_cannot_create_suggestion_with_invalid_author_id(self): with self.assertRaisesRegexp( Exception, 'Expected author_id to be in a valid user ID format'): suggestion_services.create_suggestion( suggestion_models.SUGGESTION_TYPE_EDIT_STATE_CONTENT, suggestion_models.TARGET_TYPE_EXPLORATION, self.target_id, self.target_version_at_submission, 'invalid author ID', self.change, 'test description') def test_cannot_create_translation_suggestion_with_invalid_content_html_raise_error(self): # pylint: disable=line-too-long add_translation_change_dict = { 'cmd': 'add_translation', 'state_name': 'Introduction', 'content_id': 'content', 'language_code': 'hi', 'content_html': '<p>The invalid content html</p>', 'translation_html': '<p>Translation for invalid content.</p>' } with self.assertRaisesRegexp( Exception, 'The given content_html does not match the content of the ' 'exploration.'): suggestion_services.create_suggestion( suggestion_models.SUGGESTION_TYPE_TRANSLATE_CONTENT, suggestion_models.TARGET_TYPE_EXPLORATION, self.target_id, self.target_version_at_submission, self.author_id, add_translation_change_dict, 'test description') def test_get_all_stale_suggestions(self): suggestion_services.create_suggestion( suggestion_models.SUGGESTION_TYPE_EDIT_STATE_CONTENT, suggestion_models.TARGET_TYPE_EXPLORATION, self.target_id, self.target_version_at_submission, self.author_id, self.change, 'test description') with self.swap( suggestion_models, 'THRESHOLD_TIME_BEFORE_ACCEPT_IN_MSECS', 0): self.assertEqual( len(suggestion_services.get_all_stale_suggestions()), 1) with self.swap( suggestion_models, 'THRESHOLD_TIME_BEFORE_ACCEPT_IN_MSECS', 7 * 24 * 60 * 60 * 1000): self.assertEqual( len(suggestion_services.get_all_stale_suggestions()), 0) def test_cannot_mark_review_completed_with_invalid_status(self): suggestion_services.create_suggestion( suggestion_models.SUGGESTION_TYPE_EDIT_STATE_CONTENT, suggestion_models.TARGET_TYPE_EXPLORATION, self.target_id, self.target_version_at_submission, self.author_id, self.change, 'test description') suggestion = suggestion_services.query_suggestions( [('author_id', self.author_id), ( 'target_id', self.target_id)])[0] with self.assertRaisesRegexp(Exception, 'Invalid status after review.'): suggestion_services.mark_review_completed( suggestion, 'invalid_status', self.reviewer_id) def mock_update_exploration( self, unused_user_id, unused_exploration_id, unused_change_list, commit_message, is_suggestion): self.assertTrue(is_suggestion) self.assertEqual( commit_message, 'Accepted suggestion by %s: %s' % ( 'author', self.COMMIT_MESSAGE)) def test_cannot_reject_suggestion_with_empty_review_message(self): suggestion_services.create_suggestion( suggestion_models.SUGGESTION_TYPE_EDIT_STATE_CONTENT, suggestion_models.TARGET_TYPE_EXPLORATION, self.target_id, self.target_version_at_submission, self.author_id, self.change, 'test description') suggestion = suggestion_services.query_suggestions( [('author_id', self.author_id), ( 'target_id', self.target_id)])[0] with self.assertRaisesRegexp( Exception, 'Review message cannot be empty.'): suggestion_services.reject_suggestion( suggestion, self.reviewer_id, '') def test_email_is_not_sent_to_unregistered_user(self): suggestion_services.create_suggestion( suggestion_models.SUGGESTION_TYPE_EDIT_STATE_CONTENT, suggestion_models.TARGET_TYPE_EXPLORATION, self.target_id, self.target_version_at_submission, self.author_id, self.change, 'test description') suggestion = suggestion_services.query_suggestions( [('author_id', self.author_id), ( 'target_id', self.target_id)])[0] self.assertFalse( suggestion_services.check_if_email_has_been_sent_to_user( 'unregistered_user_id', suggestion.score_category)) def test_cannot_mark_email_has_been_sent_to_user_with_no_user_scoring_model( self): suggestion_services.create_suggestion( suggestion_models.SUGGESTION_TYPE_EDIT_STATE_CONTENT, suggestion_models.TARGET_TYPE_EXPLORATION, self.target_id, self.target_version_at_submission, self.author_id, self.change, 'test description') suggestion = suggestion_services.query_suggestions( [('author_id', self.author_id), ( 'target_id', self.target_id)])[0] with self.assertRaisesRegexp( Exception, 'Expected user scoring model to exist for user'): suggestion_services.mark_email_has_been_sent_to_user( 'unregistered_user_id', suggestion.score_category) def test_accept_suggestion_and_send_email_to_author(self): enable_recording_of_scores_swap = self.swap( feconf, 'ENABLE_RECORDING_OF_SCORES', True) send_suggestion_review_related_emails_swap = self.swap( feconf, 'SEND_SUGGESTION_REVIEW_RELATED_EMAILS', True) change_list = [exp_domain.ExplorationChange({ 'cmd': exp_domain.CMD_ADD_STATE, 'state_name': 'state 1', })] exp_services.update_exploration( self.author_id, self.target_id, change_list, 'Add state.') new_suggestion_content = state_domain.SubtitledHtml( 'content', '<p>new suggestion content html</p>').to_dict() change_dict = { 'cmd': exp_domain.CMD_EDIT_STATE_PROPERTY, 'property_name': exp_domain.STATE_PROPERTY_CONTENT, 'state_name': 'state 1', 'new_value': new_suggestion_content } suggestion_services.create_suggestion( suggestion_models.SUGGESTION_TYPE_EDIT_STATE_CONTENT, suggestion_models.TARGET_TYPE_EXPLORATION, self.target_id, self.target_version_at_submission, self.author_id, change_dict, 'test description') suggestion = suggestion_services.query_suggestions( [('author_id', self.author_id), ( 'target_id', self.target_id)])[0] self.assertEqual( suggestion.status, suggestion_models.STATUS_IN_REVIEW) self.assertFalse( suggestion_services.check_if_email_has_been_sent_to_user( self.author_id, suggestion.score_category)) suggestion_services.increment_score_for_user( self.author_id, suggestion.score_category, 10) with enable_recording_of_scores_swap, ( send_suggestion_review_related_emails_swap): suggestion_services.accept_suggestion( suggestion, self.reviewer_id, self.COMMIT_MESSAGE, 'review message') suggestion = suggestion_services.query_suggestions( [('author_id', self.author_id), ( 'target_id', self.target_id)])[0] self.assertEqual( suggestion.status, suggestion_models.STATUS_ACCEPTED) self.assertTrue( suggestion_services.check_if_email_has_been_sent_to_user( self.author_id, suggestion.score_category)) def test_accept_suggestion_successfully(self): with self.swap( feedback_models.GeneralFeedbackThreadModel, 'generate_new_thread_id', self.mock_generate_new_thread_id): with self.swap( exp_fetchers, 'get_exploration_by_id', self.mock_get_exploration_by_id): suggestion_services.create_suggestion( suggestion_models.SUGGESTION_TYPE_EDIT_STATE_CONTENT, suggestion_models.TARGET_TYPE_EXPLORATION, self.target_id, self.target_version_at_submission, self.author_id, self.change, 'test description') suggestion = suggestion_services.get_suggestion_by_id( self.suggestion_id) with self.swap( exp_services, 'update_exploration', self.mock_update_exploration): with self.swap( exp_fetchers, 'get_exploration_by_id', self.mock_get_exploration_by_id): with self.swap( suggestion_registry.SuggestionEditStateContent, 'pre_accept_validate', self.mock_pre_accept_validate_does_nothing): with self.swap( suggestion_registry.SuggestionEditStateContent, 'get_change_list_for_accepting_suggestion', self.mock_get_change_list_does_nothing): suggestion_services.accept_suggestion( suggestion, self.reviewer_id, self.COMMIT_MESSAGE, 'review message') suggestion = suggestion_services.get_suggestion_by_id( self.suggestion_id) self.assertEqual( suggestion.status, suggestion_models.STATUS_ACCEPTED) self.assertEqual( suggestion.final_reviewer_id, self.reviewer_id) thread_messages = feedback_services.get_messages(self.THREAD_ID) last_message = thread_messages[len(thread_messages) - 1] self.assertEqual( last_message.text, 'review message') def test_accept_suggestion_with_invalid_math_fails(self): """Test that the method for accepting suggestions raises error when a suggestion with invalid math-tags is tried to be accepted. """ change_dict = { 'cmd': exp_domain.CMD_EDIT_STATE_PROPERTY, 'property_name': exp_domain.STATE_PROPERTY_CONTENT, 'state_name': 'state_1', 'new_value': { 'content_id': 'content', 'html': ( '<oppia-noninteractive-math raw_latex-with-value="&am' 'p;quot;(x - a_1)(x - a_2)(x - a_3)...(x - a_n)&amp;q' 'uot;"></oppia-noninteractive-math>') } } with self.swap( feedback_models.GeneralFeedbackThreadModel, 'generate_new_thread_id', self.mock_generate_new_thread_id): with self.swap( exp_fetchers, 'get_exploration_by_id', self.mock_get_exploration_by_id): suggestion_services.create_suggestion( suggestion_models.SUGGESTION_TYPE_EDIT_STATE_CONTENT, suggestion_models.TARGET_TYPE_EXPLORATION, self.target_id, self.target_version_at_submission, self.author_id, change_dict, 'test description') suggestion = suggestion_services.get_suggestion_by_id( self.suggestion_id) expected_exception_regexp = ( 'Invalid math tags found in the suggestion with id %s.' % ( suggestion.suggestion_id) ) with self.swap( exp_services, 'update_exploration', self.mock_update_exploration): with self.swap( exp_fetchers, 'get_exploration_by_id', self.mock_get_exploration_by_id): with self.swap( suggestion_registry.SuggestionEditStateContent, 'pre_accept_validate', self.mock_pre_accept_validate_does_nothing): with self.swap( suggestion_registry.SuggestionEditStateContent, 'get_change_list_for_accepting_suggestion', self.mock_get_change_list_does_nothing): with self.assertRaisesRegexp( Exception, expected_exception_regexp): suggestion_services.accept_suggestion( suggestion, self.reviewer_id, self.COMMIT_MESSAGE, 'review message') def test_accept_suggestion_handled_suggestion_failure(self): with self.swap( feedback_models.GeneralFeedbackThreadModel, 'generate_new_thread_id', self.mock_generate_new_thread_id): with self.swap( exp_fetchers, 'get_exploration_by_id', self.mock_get_exploration_by_id): suggestion_services.create_suggestion( suggestion_models.SUGGESTION_TYPE_EDIT_STATE_CONTENT, suggestion_models.TARGET_TYPE_EXPLORATION, self.target_id, self.target_version_at_submission, self.author_id, self.change, 'test description') suggestion = suggestion_services.get_suggestion_by_id( self.suggestion_id) suggestion.status = suggestion_models.STATUS_ACCEPTED suggestion_services._update_suggestion(suggestion) # pylint: disable=protected-access expected_exception_regexp = ( 'The suggestion with id %s has already been accepted/rejected.' % ( suggestion.suggestion_id) ) with self.assertRaisesRegexp(Exception, expected_exception_regexp): suggestion_services.accept_suggestion( suggestion, self.reviewer_id, self.COMMIT_MESSAGE, None) suggestion = suggestion_services.get_suggestion_by_id( self.suggestion_id) self.assertEqual( suggestion.status, suggestion_models.STATUS_ACCEPTED) suggestion.status = suggestion_models.STATUS_REJECTED suggestion_services._update_suggestion(suggestion) # pylint: disable=protected-access expected_exception_regexp = ( 'The suggestion with id %s has already been accepted/rejected.' % ( suggestion.suggestion_id) ) with self.assertRaisesRegexp(Exception, expected_exception_regexp): suggestion_services.accept_suggestion( suggestion, self.reviewer_id, self.COMMIT_MESSAGE, None) suggestion = suggestion_services.get_suggestion_by_id( self.suggestion_id) self.assertEqual( suggestion.status, suggestion_models.STATUS_REJECTED) def test_accept_suggestion_invalid_suggestion_failure(self): with self.swap( feedback_models.GeneralFeedbackThreadModel, 'generate_new_thread_id', self.mock_generate_new_thread_id): with self.swap( exp_fetchers, 'get_exploration_by_id', self.mock_get_exploration_by_id): suggestion_services.create_suggestion( suggestion_models.SUGGESTION_TYPE_EDIT_STATE_CONTENT, suggestion_models.TARGET_TYPE_EXPLORATION, self.target_id, self.target_version_at_submission, self.author_id, self.change, 'test description') suggestion = suggestion_services.get_suggestion_by_id( self.suggestion_id) # Invalidating the suggestion. suggestion.score_category = 'invalid_score_category' with self.assertRaisesRegexp( utils.ValidationError, 'Expected score_category to be of the form ' 'score_type.score_sub_type, received ' 'invalid_score_category'): suggestion_services._update_suggestion(suggestion) # pylint: disable=protected-access suggestion = suggestion_services.get_suggestion_by_id( self.suggestion_id) def test_accept_suggestion_no_commit_message_failure(self): with self.swap( feedback_models.GeneralFeedbackThreadModel, 'generate_new_thread_id', self.mock_generate_new_thread_id): with self.swap( exp_fetchers, 'get_exploration_by_id', self.mock_get_exploration_by_id): suggestion_services.create_suggestion( suggestion_models.SUGGESTION_TYPE_EDIT_STATE_CONTENT, suggestion_models.TARGET_TYPE_EXPLORATION, self.target_id, self.target_version_at_submission, self.author_id, self.change, 'test description') suggestion = suggestion_services.get_suggestion_by_id( self.suggestion_id) with self.assertRaisesRegexp( Exception, 'Commit message cannot be empty.'): suggestion_services.accept_suggestion( suggestion, self.reviewer_id, self.EMPTY_COMMIT_MESSAGE, None) def test_reject_suggestion_successfully(self): with self.swap( feedback_models.GeneralFeedbackThreadModel, 'generate_new_thread_id', self.mock_generate_new_thread_id): with self.swap( exp_fetchers, 'get_exploration_by_id', self.mock_get_exploration_by_id): suggestion_services.create_suggestion( suggestion_models.SUGGESTION_TYPE_EDIT_STATE_CONTENT, suggestion_models.TARGET_TYPE_EXPLORATION, self.target_id, self.target_version_at_submission, self.author_id, self.change, 'test description') suggestion = suggestion_services.get_suggestion_by_id( self.suggestion_id) suggestion_services.reject_suggestion( suggestion, self.reviewer_id, 'reject review message') suggestion = suggestion_services.get_suggestion_by_id( self.suggestion_id) self.assertEqual( suggestion.status, suggestion_models.STATUS_REJECTED) self.assertEqual( suggestion.final_reviewer_id, self.reviewer_id) thread_messages = feedback_services.get_messages(self.THREAD_ID) last_message = thread_messages[len(thread_messages) - 1] self.assertEqual(last_message.text, 'reject review message') def test_reject_suggestion_handled_suggestion_failure(self): with self.swap( feedback_models.GeneralFeedbackThreadModel, 'generate_new_thread_id', self.mock_generate_new_thread_id): with self.swap( exp_fetchers, 'get_exploration_by_id', self.mock_get_exploration_by_id): suggestion_services.create_suggestion( suggestion_models.SUGGESTION_TYPE_EDIT_STATE_CONTENT, suggestion_models.TARGET_TYPE_EXPLORATION, self.target_id, self.target_version_at_submission, self.author_id, self.change, 'test description') suggestion = suggestion_services.get_suggestion_by_id( self.suggestion_id) suggestion.status = suggestion_models.STATUS_ACCEPTED suggestion_services._update_suggestion(suggestion) # pylint: disable=protected-access expected_exception_regexp = ( 'The suggestion with id %s has already been accepted/rejected.' % ( suggestion.suggestion_id) ) with self.assertRaisesRegexp(Exception, expected_exception_regexp): suggestion_services.reject_suggestion( suggestion, self.reviewer_id, 'reject review message') suggestion = suggestion_services.get_suggestion_by_id( self.suggestion_id) self.assertEqual( suggestion.status, suggestion_models.STATUS_ACCEPTED) suggestion.status = suggestion_models.STATUS_REJECTED suggestion_services._update_suggestion(suggestion) # pylint: disable=protected-access expected_exception_regexp = ( 'The suggestion with id %s has already been accepted/rejected.' % ( suggestion.suggestion_id) ) with self.assertRaisesRegexp(Exception, expected_exception_regexp): suggestion_services.reject_suggestion( suggestion, self.reviewer_id, 'reject review message') suggestion = suggestion_services.get_suggestion_by_id( self.suggestion_id) self.assertEqual( suggestion.status, suggestion_models.STATUS_REJECTED) def test_resubmit_rejected_suggestion_success(self): with self.swap( feedback_models.GeneralFeedbackThreadModel, 'generate_new_thread_id', self.mock_generate_new_thread_id): with self.swap( exp_fetchers, 'get_exploration_by_id', self.mock_get_exploration_by_id): suggestion_services.create_suggestion( suggestion_models.SUGGESTION_TYPE_EDIT_STATE_CONTENT, suggestion_models.TARGET_TYPE_EXPLORATION, self.target_id, self.target_version_at_submission, self.author_id, self.change, 'test description') suggestion = suggestion_services.get_suggestion_by_id( self.suggestion_id) suggestion_services.reject_suggestion( suggestion, self.reviewer_id, 'reject review message') suggestion = suggestion_services.get_suggestion_by_id( self.suggestion_id) suggestion_services.resubmit_rejected_suggestion( suggestion, 'resubmit summary message', self.author_id) suggestion = suggestion_services.get_suggestion_by_id( self.suggestion_id) self.assertEqual( suggestion.status, suggestion_models.STATUS_IN_REVIEW) def test_resubmit_rejected_suggestion_failure(self): with self.swap( feedback_models.GeneralFeedbackThreadModel, 'generate_new_thread_id', self.mock_generate_new_thread_id): with self.swap( exp_fetchers, 'get_exploration_by_id', self.mock_get_exploration_by_id): suggestion_services.create_suggestion( suggestion_models.SUGGESTION_TYPE_EDIT_STATE_CONTENT, suggestion_models.TARGET_TYPE_EXPLORATION, self.target_id, self.target_version_at_submission, self.author_id, self.change, 'test description') suggestion = suggestion_services.get_suggestion_by_id( self.suggestion_id) with self.assertRaisesRegexp( Exception, 'Summary message cannot be empty.'): suggestion_services.resubmit_rejected_suggestion( suggestion, '', self.author_id) expected_exception_regexp = ( 'The suggestion with id %s is not yet handled.' % ( suggestion.suggestion_id) ) with self.assertRaisesRegexp(Exception, expected_exception_regexp): suggestion_services.resubmit_rejected_suggestion( suggestion, 'resubmit summary message', self.author_id) def test_resubmit_accepted_suggestion_failure(self): with self.swap( feedback_models.GeneralFeedbackThreadModel, 'generate_new_thread_id', self.mock_generate_new_thread_id): with self.swap( exp_fetchers, 'get_exploration_by_id', self.mock_get_exploration_by_id): suggestion_services.create_suggestion( suggestion_models.SUGGESTION_TYPE_EDIT_STATE_CONTENT, suggestion_models.TARGET_TYPE_EXPLORATION, self.target_id, self.target_version_at_submission, self.author_id, self.change, 'test description') suggestion = suggestion_services.get_suggestion_by_id( self.suggestion_id) with self.swap( suggestion_registry.SuggestionEditStateContent, 'accept', self.mock_accept_does_nothing): suggestion_services.accept_suggestion( suggestion, self.reviewer_id, self.COMMIT_MESSAGE, 'review message') suggestion = suggestion_services.get_suggestion_by_id( self.suggestion_id) expected_exception_regexp = ( 'The suggestion with id %s was accepted. Only rejected ' 'suggestions can be resubmitted.' % ( suggestion.suggestion_id) ) with self.assertRaisesRegexp( Exception, expected_exception_regexp): suggestion_services.resubmit_rejected_suggestion( suggestion, 'resubmit summary message', self.author_id) def test_check_can_resubmit_suggestion(self): with self.swap( feedback_models.GeneralFeedbackThreadModel, 'generate_new_thread_id', self.mock_generate_new_thread_id): with self.swap( exp_fetchers, 'get_exploration_by_id', self.mock_get_exploration_by_id): suggestion_services.create_suggestion( suggestion_models.SUGGESTION_TYPE_EDIT_STATE_CONTENT, suggestion_models.TARGET_TYPE_EXPLORATION, self.target_id, self.target_version_at_submission, self.author_id, self.change, 'test description') can_resubmit = suggestion_services.check_can_resubmit_suggestion( self.suggestion_id, self.author_id) self.assertEqual(can_resubmit, True) can_resubmit = suggestion_services.check_can_resubmit_suggestion( self.suggestion_id, self.normal_user_id) self.assertEqual(can_resubmit, False) class SuggestionGetServicesUnitTests(test_utils.GenericTestBase): score_category = ( suggestion_models.SCORE_TYPE_TRANSLATION + suggestion_models.SCORE_CATEGORY_DELIMITER + 'English') target_id_1 = 'exp1' target_id_2 = 'exp2' target_id_3 = 'exp3' target_version_at_submission = 1 change = { 'cmd': exp_domain.CMD_EDIT_STATE_PROPERTY, 'property_name': exp_domain.STATE_PROPERTY_CONTENT, 'state_name': 'state_1', 'new_value': 'new suggestion content' } AUTHOR_EMAIL_1 = 'author1@example.com' REVIEWER_EMAIL_1 = 'reviewer1@example.com' AUTHOR_EMAIL_2 = 'author2@example.com' REVIEWER_EMAIL_2 = 'reviewer2@example.com' class MockExploration(python_utils.OBJECT): """Mocks an exploration. To be used only for testing.""" def __init__(self, exploration_id, states): self.id = exploration_id self.states = states self.category = 'Algebra' def get_content_html(self, state_name, content_id): """Used to mock the get_content_html method for explorations.""" # state_name and content_id are used here to suppress the unused # arguments warning. The main goal of this method is to just # produce content html for the tests. return '<p>State name: %s, Content id: %s</p>' % ( state_name, content_id ) # All mock explorations created for testing. explorations = [ MockExploration('exp1', {'state_1': {}, 'state_2': {}}), MockExploration('exp2', {'state_1': {}, 'state_2': {}}), MockExploration('exp3', {'state_1': {}, 'state_2': {}}), ] def mock_get_exploration_by_id(self, exp_id): for exp in self.explorations: if exp.id == exp_id: return exp def setUp(self): super(SuggestionGetServicesUnitTests, self).setUp() self.signup(self.AUTHOR_EMAIL_1, 'author1') self.author_id_1 = self.get_user_id_from_email(self.AUTHOR_EMAIL_1) self.signup(self.REVIEWER_EMAIL_1, 'reviewer1') self.reviewer_id_1 = self.get_user_id_from_email(self.REVIEWER_EMAIL_1) self.signup(self.AUTHOR_EMAIL_2, 'author2') self.author_id_2 = self.get_user_id_from_email(self.AUTHOR_EMAIL_2) self.signup(self.REVIEWER_EMAIL_2, 'reviewer2') self.reviewer_id_2 = self.get_user_id_from_email(self.REVIEWER_EMAIL_2) with self.swap( exp_fetchers, 'get_exploration_by_id', self.mock_get_exploration_by_id): suggestion_services.create_suggestion( suggestion_models.SUGGESTION_TYPE_EDIT_STATE_CONTENT, suggestion_models.TARGET_TYPE_EXPLORATION, self.target_id_1, self.target_version_at_submission, self.author_id_1, self.change, 'test description') suggestion_services.create_suggestion( suggestion_models.SUGGESTION_TYPE_EDIT_STATE_CONTENT, suggestion_models.TARGET_TYPE_EXPLORATION, self.target_id_1, self.target_version_at_submission, self.author_id_1, self.change, 'test description') suggestion_services.create_suggestion( suggestion_models.SUGGESTION_TYPE_EDIT_STATE_CONTENT, suggestion_models.TARGET_TYPE_EXPLORATION, self.target_id_1, self.target_version_at_submission, self.author_id_1, self.change, 'test description') suggestion_services.create_suggestion( suggestion_models.SUGGESTION_TYPE_EDIT_STATE_CONTENT, suggestion_models.TARGET_TYPE_EXPLORATION, self.target_id_1, self.target_version_at_submission, self.author_id_2, self.change, 'test description') suggestion_services.create_suggestion( suggestion_models.SUGGESTION_TYPE_EDIT_STATE_CONTENT, suggestion_models.TARGET_TYPE_EXPLORATION, self.target_id_2, self.target_version_at_submission, self.author_id_2, self.change, 'test description') def test_get_by_author(self): queries = [('author_id', self.author_id_1)] self.assertEqual(len(suggestion_services.query_suggestions(queries)), 3) queries = [('author_id', self.author_id_2)] self.assertEqual(len(suggestion_services.query_suggestions(queries)), 2) def test_get_by_target_id(self): queries = [ ('target_type', suggestion_models.TARGET_TYPE_EXPLORATION), ('target_id', self.target_id_1) ] self.assertEqual(len(suggestion_services.query_suggestions(queries)), 4) queries = [ ('target_type', suggestion_models.TARGET_TYPE_EXPLORATION), ('target_id', self.target_id_2) ] self.assertEqual(len(suggestion_services.query_suggestions(queries)), 1) def test_get_by_status(self): queries = [('status', suggestion_models.STATUS_IN_REVIEW)] self.assertEqual(len(suggestion_services.query_suggestions(queries)), 5) def test_get_by_type(self): queries = [( 'suggestion_type', suggestion_models.SUGGESTION_TYPE_EDIT_STATE_CONTENT)] self.assertEqual(len(suggestion_services.query_suggestions(queries)), 5) def test_query_suggestions(self): queries = [ ('target_type', suggestion_models.TARGET_TYPE_EXPLORATION), ('target_id', self.target_id_1), ('author_id', self.author_id_2) ] self.assertEqual(len(suggestion_services.query_suggestions(queries)), 1) queries = [ ('target_type', suggestion_models.TARGET_TYPE_EXPLORATION), ('target_id', self.target_id_1), ('author_id', self.author_id_1), ('status', suggestion_models.STATUS_IN_REVIEW) ] self.assertEqual(len(suggestion_services.query_suggestions(queries)), 3) queries = [ ('target_type', suggestion_models.TARGET_TYPE_EXPLORATION), ('target_id', self.target_id_1), ('invalid_field', 'value') ] with self.assertRaisesRegexp( Exception, 'Not allowed to query on field invalid_field'): suggestion_services.query_suggestions(queries) def test_get_translation_suggestions_with_exp_ids_with_one_exp(self): add_translation_change_dict = { 'cmd': exp_domain.CMD_ADD_TRANSLATION, 'state_name': 'state_1', 'content_id': 'content', 'language_code': 'hi', 'content_html': '<p>State name: state_1, Content id: content</p>', 'translation_html': '<p>This is translated html.</p>' } # Create the translation suggestion associated with exploration id # target_id_1. with self.swap( exp_fetchers, 'get_exploration_by_id', self.mock_get_exploration_by_id): with self.swap( exp_domain.Exploration, 'get_content_html', self.MockExploration.get_content_html): suggestion_services.create_suggestion( suggestion_models.SUGGESTION_TYPE_TRANSLATE_CONTENT, suggestion_models.TARGET_TYPE_EXPLORATION, self.target_id_1, 1, self.author_id_1, add_translation_change_dict, 'test description') # Assert that there is one translation suggestion with the given # exploration id found. self.assertEqual( len(suggestion_services.get_translation_suggestions_with_exp_ids( [self.target_id_1])), 1) def test_get_translation_suggestions_with_exp_ids_with_multiple_exps( self): add_translation_change_dict = { 'cmd': exp_domain.CMD_ADD_TRANSLATION, 'state_name': 'state_1', 'content_id': 'content', 'language_code': 'hi', 'content_html': '<p>State name: state_1, Content id: content</p>', 'translation_html': '<p>This is translated html.</p>' } # Create the translation suggestion associated with exploration id # target_id_2. with self.swap( exp_fetchers, 'get_exploration_by_id', self.mock_get_exploration_by_id): with self.swap( exp_domain.Exploration, 'get_content_html', self.MockExploration.get_content_html): suggestion_services.create_suggestion( suggestion_models.SUGGESTION_TYPE_TRANSLATE_CONTENT, suggestion_models.TARGET_TYPE_EXPLORATION, self.target_id_2, 1, self.author_id_1, add_translation_change_dict, 'test description') # Create the translation suggestion associated with exploration id # target_id_3. with self.swap( exp_fetchers, 'get_exploration_by_id', self.mock_get_exploration_by_id): with self.swap( exp_domain.Exploration, 'get_content_html', self.MockExploration.get_content_html): suggestion_services.create_suggestion( suggestion_models.SUGGESTION_TYPE_TRANSLATE_CONTENT, suggestion_models.TARGET_TYPE_EXPLORATION, self.target_id_3, 1, self.author_id_1, add_translation_change_dict, 'test description') # Assert that there are two translation suggestions with the given # exploration ids found. self.assertEqual( len(suggestion_services.get_translation_suggestions_with_exp_ids( [self.target_id_2, self.target_id_3])), 2) def test_get_translation_suggestions_with_exp_ids_with_invalid_exp( self): # Assert that there are no translation suggestions with an invalid # exploration id found. self.assertEqual( len(suggestion_services.get_translation_suggestions_with_exp_ids( ['invalid_exp_id'])), 0) def test_get_translation_suggestions_with_exp_ids_with_empty_exp_list( self): # Assert that there are no translation suggestions found when we # use an empty exp_ids list. self.assertEqual( len(suggestion_services.get_translation_suggestions_with_exp_ids( [])), 0) def test_query_suggestions_that_can_be_reviewed_by_user(self): suggestion_services.create_new_user_contribution_scoring_model( 'user1', 'category1', 15) suggestion_services.create_new_user_contribution_scoring_model( 'user1', 'category2', 15) suggestion_services.create_new_user_contribution_scoring_model( 'user1', 'category3', 5) suggestion_models.GeneralSuggestionModel.create( suggestion_models.SUGGESTION_TYPE_EDIT_STATE_CONTENT, suggestion_models.TARGET_TYPE_EXPLORATION, 'exp1', 1, suggestion_models.STATUS_IN_REVIEW, 'author_3', 'reviewer_2', self.change, 'category1', 'exploration.exp1.thread_1') suggestion_models.GeneralSuggestionModel.create( suggestion_models.SUGGESTION_TYPE_EDIT_STATE_CONTENT, suggestion_models.TARGET_TYPE_EXPLORATION, 'exp1', 1, suggestion_models.STATUS_IN_REVIEW, 'author_3', 'reviewer_2', self.change, 'category2', 'exploration.exp1.thread_2') suggestion_models.GeneralSuggestionModel.create( suggestion_models.SUGGESTION_TYPE_EDIT_STATE_CONTENT, suggestion_models.TARGET_TYPE_EXPLORATION, 'exp1', 1, suggestion_models.STATUS_IN_REVIEW, 'author_3', 'reviewer_2', self.change, 'category3', 'exploration.exp1.thread_3') suggestion_models.GeneralSuggestionModel.create( suggestion_models.SUGGESTION_TYPE_EDIT_STATE_CONTENT, suggestion_models.TARGET_TYPE_EXPLORATION, 'exp1', 1, suggestion_models.STATUS_REJECTED, 'author_3', 'reviewer_2', self.change, 'category1', 'exploration.exp1.thread_4') suggestion_models.GeneralSuggestionModel.create( suggestion_models.SUGGESTION_TYPE_EDIT_STATE_CONTENT, suggestion_models.TARGET_TYPE_EXPLORATION, 'exp1', 1, suggestion_models.STATUS_IN_REVIEW, 'author_3', 'reviewer_2', self.change, 'category2', 'exploration.exp1.thread_5') self.assertEqual(len( suggestion_services .get_all_suggestions_that_can_be_reviewed_by_user('user1')), 3) self.assertEqual(len( suggestion_services .get_all_suggestions_that_can_be_reviewed_by_user('user2')), 0) class SuggestionIntegrationTests(test_utils.GenericTestBase): EXP_ID = 'exp1' TOPIC_ID = 'topic1' STORY_ID = 'story1' TRANSLATION_LANGUAGE_CODE = 'en' AUTHOR_EMAIL = 'author@example.com' score_category = ( suggestion_models.SCORE_TYPE_CONTENT + suggestion_models.SCORE_CATEGORY_DELIMITER + 'Algebra') THREAD_ID = 'exploration.exp1.thread_1' COMMIT_MESSAGE = 'commit message' def mock_generate_new_thread_id(self, unused_entity_type, unused_entity_id): return self.THREAD_ID def setUp(self): super(SuggestionIntegrationTests, self).setUp() self.signup(self.OWNER_EMAIL, self.OWNER_USERNAME) self.signup(self.EDITOR_EMAIL, self.EDITOR_USERNAME) self.signup(self.AUTHOR_EMAIL, 'author') self.owner_id = self.get_user_id_from_email(self.OWNER_EMAIL) self.editor_id = self.get_user_id_from_email(self.EDITOR_EMAIL) self.author_id = self.get_user_id_from_email(self.AUTHOR_EMAIL) self.reviewer_id = self.editor_id self.editor = user_services.UserActionsInfo(self.editor_id) # Login and create exploration and suggestions. self.login(self.EDITOR_EMAIL) # Create exploration. exploration = ( self.save_new_linear_exp_with_state_names_and_interactions( self.EXP_ID, self.editor_id, ['State 1', 'State 2'], ['TextInput'], category='Algebra')) self.old_content = state_domain.SubtitledHtml( 'content', '<p>old content</p>').to_dict() recorded_voiceovers_dict = { 'voiceovers_mapping': { 'content': { self.TRANSLATION_LANGUAGE_CODE: { 'filename': 'filename3.mp3', 'file_size_bytes': 3000, 'needs_update': False, 'duration_secs': 42.43 } }, 'default_outcome': {}, 'ca_placeholder_0': {} } } self.old_recorded_voiceovers = ( state_domain.RecordedVoiceovers.from_dict(recorded_voiceovers_dict)) # Create content in State A with a single audio subtitle. exploration.states['State 1'].update_content( state_domain.SubtitledHtml.from_dict(self.old_content)) exploration.states['State 1'].update_recorded_voiceovers( self.old_recorded_voiceovers) exp_services._save_exploration(self.editor_id, exploration, '', []) # pylint: disable=protected-access rights_manager.publish_exploration(self.editor, self.EXP_ID) rights_manager.assign_role_for_exploration( self.editor, self.EXP_ID, self.owner_id, rights_manager.ROLE_EDITOR) self.new_content = state_domain.SubtitledHtml( 'content', '<p>new content</p>').to_dict() self.change = { 'cmd': exp_domain.CMD_EDIT_STATE_PROPERTY, 'property_name': exp_domain.STATE_PROPERTY_CONTENT, 'state_name': 'State 1', 'new_value': self.new_content } self.target_version_at_submission = exploration.version # Set up for testing translation suggestions. Translation suggestions # correspond to a given topic, story and exploration. self.save_new_topic(self.TOPIC_ID, self.owner_id) self.save_new_story( self.STORY_ID, self.owner_id, self.TOPIC_ID, title='A story', description='Description', notes='Notes') # Adds the story to the topic. topic_services.add_canonical_story( self.owner_id, self.TOPIC_ID, self.STORY_ID) # Adds the exploration to the story. story_change_list_to_add_an_exp = [ story_domain.StoryChange({ 'cmd': 'add_story_node', 'node_id': 'node_1', 'title': 'Node1', }), story_domain.StoryChange({ 'cmd': 'update_story_node_property', 'property_name': 'exploration_id', 'node_id': 'node_1', 'old_value': None, 'new_value': self.EXP_ID }) ] story_services.update_story( self.owner_id, self.STORY_ID, story_change_list_to_add_an_exp, 'Added exploration.') def create_translation_suggestion_associated_with_exp( self, exp_id, author_id): """Creates a translation suggestion that is associated with an exploration with id exp_id. The author of the created suggestion is author_id. """ # Gets the html content in the exploration to be translated. exploration = exp_fetchers.get_exploration_by_id(exp_id) content_html = exploration.states['State 1'].content.html add_translation_change_dict = { 'cmd': exp_domain.CMD_ADD_TRANSLATION, 'state_name': 'State 1', 'content_id': 'content', 'language_code': 'hi', 'content_html': content_html, 'translation_html': '<p>This is translated html.</p>' } suggestion_services.create_suggestion( suggestion_models.SUGGESTION_TYPE_TRANSLATE_CONTENT, suggestion_models.TARGET_TYPE_EXPLORATION, exp_id, 1, author_id, add_translation_change_dict, 'test description') def assert_created_suggestion_is_valid(self, target_id, author_id): """Assert that the created suggestion is in review and that only one suggestion with the given target_id and author_id exists. """ suggestions = suggestion_services.query_suggestions( [('author_id', author_id), ('target_id', target_id)]) self.assertEqual(len(suggestions), 1) self.assertEqual( suggestions[0].status, suggestion_models.STATUS_IN_REVIEW) def test_create_and_accept_suggestion(self): with self.swap( feedback_models.GeneralFeedbackThreadModel, 'generate_new_thread_id', self.mock_generate_new_thread_id): suggestion_services.create_suggestion( suggestion_models.SUGGESTION_TYPE_EDIT_STATE_CONTENT, suggestion_models.TARGET_TYPE_EXPLORATION, self.EXP_ID, self.target_version_at_submission, self.author_id, self.change, 'test description') suggestion_id = self.THREAD_ID suggestion = suggestion_services.get_suggestion_by_id(suggestion_id) suggestion_services.accept_suggestion( suggestion, self.reviewer_id, self.COMMIT_MESSAGE, None) exploration = exp_fetchers.get_exploration_by_id(self.EXP_ID) self.assertEqual( exploration.states['State 1'].content.html, '<p>new content</p>') self.assertEqual(suggestion.status, suggestion_models.STATUS_ACCEPTED) def test_create_and_reject_suggestion(self): with self.swap( feedback_models.GeneralFeedbackThreadModel, 'generate_new_thread_id', self.mock_generate_new_thread_id): suggestion_services.create_suggestion( suggestion_models.SUGGESTION_TYPE_EDIT_STATE_CONTENT, suggestion_models.TARGET_TYPE_EXPLORATION, self.EXP_ID, self.target_version_at_submission, self.author_id, self.change, 'test description') suggestion_id = self.THREAD_ID suggestion = suggestion_services.get_suggestion_by_id(suggestion_id) suggestion_services.reject_suggestion( suggestion, self.reviewer_id, 'Reject message') exploration = exp_fetchers.get_exploration_by_id(self.EXP_ID) thread_messages = feedback_services.get_messages(self.THREAD_ID) last_message = thread_messages[len(thread_messages) - 1] self.assertEqual( last_message.text, 'Reject message') self.assertEqual( exploration.states['State 1'].content.html, '<p>old content</p>') suggestion = suggestion_services.get_suggestion_by_id(suggestion_id) self.assertEqual(suggestion.status, suggestion_models.STATUS_REJECTED) def test_create_and_accept_suggestion_with_message(self): with self.swap( feedback_models.GeneralFeedbackThreadModel, 'generate_new_thread_id', self.mock_generate_new_thread_id): suggestion_services.create_suggestion( suggestion_models.SUGGESTION_TYPE_EDIT_STATE_CONTENT, suggestion_models.TARGET_TYPE_EXPLORATION, self.EXP_ID, self.target_version_at_submission, self.author_id, self.change, 'test description') suggestion_id = self.THREAD_ID suggestion = suggestion_services.get_suggestion_by_id(suggestion_id) suggestion_services.accept_suggestion( suggestion, self.reviewer_id, self.COMMIT_MESSAGE, 'Accept message') exploration = exp_fetchers.get_exploration_by_id(self.EXP_ID) thread_messages = feedback_services.get_messages(self.THREAD_ID) last_message = thread_messages[len(thread_messages) - 1] self.assertEqual( last_message.text, 'Accept message') self.assertEqual( exploration.states['State 1'].content.html, '<p>new content</p>') self.assertEqual(suggestion.status, suggestion_models.STATUS_ACCEPTED) def test_delete_skill_rejects_question_suggestion(self): skill_id = skill_services.get_new_skill_id() self.save_new_skill(skill_id, self.author_id, description='description') suggestion_change = { 'cmd': ( question_domain .CMD_CREATE_NEW_FULLY_SPECIFIED_QUESTION), 'question_dict': { 'question_state_data': self._create_valid_question_data( 'default_state').to_dict(), 'language_code': 'en', 'question_state_data_schema_version': ( feconf.CURRENT_STATE_SCHEMA_VERSION), 'linked_skill_ids': ['skill_1'] }, 'skill_id': skill_id, 'skill_difficulty': 0.3 } suggestion_services.create_suggestion( suggestion_models.SUGGESTION_TYPE_ADD_QUESTION, suggestion_models.TARGET_TYPE_SKILL, skill_id, 1, self.author_id, suggestion_change, 'test description') self.assert_created_suggestion_is_valid(skill_id, self.author_id) skill_services.delete_skill(self.author_id, skill_id) # Suggestion should be rejected after corresponding skill is deleted. suggestions = suggestion_services.query_suggestions( [('author_id', self.author_id), ('target_id', skill_id)]) self.assertEqual(len(suggestions), 1) self.assertEqual( suggestions[0].status, suggestion_models.STATUS_REJECTED) def test_delete_topic_rejects_translation_suggestion(self): self.create_translation_suggestion_associated_with_exp( self.EXP_ID, self.author_id) self.assert_created_suggestion_is_valid(self.EXP_ID, self.author_id) topic_services.delete_topic(self.author_id, self.TOPIC_ID) # Suggestion should be rejected after the topic is deleted. suggestions = suggestion_services.query_suggestions( [('author_id', self.author_id), ('target_id', self.EXP_ID)]) self.assertEqual(len(suggestions), 1) self.assertEqual( suggestions[0].status, suggestion_models.STATUS_REJECTED) def test_delete_story_rejects_translation_suggestion(self): self.create_translation_suggestion_associated_with_exp( self.EXP_ID, self.author_id) self.assert_created_suggestion_is_valid(self.EXP_ID, self.author_id) story_services.delete_story(self.author_id, self.STORY_ID) # Suggestion should be rejected after the story is deleted. suggestions = suggestion_services.query_suggestions( [('author_id', self.author_id), ('target_id', self.EXP_ID)]) self.assertEqual(len(suggestions), 1) self.assertEqual( suggestions[0].status, suggestion_models.STATUS_REJECTED) def test_remove_exp_from_story_rejects_translation_suggestion(self): self.create_translation_suggestion_associated_with_exp( self.EXP_ID, self.author_id) self.assert_created_suggestion_is_valid(self.EXP_ID, self.author_id) # Removes the exploration from the story. story_services.update_story( self.owner_id, self.STORY_ID, [story_domain.StoryChange({ 'cmd': 'update_story_node_property', 'property_name': 'exploration_id', 'node_id': 'node_1', 'old_value': self.EXP_ID, 'new_value': None })], 'Removed exploration.') # Suggestion should be rejected after exploration is removed from the # story. suggestions = suggestion_services.query_suggestions( [('author_id', self.author_id), ('target_id', self.EXP_ID)]) self.assertEqual(len(suggestions), 1) self.assertEqual( suggestions[0].status, suggestion_models.STATUS_REJECTED) class UserContributionScoringUnitTests(test_utils.GenericTestBase): def setUp(self): super(UserContributionScoringUnitTests, self).setUp() suggestion_services.create_new_user_contribution_scoring_model( 'user1', 'category1', 0) suggestion_services.create_new_user_contribution_scoring_model( 'user1', 'category2', 0) suggestion_services.create_new_user_contribution_scoring_model( 'user2', 'category1', 0) self.signup('user_a@example.com', 'userA') self.signup('user_b@example.com', 'userB') self.signup('user_c@example.com', 'userC') self.user_a_id = self.get_user_id_from_email('user_a@example.com') self.user_b_id = self.get_user_id_from_email('user_b@example.com') self.user_c_id = self.get_user_id_from_email('user_c@example.com') def test_update_score_for_user(self): suggestion_services.increment_score_for_user('user1', 'category1', 1) suggestion_services.increment_score_for_user('user2', 'category1', 5) suggestion_services.increment_score_for_user('user1', 'category2', 15.2) suggestion_services.increment_score_for_user('user2', 'category2', 2) suggestion_services.increment_score_for_user('user1', 'category1', -1) scores1 = suggestion_services.get_all_scores_of_user('user1') self.assertEqual(scores1['category1'], 0) self.assertEqual(scores1['category2'], 15.2) scores2 = suggestion_services.get_all_scores_of_user('user2') self.assertEqual(scores2['category1'], 5) self.assertEqual(scores2['category2'], 2) scores3 = suggestion_services.get_all_scores_of_user('invalid_user') self.assertDictEqual(scores3, {}) def test_get_all_user_ids_who_are_allowed_to_review(self): suggestion_services.increment_score_for_user('user1', 'category1', 1) suggestion_services.increment_score_for_user('user2', 'category1', 5) suggestion_services.increment_score_for_user('user1', 'category2', 15.2) suggestion_services.increment_score_for_user('user2', 'category2', 2) with self.swap(feconf, 'MINIMUM_SCORE_REQUIRED_TO_REVIEW', 10): user_ids = ( suggestion_services.get_all_user_ids_who_are_allowed_to_review( 'category1')) self.assertEqual(user_ids, []) user_ids = ( suggestion_services.get_all_user_ids_who_are_allowed_to_review( 'category2')) self.assertEqual(user_ids, ['user1']) self.assertTrue( suggestion_services.check_user_can_review_in_category( 'user1', 'category2')) self.assertFalse( suggestion_services.check_user_can_review_in_category( 'user2', 'category1')) self.assertFalse( suggestion_services.check_user_can_review_in_category( 'user_1', 'category_new')) self.assertFalse( suggestion_services.check_user_can_review_in_category( 'invalid_user', 'category1')) def test_check_if_email_has_been_sent_to_user(self): suggestion_services.create_new_user_contribution_scoring_model( self.user_a_id, 'category_a', 15) self.assertFalse( suggestion_services.check_if_email_has_been_sent_to_user( self.user_a_id, 'category_a')) suggestion_services.mark_email_has_been_sent_to_user( self.user_a_id, 'category_a') self.assertTrue( suggestion_services.check_if_email_has_been_sent_to_user( self.user_a_id, 'category_a')) class VoiceoverApplicationServiceUnitTest(test_utils.GenericTestBase): """Tests for the ExplorationVoiceoverApplication class.""" def setUp(self): super(VoiceoverApplicationServiceUnitTest, self).setUp() self.signup('author@example.com', 'author') self.author_id = self.get_user_id_from_email('author@example.com') suggestion_models.GeneralVoiceoverApplicationModel( id='application_id', target_type='exploration', target_id='0', status='review', author_id=self.author_id, final_reviewer_id=None, language_code='en', filename='filename.mp3', content='<p>content</p>', rejection_message=None).put() self.voiceover_application_model = ( suggestion_models.GeneralVoiceoverApplicationModel.get_by_id( 'application_id')) def test_get_voiceover_application_from_model_with_invalid_type_raise_error( self): suggestion_services.get_voiceover_application( self.voiceover_application_model.id) self.voiceover_application_model.target_type = 'invalid_type' with self.assertRaisesRegexp( Exception, 'Invalid target type for voiceover application: invalid_type'): suggestion_services.get_voiceover_application( self.voiceover_application_model.id)
45.289063
126
0.657676
6,864
63,767
5.703817
0.060023
0.03249
0.022375
0.029884
0.787873
0.749202
0.723762
0.705755
0.692524
0.659523
0
0.006657
0.265059
63,767
1,407
127
45.321251
0.828742
0.048364
0
0.636128
0
0.000864
0.11394
0.024635
0
0
0
0
0.078652
1
0.051858
false
0.002593
0.019015
0.001729
0.108038
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
0
0
0
0
0
0
4
86dcb0a86e7444748b7f19653cc7e1fcf1b0191d
22
py
Python
src/lander/ext/parser/pandoc/filters/__init__.py
lsst-sqre/lander
1e8a3e29869cffc451c5fcef874cdbf663bd7965
[ "MIT" ]
2
2019-05-10T16:56:30.000Z
2021-12-13T20:28:59.000Z
src/lander/ext/parser/pandoc/filters/__init__.py
lsst-sqre/lander
1e8a3e29869cffc451c5fcef874cdbf663bd7965
[ "MIT" ]
4
2019-07-16T14:41:53.000Z
2021-02-08T00:59:45.000Z
src/lander/ext/parser/pandoc/filters/__init__.py
lsst-sqre/lander
1e8a3e29869cffc451c5fcef874cdbf663bd7965
[ "MIT" ]
null
null
null
"""Pandoc filters."""
11
21
0.590909
2
22
6.5
1
0
0
0
0
0
0
0
0
0
0
0
0.090909
22
1
22
22
0.65
0.681818
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
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
8131c362a7d7ef4460e15bc619757477c4fffa3e
2,213
py
Python
src/bgapi/gatt_server/evt.py
GetAmbush/python-bgapi
985e5849275eb5e7cf794c30ef87e16ffa91fa63
[ "MIT" ]
5
2018-05-11T14:59:50.000Z
2021-04-29T07:51:43.000Z
src/bgapi/gatt_server/evt.py
GetAmbush/python-bgapi
985e5849275eb5e7cf794c30ef87e16ffa91fa63
[ "MIT" ]
null
null
null
src/bgapi/gatt_server/evt.py
GetAmbush/python-bgapi
985e5849275eb5e7cf794c30ef87e16ffa91fa63
[ "MIT" ]
2
2018-10-05T16:51:08.000Z
2020-08-10T18:24:16.000Z
from struct import (unpack_from, calcsize, error) def attribute_value(data: bytes, offset: int = 0): FORMAT = '<BHBHB' connection, attribute, att_opcode, _offset, n = unpack_from( FORMAT, data, offset=offset) offset += calcsize(FORMAT) value = data[offset:offset + n] offset += n if len(value) < n: raise error payload = { 'connection': connection, 'attribute': attribute, 'att_opcode': att_opcode, 'offset': _offset, 'value': value, } return payload, offset def characteristic_status(data: bytes, offset: int = 0): FORMAT = '<BHBH' connection, characteristic, status_flags, client_config_flags = unpack_from( FORMAT, data, offset=offset) offset += calcsize(FORMAT) payload = { 'connection': connection, 'characteristic': characteristic, 'status_flags': status_flags, 'client_config_flags': client_config_flags, } return payload, offset def execute_write_completed(data: bytes, offset: int = 0): FORMAT = '<BH' connection, result = unpack_from(FORMAT, data, offset=offset) offset += calcsize(FORMAT) payload = { 'connection': connection, 'result': result, } return payload, offset def user_read_request(data: bytes, offset: int = 0): FORMAT = '<BHBH' connection, characteristic, att_opcode, _offset = unpack_from( FORMAT, data, offset=offset) offset += calcsize(FORMAT) payload = { 'connection': connection, 'characteristic': characteristic, 'att_opcode': att_opcode, 'offset': _offset, } return payload, offset def user_write_request(data: bytes, offset: int = 0): FORMAT = '<BHBHB' connection, characteristic, att_opcode, _offset, n = unpack_from( FORMAT, data, offset=offset) offset += calcsize(FORMAT) value = data[offset:offset + n] offset += n if len(value) < n: raise error payload = { 'connection': connection, 'characteristic': characteristic, 'att_opcode': att_opcode, 'offset': _offset, 'value': value, } return payload, offset
24.318681
80
0.621329
229
2,213
5.838428
0.170306
0.13463
0.08377
0.067315
0.838444
0.735976
0.717277
0.706806
0.646971
0.567689
0
0.003085
0.26751
2,213
90
81
24.588889
0.821715
0
0
0.691176
0
0
0.099864
0
0
0
0
0
0
1
0.073529
false
0
0.014706
0
0.161765
0
0
0
0
null
0
0
0
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
d48f82732f6cb4097910a72f6fe7ebbfcd2ddb66
549
py
Python
pacote-download/Exercicios/Desafio74.py
lucasdmazon/CursoVideo_Python
b4edb9d45aaa6bd93c06370780be09328621aa36
[ "MIT" ]
null
null
null
pacote-download/Exercicios/Desafio74.py
lucasdmazon/CursoVideo_Python
b4edb9d45aaa6bd93c06370780be09328621aa36
[ "MIT" ]
null
null
null
pacote-download/Exercicios/Desafio74.py
lucasdmazon/CursoVideo_Python
b4edb9d45aaa6bd93c06370780be09328621aa36
[ "MIT" ]
null
null
null
from random import randint ''' num1 = randint(1, 10) num2 = randint(1, 10) num3 = randint(1, 10) num4 = randint(1, 10) num5 = randint(1, 10) n = (n1, n2, n3, n4, n5) for c in range(0, len(n)): if maior == 0 or n[c] > maior: maior = n[c] if menor == 0 or n[c] < menor: menor = n[c] ''' n = (randint(1, 10), randint(1, 10), randint(1, 10), randint(1, 10), randint(1, 10)) print(f'Os valores sorteados foram: ', end=' ') for i in n: print(f'{i}', end=' ') print(f'\nMenor Valor: {min(n)}') print(f'Maior valor: {max(n)}')
23.869565
84
0.562842
100
549
3.09
0.39
0.2589
0.323625
0.220065
0.161812
0.161812
0.161812
0.161812
0.161812
0.161812
0
0.100703
0.222222
549
22
85
24.954545
0.622951
0
0
0
0
0
0.28839
0
0
0
0
0
0
1
0
false
0
0.142857
0
0.142857
0.571429
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
0
0
1
0
4
d4aedd9410c82d8bd37f5b8b6d99b36193d825d0
215
py
Python
migaku_wiktionary/__init__.py
Irio/migaku-wiktionary
e90285a2e049f454b07bc5fbf7252e28db080762
[ "MIT" ]
1
2021-10-10T18:06:56.000Z
2021-10-10T18:06:56.000Z
migaku_wiktionary/__init__.py
Irio/migaku-wiktionary
e90285a2e049f454b07bc5fbf7252e28db080762
[ "MIT" ]
1
2021-04-01T21:26:48.000Z
2021-04-01T21:26:48.000Z
migaku_wiktionary/__init__.py
Irio/migaku-wiktionary
e90285a2e049f454b07bc5fbf7252e28db080762
[ "MIT" ]
null
null
null
import sys import progressbar def is_in_test_environment(): return "pytest" in sys.modules if is_in_test_environment(): ProgressBar = progressbar.NullBar else: ProgressBar = progressbar.ProgressBar
15.357143
41
0.767442
26
215
6.115385
0.538462
0.415094
0.100629
0.238994
0
0
0
0
0
0
0
0
0.167442
215
13
42
16.538462
0.888268
0
0
0
0
0
0.027907
0
0
0
0
0
0
1
0.125
false
0
0.25
0.125
0.5
0
1
0
0
null
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
1
0
0
0
4
d4afa8e0c86611f589541c0b67b8d4b4de418b8f
4,998
py
Python
src/awkward/_v2/operations/convert/to_list.py
scikit-hep/awkward-1.0
a440328f8097d22c2ba053fd117fed543829afc0
[ "BSD-3-Clause" ]
519
2019-10-17T12:36:22.000Z
2022-03-26T23:28:19.000Z
src/awkward/_v2/operations/convert/to_list.py
scikit-hep/awkward-1.0
a440328f8097d22c2ba053fd117fed543829afc0
[ "BSD-3-Clause" ]
924
2019-11-03T21:05:01.000Z
2022-03-31T22:44:30.000Z
src/awkward/_v2/operations/convert/to_list.py
scikit-hep/awkward-1.0
a440328f8097d22c2ba053fd117fed543829afc0
[ "BSD-3-Clause" ]
56
2019-12-17T15:49:22.000Z
2022-03-09T20:34:06.000Z
# BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE from __future__ import absolute_import import awkward as ak np = ak.nplike.NumpyMetadata.instance() def to_list(array): pass # """ # Converts `array` (many types supported, including all Awkward Arrays and # Records) into Python objects. # Awkward Array types have the following Pythonic translations. # * #ak.types.PrimitiveType: converted into bool, int, float. # * #ak.types.OptionType: missing values are converted into None. # * #ak.types.ListType: converted into list. # * #ak.types.RegularType: also converted into list. Python (and JSON) # forms lose information about the regularity of list lengths. # * #ak.types.ListType with parameter `"__array__"` equal to # `"__bytestring__"`: converted into bytes. # * #ak.types.ListType with parameter `"__array__"` equal to # `"__string__"`: converted into str. # * #ak.types.RecordArray without field names: converted into tuple. # * #ak.types.RecordArray with field names: converted into dict. # * #ak.types.UnionArray: Python data are naturally heterogeneous. # See also #ak.from_iter and #ak.Array.tolist. # """ # if isinstance(array, np.bool_): # return bool(array) # elif isinstance(array, np.number): # if isinstance(array, (np.datetime64, np.timedelta64)): # return array # elif isinstance(array, np.integer): # return int(array) # elif isinstance(array, np.floating): # return float(array) # elif isinstance(array, np.all_complex): # return complex(array) # else: # raise NotImplementedError(type(array)) # elif array is None or isinstance(array, (bool, str, bytes, numbers.Number)): # return array # elif ak._util.py27 and isinstance(array, ak._util.unicode): # return array # elif isinstance(array, np.ndarray): # return array.tolist() # elif isinstance(array, ak.behaviors.string.ByteBehavior): # return array.__bytes__() # elif isinstance(array, ak.behaviors.string.CharBehavior): # return array.__str__() # elif ak.operations.describe.parameters(array).get("__array__") == "byte": # return ak.behaviors.string.CharBehavior(array).__bytes__() # elif ak.operations.describe.parameters(array).get("__array__") == "char": # return ak.behaviors.string.CharBehavior(array).__str__() # elif isinstance(array, np.datetime64) or isinstance(array, np.timedelta64): # return array # elif isinstance(array, ak.highlevel.Array): # return [to_list(x) for x in array] # elif isinstance(array, ak.highlevel.Record): # return to_list(array.layout) # elif isinstance(array, ak.highlevel.ArrayBuilder): # return to_list(array.snapshot()) # elif isinstance(array, ak.layout.Record) and array.istuple: # return tuple(to_list(x) for x in array.fields()) # elif isinstance(array, ak.layout.Record): # return {n: to_list(x) for n, x in array.fielditems()} # elif isinstance(array, ak.layout.ArrayBuilder): # return [to_list(x) for x in array.snapshot()] # elif isinstance(array, ak.layout.NumpyArray): # if array.format.upper().startswith("M"): # return ( # [ # x # for x in ak.nplike.of(array) # .asarray(array.view_int64) # .view(array.format) # ] # # FIXME: .tolist() returns # # [[1567416600000000000], [1568367000000000000], [1569096000000000000]] # # instead of [numpy.datetime64('2019-09-02T09:30:00'), numpy.datetime64('2019-09-13T09:30:00'), numpy.datetime64('2019-09-21T20:00:00')] # # see test_from_pandas() test # ) # else: # return ak.nplike.of(array).asarray(array).tolist() # elif isinstance(array, (ak.layout.Content, ak.partition.PartitionedArray)): # return [to_list(x) for x in array] # elif isinstance(array, ak._v2.contents.Content): # import awkward._v2.tmp_for_testing # return to_list(awkward._v2.tmp_for_testing.v2_to_v1(array)) # elif isinstance(array, ak._v2.record.Record): # import awkward._v2.tmp_for_testing # return to_list( # awkward._v2.tmp_for_testing.v2_to_v1(array.array[array.at : array.at + 1])[ # 0 # ] # ) # elif isinstance(array, dict): # return dict((n, to_list(x)) for n, x in array.items()) # elif isinstance(array, Iterable): # return [to_list(x) for x in array] # else: # raise TypeError( # "unrecognized array type: {0}".format(type(array)) # + ak._util.exception_suffix(__file__) # )
36.481752
154
0.614846
583
4,998
5.118353
0.28988
0.12567
0.127346
0.08445
0.412198
0.364946
0.226877
0.16689
0.092493
0.079088
0
0.035965
0.260104
4,998
136
155
36.75
0.770957
0.92537
0
0
0
0
0
0
0
0
0
0.007353
0
1
0.2
false
0.2
0.4
0
0.6
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
1
0
1
0
0
4
d4d60c907fd05ac19213545d02680b72bc681748
138
py
Python
Apps/phslack/__init__.py
mattsayar-splunk/phantom-apps
b719b78ded609ae3cbd62d7d2cc317db1a613d3b
[ "Apache-2.0" ]
74
2019-10-22T02:00:53.000Z
2022-03-15T12:56:13.000Z
Apps/phslack/__init__.py
mattsayar-splunk/phantom-apps
b719b78ded609ae3cbd62d7d2cc317db1a613d3b
[ "Apache-2.0" ]
375
2019-10-22T20:53:50.000Z
2021-11-09T21:28:43.000Z
Apps/phslack/__init__.py
mattsayar-splunk/phantom-apps
b719b78ded609ae3cbd62d7d2cc317db1a613d3b
[ "Apache-2.0" ]
175
2019-10-23T15:30:42.000Z
2021-11-05T21:33:31.000Z
# File: __init__.py # Copyright (c) 2016-2021 Splunk Inc. # # Licensed under Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt)
27.6
77
0.717391
23
138
4.130435
0.869565
0.042105
0
0
0
0
0
0
0
0
0
0.098361
0.115942
138
4
78
34.5
0.680328
0.934783
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
d4dcfbf7f584d3260615773e6310be886bb8f033
282
py
Python
clearml_agent/backend_api/services/__init__.py
Honzys/clearml-agent
f58071fc74e2df9bdba8ca91569e0bfd70ad4f46
[ "Apache-2.0" ]
112
2019-10-29T10:36:20.000Z
2020-12-19T08:08:27.000Z
clearml_agent/backend_api/services/__init__.py
Honzys/clearml-agent
f58071fc74e2df9bdba8ca91569e0bfd70ad4f46
[ "Apache-2.0" ]
53
2020-12-29T07:52:40.000Z
2022-03-31T10:11:54.000Z
clearml_agent/backend_api/services/__init__.py
Honzys/clearml-agent
f58071fc74e2df9bdba8ca91569e0bfd70ad4f46
[ "Apache-2.0" ]
29
2019-10-29T13:06:29.000Z
2020-12-19T08:09:24.000Z
from .v2_5 import auth from .v2_5 import debug from .v2_5 import queues from .v2_5 import tasks from .v2_5 import workers from .v2_5 import events from .v2_5 import models __all__ = [ 'auth', 'debug', 'queues', 'tasks', 'workers', 'events', 'models', ]
15.666667
25
0.648936
43
282
4
0.27907
0.244186
0.284884
0.52907
0
0
0
0
0
0
0
0.065421
0.241135
282
17
26
16.588235
0.738318
0
0
0
0
0
0.138298
0
0
0
0
0
0
1
0
false
0
0.4375
0
0.4375
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
1
0
0
0
0
4
d4e2a2c5748429860f85277a44564c6148a314b8
160
py
Python
notes/design/low-level/case-studies/parking-lot/parking_lot/commands/CommandStatus.py
Anmol-Singh-Jaggi/interview-notes
65af75e2b5725894fa5e13bb5cd9ecf152a0d652
[ "MIT" ]
6
2020-07-05T05:15:19.000Z
2021-01-24T20:17:14.000Z
notes/design/low-level/case-studies/parking-lot/parking_lot/commands/CommandStatus.py
Anmol-Singh-Jaggi/interview-notes
65af75e2b5725894fa5e13bb5cd9ecf152a0d652
[ "MIT" ]
null
null
null
notes/design/low-level/case-studies/parking-lot/parking_lot/commands/CommandStatus.py
Anmol-Singh-Jaggi/interview-notes
65af75e2b5725894fa5e13bb5cd9ecf152a0d652
[ "MIT" ]
2
2020-09-14T06:46:37.000Z
2021-06-15T09:17:21.000Z
from commands.AbstractCommand import AbstractCommand class CommandStatus(AbstractCommand): def execute(self): return self.parking_lot.get_status()
26.666667
52
0.7875
17
160
7.294118
0.823529
0
0
0
0
0
0
0
0
0
0
0
0.14375
160
6
53
26.666667
0.905109
0
0
0
0
0
0
0
0
0
0
0
0
1
0.25
false
0
0.25
0.25
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
0
0
0
4
d4f70745e080ac67760b51447ab1dcd52197ceef
846
py
Python
tests/test_python.py
yutaochen1998/merge.ai
86139b4920bc516cedf99ff40c376e7069a45248
[ "MIT" ]
null
null
null
tests/test_python.py
yutaochen1998/merge.ai
86139b4920bc516cedf99ff40c376e7069a45248
[ "MIT" ]
2
2020-10-04T19:54:19.000Z
2020-10-04T19:54:19.000Z
tests/test_python.py
yutaochen1998/merge.ai
86139b4920bc516cedf99ff40c376e7069a45248
[ "MIT" ]
null
null
null
def get_parameters(style_weight_select, quality_select): # default = 50 style_weight = 50 if style_weight_select == "Realistic +": style_weight = 1.0 if style_weight_select == "Realistic": style_weight = 10 if style_weight_select == "Artistic": style_weight = 100 if style_weight_select == "Artistic +": style_weight = 1000 # default = 100 epochs = 100 if quality_select == "Low": epochs = 50 if quality_select == "High": epochs = 200 return style_weight, epochs msg_1 = sys.argv[1] msg_2 = sys.argv[2] style_weight, epochs = get_parameters(msg_1, msg_2) print(style_weight, epochs)
36.782609
70
0.520095
89
846
4.640449
0.303371
0.346247
0.205811
0.184019
0.372881
0.372881
0.372881
0
0
0
0
0.063241
0.401891
846
22
71
38.454545
0.752964
0
0
0
0
0
0.05618
0
0
0
0
0
0
0
null
null
0
0
null
null
0.052632
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
1
0
0
0
0
0
0
0
0
4
be191509929fb7654682e474ae054f4e192b4a09
24
py
Python
UDSBC/BC/__init__.py
jiaojiaogou/UDSBC
6f6c2be39c5d1fa718825f63787e28ed8f37dc1a
[ "Apache-2.0" ]
null
null
null
UDSBC/BC/__init__.py
jiaojiaogou/UDSBC
6f6c2be39c5d1fa718825f63787e28ed8f37dc1a
[ "Apache-2.0" ]
null
null
null
UDSBC/BC/__init__.py
jiaojiaogou/UDSBC
6f6c2be39c5d1fa718825f63787e28ed8f37dc1a
[ "Apache-2.0" ]
null
null
null
__all__ = ["EQM", "SDM"]
24
24
0.541667
3
24
3
1
0
0
0
0
0
0
0
0
0
0
0
0.125
24
1
24
24
0.428571
0
0
0
0
0
0.24
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
0
0
0
1
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
07b5f3179446a7bb8b9a47c9a617f773eaf58826
449
py
Python
setup.py
vivekthedev/ultimate-python
8b045537e1a36c51f87ba2621589350ab0ff70ef
[ "MIT" ]
3,678
2020-08-23T18:47:23.000Z
2022-03-31T12:29:43.000Z
setup.py
vivekthedev/ultimate-python
8b045537e1a36c51f87ba2621589350ab0ff70ef
[ "MIT" ]
53
2020-08-29T15:25:06.000Z
2022-01-17T04:53:59.000Z
setup.py
vivekthedev/ultimate-python
8b045537e1a36c51f87ba2621589350ab0ff70ef
[ "MIT" ]
436
2020-08-17T22:40:38.000Z
2022-03-29T04:12:35.000Z
from setuptools import find_packages, setup setup( name="ultimate-python", version="1.0.0", packages=find_packages(), description="Ultimate Python study guide", classifiers=[ "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", ], )
28.0625
49
0.608018
47
449
5.765957
0.489362
0.350554
0.461255
0.479705
0
0
0
0
0
0
0
0.038462
0.247216
449
15
50
29.933333
0.763314
0
0
0
0
0
0.514477
0
0
0
0
0
0
1
0
true
0
0.071429
0
0.071429
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
1
0
0
0
0
0
0
4
07c3e7b824feb6623b58853cc09517b9efedf71f
23
py
Python
arrow/_version.py
impact27/arrow
69cc7b0f85d50a7f183991014bec8441373e4157
[ "Apache-2.0" ]
null
null
null
arrow/_version.py
impact27/arrow
69cc7b0f85d50a7f183991014bec8441373e4157
[ "Apache-2.0" ]
null
null
null
arrow/_version.py
impact27/arrow
69cc7b0f85d50a7f183991014bec8441373e4157
[ "Apache-2.0" ]
null
null
null
__version__ = "0.15.6"
11.5
22
0.652174
4
23
2.75
1
0
0
0
0
0
0
0
0
0
0
0.2
0.130435
23
1
23
23
0.35
0
0
0
0
0
0.26087
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
0
0
0
1
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
07cbe4a8d56cceae67ef17f418cc2944ea20495c
118
py
Python
TrainInfoProcess/src/infoModel/StationInfo.py
ZhuYing-CSU/PassengerTransportationDesign
d676ec0ac635ee73ede4d5276670b493c0c9ee15
[ "MIT" ]
1
2021-07-24T02:05:01.000Z
2021-07-24T02:05:01.000Z
TrainInfoProcess/src/infoModel/StationInfo.py
ZhuYing-CSU/PassengerTransportationDesign
d676ec0ac635ee73ede4d5276670b493c0c9ee15
[ "MIT" ]
null
null
null
TrainInfoProcess/src/infoModel/StationInfo.py
ZhuYing-CSU/PassengerTransportationDesign
d676ec0ac635ee73ede4d5276670b493c0c9ee15
[ "MIT" ]
null
null
null
from collections import namedtuple StationInfo = namedtuple("StationInfo", ["name", "arrivalTime", "departureTime"])
29.5
81
0.771186
10
118
9.1
0.8
0.461538
0
0
0
0
0
0
0
0
0
0
0.09322
118
3
82
39.333333
0.850467
0
0
0
0
0
0.330508
0
0
0
0
0
0
1
0
false
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
0
0
1
0
0
0
0
4
07dfb1b3431e796fa65248b5129096fce03a1ddf
495
py
Python
hw3/django-music-react/backend/music/serializers.py
nfranczak/COMP333
18e6921b9c06c22976d6e15a111558a33bb2f443
[ "MIT" ]
null
null
null
hw3/django-music-react/backend/music/serializers.py
nfranczak/COMP333
18e6921b9c06c22976d6e15a111558a33bb2f443
[ "MIT" ]
null
null
null
hw3/django-music-react/backend/music/serializers.py
nfranczak/COMP333
18e6921b9c06c22976d6e15a111558a33bb2f443
[ "MIT" ]
null
null
null
from rest_framework import serializers from .models import Users, Info class UsersSerializer(serializers.ModelSerializer): # call it OURMODELSerializer class Meta: model = Users # = Users/Ratings/Artists/Info fields = ('username', 'password') class InfoSerializer(serializers.ModelSerializer): # call it OURMODELSerializer class Meta: model = Info # = Users/Ratings/Artists/Info fields = ('id', 'song','artist','rating', 'user')
29.117647
57
0.670707
49
495
6.755102
0.55102
0.1571
0.181269
0.193353
0.561934
0.386707
0.386707
0.386707
0
0
0
0
0.226263
495
16
58
30.9375
0.86423
0.224242
0
0.2
0
0
0.100264
0
0
0
0
0
0
1
0
false
0.1
0.2
0
0.6
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
1
0
0
4
07f703fa83ccad82472f96365ad36b006a8ebef7
189
py
Python
objectstore/observer.py
joshysnow/objectstore
16d840c28fd1fb0cbd2cabecf2a9b85db7fc2b2e
[ "Apache-2.0" ]
null
null
null
objectstore/observer.py
joshysnow/objectstore
16d840c28fd1fb0cbd2cabecf2a9b85db7fc2b2e
[ "Apache-2.0" ]
null
null
null
objectstore/observer.py
joshysnow/objectstore
16d840c28fd1fb0cbd2cabecf2a9b85db7fc2b2e
[ "Apache-2.0" ]
null
null
null
#!/usr/bin/env python3 class Observer: """ Objects that are interested in a subject should inherit from this class. """ def notify(self, sender: object): pass
17.181818
51
0.624339
24
189
4.916667
0.958333
0
0
0
0
0
0
0
0
0
0
0.007353
0.280423
189
10
52
18.9
0.860294
0.497355
0
0
0
0
0
0
0
0
0
0
0
1
0.333333
false
0.333333
0
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
1
0
0
4
6af2f59897bd00513fb4c3ac80f07cd839ef7bcd
420
py
Python
rainbowtests/colors.py
bradmontgomery/django-rainbowtests
c54015dd46dbb1f844de097b2c97abc9bf562884
[ "MIT" ]
30
2015-01-08T04:21:48.000Z
2021-06-03T09:53:47.000Z
rainbowtests/colors.py
bradmontgomery/django-rainbowtests
c54015dd46dbb1f844de097b2c97abc9bf562884
[ "MIT" ]
8
2015-03-12T17:42:24.000Z
2022-02-03T19:10:00.000Z
rainbowtests/colors.py
bradmontgomery/django-rainbowtests
c54015dd46dbb1f844de097b2c97abc9bf562884
[ "MIT" ]
7
2015-07-16T18:54:51.000Z
2019-05-12T12:42:42.000Z
from django.utils import termcolors blue = termcolors.make_style(opts=('bold'), fg='blue') cyan = termcolors.make_style(opts=('bold'), fg='cyan') green = termcolors.make_style(fg='green') magenta = termcolors.make_style(opts=('bold'), fg='magenta') red = termcolors.make_style(opts=('bold'), fg='red') white = termcolors.make_style(opts=('bold',), fg='white') yellow = termcolors.make_style(opts=('bold'), fg='yellow')
42
60
0.716667
59
420
4.983051
0.288136
0.333333
0.452381
0.469388
0.591837
0.591837
0
0
0
0
0
0
0.07619
420
9
61
46.666667
0.757732
0
0
0
0
0
0.138095
0
0
0
0
0
0
1
0
false
0
0.125
0
0.125
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
ed0afd6cca28e69605f80e0a2cc10d9a3a326b94
3,726
py
Python
wcstring.py
heyrict/tableutils
3f55c9642bb71b9438b5a7a8a75381144c95adcd
[ "Apache-2.0" ]
null
null
null
wcstring.py
heyrict/tableutils
3f55c9642bb71b9438b5a7a8a75381144c95adcd
[ "Apache-2.0" ]
null
null
null
wcstring.py
heyrict/tableutils
3f55c9642bb71b9438b5a7a8a75381144c95adcd
[ "Apache-2.0" ]
null
null
null
# -*- coding: utf-8 -*- class wcstr(str): def __new__(*args, **kwargs): return str.__new__(*args, **kwargs) def __init__(self, *args, **kwargs): self._update() def _update(self): self.bitindex = [] for i,j in zip(str(self), range(len(str(self)))): iwidth = 1 if len(i.encode('utf8')) <= 2 else 2 self.bitindex += [j] * iwidth def __len__(self): return len(self.bitindex) def __getitem__(self, y): if type(y) == int: return wcstr(super(wcstr, self).__getitem__( self.bitindex[y])) elif type(y) == slice: start = self.bitindex[y.start] if y.start else None stop = self.bitindex[y.stop] if y.stop else None step = y.step return wcstr(super(wcstr, self).__getitem__(slice( start, stop, step))) else: return def dupstr(self): # return a duplicated string with every element # indicating one-width character return ''.join([self[i] for i in range(len(self))]) # alias for other str methods def __add__(self, *args, **kwargs): return wcstr(super(wcstr, self).__add__(*args, **kwargs)) def __mul__(self, value): return wcstr(super(wcstr, self).__mul__(value)) def __rmul__(self, *args, **kwargs): return wcstr(super(wcstr, self).__rmul__(*args, **kwargs)) def __format__(self, *args, **kwargs): return wcstr(super(wcstr, self).__format__(*args, **kwargs)) def center(self, width, fillchar=' '): filllen = (width - len(self)) // 2 return wcstr(fillchar * filllen + self + fillchar * (width - len(self) - filllen)) def ljust(self, width, fillchar=' '): return wcstr(super(wcstr, self).ljust(width - len(self) + len(str(self)), fillchar)) def rjust(self, width, fillchar=' '): return wcstr(super(wcstr, self).rjust(width - len(self) + len(str(self)), fillchar)) def casefold(self, *args, **kwargs): return wcstr(super(wcstr, self).casefold(*args, **kwargs)) def capitalize(self, *args, **kwargs): return wcstr(super(wcstr, self).capitalize(*args, **kwargs)) def expandtabs(self, *args, **kwargs): return wcstr(super(wcstr, self).expandtabs(*args, **kwargs)) def format(self, *args, **kwargs): return wcstr(super(wcstr, self).format(*args, **kwargs)) def format_map(self, *args, **kwargs): return wcstr(super(wcstr, self).format_map(*args, **kwargs)) def join(self, *args, **kwargs): return wcstr(super(wcstr, self).join(*args, **kwargs)) def lower(self, *args, **kwargs): return wcstr(super(wcstr, self).lower(*args, **kwargs)) def lstrip(self, *args, **kwargs): return wcstr(super(wcstr, self).lstrip(*args, **kwargs)) def replace(self, *args, **kwargs): return wcstr(super(wcstr, self).replace(*args, **kwargs)) def rstrip(self, *args, **kwargs): return wcstr(super(wcstr, self).rstrip(*args, **kwargs)) def strip(self, *args, **kwargs): return wcstr(super(wcstr, self).strip(*args, **kwargs)) def swapcase(self, *args, **kwargs): return wcstr(super(wcstr, self).swapcase(*args, **kwargs)) def title(self, *args, **kwargs): return wcstr(super(wcstr, self).title(*args, **kwargs)) def translate(self, *args, **kwargs): return wcstr(super(wcstr, self).translate(*args, **kwargs)) def upper(self, *args, **kwargs): return wcstr(super(wcstr, self).upper(*args, **kwargs)) def zfill(self, *args, **kwargs): return wcstr(super(wcstr, self).zfill(*args, **kwargs))
34.5
90
0.592056
460
3,726
4.656522
0.171739
0.19141
0.179272
0.235294
0.495798
0.484127
0.454248
0.454248
0.092904
0.071895
0
0.002122
0.241278
3,726
107
91
34.82243
0.755571
0.033816
0
0.027027
0
0
0.001947
0
0
0
0
0
0
1
0.391892
false
0
0
0.337838
0.783784
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
4
ed4950964f0451c88beb3040a1dbc8ed1c47b8fe
5,589
py
Python
tests/performance/test_footprint.py
rspadim/aiocache
bf675ae912173bee25cc1d8c22b77f57de34375d
[ "BSD-3-Clause" ]
213
2020-11-02T14:29:46.000Z
2022-03-24T23:12:32.000Z
tests/performance/test_footprint.py
rspadim/aiocache
bf675ae912173bee25cc1d8c22b77f57de34375d
[ "BSD-3-Clause" ]
48
2020-11-02T11:17:13.000Z
2022-03-24T17:55:31.000Z
tests/performance/test_footprint.py
rspadim/aiocache
bf675ae912173bee25cc1d8c22b77f57de34375d
[ "BSD-3-Clause" ]
49
2020-11-13T07:41:37.000Z
2022-03-25T12:24:49.000Z
import pytest import time import aioredis import aiomcache @pytest.fixture def aioredis_pool(event_loop): return event_loop.run_until_complete(aioredis.create_pool(("127.0.0.1", 6379), maxsize=1)) class TestRedis: @pytest.mark.asyncio async def test_redis_getsetdel(self, aioredis_pool, redis_cache): N = 10000 aioredis_total_time = 0 for n in range(N): start = time.time() with await aioredis_pool as redis: await redis.set("hi", "value") with await aioredis_pool as redis: await redis.get("hi") with await aioredis_pool as redis: await redis.delete("hi") aioredis_total_time += time.time() - start aiocache_total_time = 0 for n in range(N): start = time.time() await redis_cache.set("hi", "value", timeout=0) await redis_cache.get("hi", timeout=0) await redis_cache.delete("hi", timeout=0) aiocache_total_time += time.time() - start print( "\n{:0.2f}/{:0.2f}: {:0.2f}".format( aiocache_total_time, aioredis_total_time, aiocache_total_time / aioredis_total_time ) ) print("aiocache avg call: {:0.5f}s".format(aiocache_total_time / N)) print("aioredis avg call: {:0.5f}s".format(aioredis_total_time / N)) assert aiocache_total_time / aioredis_total_time < 1.30 @pytest.mark.asyncio async def test_redis_multigetsetdel(self, aioredis_pool, redis_cache): N = 5000 aioredis_total_time = 0 values = ["a", "b", "c", "d", "e", "f"] for n in range(N): start = time.time() with await aioredis_pool as redis: await redis.mset(*[x for x in values * 2]) with await aioredis_pool as redis: await redis.mget(*values) for k in values: with await aioredis_pool as redis: await redis.delete(k) aioredis_total_time += time.time() - start aiocache_total_time = 0 for n in range(N): start = time.time() await redis_cache.multi_set([(x, x) for x in values], timeout=0) await redis_cache.multi_get(values, timeout=0) for k in values: await redis_cache.delete(k, timeout=0) aiocache_total_time += time.time() - start print( "\n{:0.2f}/{:0.2f}: {:0.2f}".format( aiocache_total_time, aioredis_total_time, aiocache_total_time / aioredis_total_time ) ) print("aiocache avg call: {:0.5f}s".format(aiocache_total_time / N)) print("aioredis avg call: {:0.5f}s".format(aioredis_total_time / N)) assert aiocache_total_time / aioredis_total_time < 1.35 @pytest.fixture def aiomcache_pool(): yield aiomcache.Client("127.0.0.1", 11211, pool_size=1) class TestMemcached: @pytest.mark.asyncio async def test_memcached_getsetdel(self, aiomcache_pool, memcached_cache): N = 10000 aiomcache_total_time = 0 for n in range(N): start = time.time() await aiomcache_pool.set(b"hi", b"value") await aiomcache_pool.get(b"hi") await aiomcache_pool.delete(b"hi") aiomcache_total_time += time.time() - start aiocache_total_time = 0 for n in range(N): start = time.time() await memcached_cache.set("hi", "value", timeout=0) await memcached_cache.get("hi", timeout=0) await memcached_cache.delete("hi", timeout=0) aiocache_total_time += time.time() - start print( "\n{:0.2f}/{:0.2f}: {:0.2f}".format( aiocache_total_time, aiomcache_total_time, aiocache_total_time / aiomcache_total_time, ) ) print("aiocache avg call: {:0.5f}s".format(aiocache_total_time / N)) print("aiomcache avg call: {:0.5f}s".format(aiomcache_total_time / N)) assert aiocache_total_time / aiomcache_total_time < 1.30 @pytest.mark.asyncio async def test_memcached_multigetsetdel(self, aiomcache_pool, memcached_cache): N = 2000 aiomcache_total_time = 0 values = [b"a", b"b", b"c", b"d", b"e", b"f"] for n in range(N): start = time.time() for k in values: await aiomcache_pool.set(k, k) await aiomcache_pool.multi_get(*values) for k in values: await aiomcache_pool.delete(k) aiomcache_total_time += time.time() - start aiocache_total_time = 0 values = [b"a", b"b", b"c", b"d", b"e", b"f"] for n in range(N): start = time.time() await memcached_cache.multi_set([(x, x) for x in values], timeout=0) await memcached_cache.multi_get(values, timeout=0) for k in values: await memcached_cache.delete(k, timeout=0) aiocache_total_time += time.time() - start print( "\n{:0.2f}/{:0.2f}: {:0.2f}".format( aiocache_total_time, aiomcache_total_time, aiocache_total_time / aiomcache_total_time, ) ) print("aiocache avg call: {:0.5f}s".format(aiocache_total_time / N)) print("aiomcache avg call: {:0.5f}s".format(aiomcache_total_time / N)) assert aiocache_total_time / aiomcache_total_time < 1.90
37.26
99
0.577563
727
5,589
4.235213
0.110041
0.140305
0.132511
0.028581
0.826567
0.800909
0.747645
0.685287
0.660604
0.631699
0
0.029587
0.31061
5,589
149
100
37.510067
0.76953
0
0
0.592308
0
0
0.071927
0
0
0
0
0
0.030769
1
0.015385
false
0
0.030769
0.007692
0.069231
0.092308
0
0
0
null
0
0
0
1
1
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
ed71656700d1db7b25b8e9ec5248f1b9bc9d5715
358
py
Python
elements/python/5/9/soln.py
mmcloughlin/problems
6095842ffe007a12ec8c2093850515aa4e046616
[ "MIT" ]
11
2019-02-08T06:54:34.000Z
2021-08-07T18:57:39.000Z
elements/python/5/9/soln.py
mmcloughlin/problems
6095842ffe007a12ec8c2093850515aa4e046616
[ "MIT" ]
1
2019-05-21T08:14:10.000Z
2019-05-21T08:14:10.000Z
elements/python/5/9/soln.py
mmcloughlin/problems
6095842ffe007a12ec8c2093850515aa4e046616
[ "MIT" ]
null
null
null
def column_index(ref): n = 0 for ch in ref: x = ord(ch) - ord('A') + 1 n = 26*n + x return n def test(): assert column_index('A') == 1 assert column_index('Z') == 26 assert column_index('AA') == 27 assert column_index('AZ') == 52 def main(): test() print 'pass' if __name__ == '__main__': main()
15.565217
35
0.522346
53
358
3.283019
0.509434
0.316092
0.390805
0
0
0
0
0
0
0
0
0.044898
0.315642
358
22
36
16.272727
0.665306
0
0
0
0
0
0.053073
0
0
0
0
0
0.25
0
null
null
0.0625
0
null
null
0.0625
0
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
1
0
0
0
0
0
4
ed801b4cff08bd7703d2e568ad30d84c6b9c7b5e
581
py
Python
squid_py/ocean/ocean_providers.py
ilyabukalov/squid-py
3b9c323089351c20bf4a4e8be1e47031bd01d4ea
[ "Apache-2.0" ]
null
null
null
squid_py/ocean/ocean_providers.py
ilyabukalov/squid-py
3b9c323089351c20bf4a4e8be1e47031bd01d4ea
[ "Apache-2.0" ]
null
null
null
squid_py/ocean/ocean_providers.py
ilyabukalov/squid-py
3b9c323089351c20bf4a4e8be1e47031bd01d4ea
[ "Apache-2.0" ]
null
null
null
class OceanProviders: """Ocean assets class.""" def __init__(self, keeper, did_resolver, config): self._keeper = keeper self._did_resolver = did_resolver self._config = config def add(self, did, provider_address, account): return self._keeper.did_registry.add_provider(did, provider_address, account) def remove(self, did, provider_address, account): return self._keeper.did_registry.remove_provider(did, provider_address, account) def list(self, did): return self._keeper.did_registry.get_did_providers(did)
34.176471
88
0.709122
72
581
5.388889
0.291667
0.128866
0.134021
0.257732
0.543814
0.474227
0.28866
0.28866
0.28866
0.28866
0
0
0.196213
581
16
89
36.3125
0.830835
0.032702
0
0
0
0
0
0
0
0
0
0
0
1
0.363636
false
0
0
0.272727
0.727273
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
4
ed803bb2b1b19aa95a03eddd9cfa989aaf844e43
11,085
py
Python
api/migrations/0001_initial.py
moinku07/storemanagement
cb1a7df34cbe404cb64d8af43b25472e8e9a25cc
[ "MIT" ]
null
null
null
api/migrations/0001_initial.py
moinku07/storemanagement
cb1a7df34cbe404cb64d8af43b25472e8e9a25cc
[ "MIT" ]
null
null
null
api/migrations/0001_initial.py
moinku07/storemanagement
cb1a7df34cbe404cb64d8af43b25472e8e9a25cc
[ "MIT" ]
null
null
null
# Generated by Django 2.0.6 on 2018-06-27 14:29 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ migrations.CreateModel( name='Category', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.CharField(max_length=55)), ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='Created At')), ('updated_at', models.DateTimeField(auto_now=True, verbose_name='Updated At')), ], ), migrations.CreateModel( name='Order', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('status', models.CharField(choices=[('pending', 'Pending'), ('paid', 'Paid'), ('user_cancelled', 'User Cancelled'), ('admin_cancelled', 'Admin Cancelled'), ('admin_rejected', 'Admin Rejected'), ('store_accepted', 'Store Accepted'), ('store_rejected', 'Store Rejected'), ('driver_accepted', 'Driver Accepted'), ('store_delivered_driver', 'Store Delivered To Driver'), ('pickedup', 'Pickedup'), ('onroute', 'On Route'), ('driver_delivered_sorting', 'Delivered to sorting center'), ('nearby', 'Nearby'), ('delivered', 'Delivered'), ('delivered_courier', 'Delivered via courier'), ('notdelivered', 'Not Delivered')], default='pending', max_length=50, verbose_name='Status')), ('payment_status', models.CharField(default='N/A', max_length=50, verbose_name='Payment Status')), ('total', models.FloatField(default=0, max_length=10, verbose_name='Total')), ('delivery_price', models.FloatField(default=0, max_length=10, verbose_name='Delivery Price')), ('grand_total', models.FloatField(default=0, max_length=10, verbose_name='Grand Total')), ('notes', models.CharField(blank=True, max_length=255, null=True, verbose_name='Notes')), ('currency', models.CharField(default='AUD', max_length=10, verbose_name='Currency')), ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='Created At')), ('updated_at', models.DateTimeField(auto_now=True, verbose_name='Updated At')), ], ), migrations.CreateModel( name='OrderAddress', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.CharField(blank=True, max_length=100, null=True, verbose_name='Name')), ('lat', models.FloatField(verbose_name='Latitude')), ('lng', models.FloatField(verbose_name='Longitude')), ('street_number', models.CharField(blank=True, max_length=100, null=True, verbose_name='Street Number')), ('street_name', models.CharField(max_length=100, verbose_name='Street Name')), ('city', models.CharField(blank=True, max_length=60, null=True, verbose_name='City')), ('zip_code', models.CharField(blank=True, max_length=6)), ('state', models.CharField(blank=True, max_length=31, null=True)), ('phone', models.CharField(blank=True, max_length=100, null=True, verbose_name='Phone')), ('unit', models.CharField(blank=True, max_length=30, null=True, verbose_name='Unit')), ('note', models.CharField(blank=True, max_length=250, null=True, verbose_name='Note')), ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='Created At')), ('updated_at', models.DateTimeField(auto_now=True, verbose_name='Updated At')), ('user', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL)), ], ), migrations.CreateModel( name='OrderedProduct', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('price', models.FloatField(default=0, max_length=10, verbose_name='Price')), ('quantity', models.FloatField(default=0, max_length=10, verbose_name='Quantity')), ('discount_percentage', models.FloatField(default=0, max_length=10, verbose_name='Discount (%)')), ('size', models.CharField(default='N/A', max_length=31, verbose_name='Size')), ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='Created At')), ('updated_at', models.DateTimeField(auto_now=True, verbose_name='Updated At')), ('order', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.Order')), ], ), migrations.CreateModel( name='Product', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.CharField(max_length=55)), ('description', models.TextField()), ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='Created At')), ('updated_at', models.DateTimeField(auto_now=True, verbose_name='Updated At')), ], ), migrations.CreateModel( name='ProductPicture', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('picture', models.ImageField(upload_to='media/uploads/products')), ('order', models.IntegerField()), ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='Created At')), ('updated_at', models.DateTimeField(auto_now=True, verbose_name='Updated At')), ('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.Product')), ], ), migrations.CreateModel( name='ProductVariation', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('size', models.CharField(max_length=15)), ('price', models.DecimalField(decimal_places=2, max_digits=15)), ('discount_percentage', models.FloatField(default=0, max_length=10, verbose_name='Discount (%)')), ('quantity', models.FloatField(default=0, max_length=10, verbose_name='Quantity')), ('color', models.CharField(max_length=15)), ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='Created At')), ('updated_at', models.DateTimeField(auto_now=True, verbose_name='Updated At')), ('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.Product')), ], ), migrations.CreateModel( name='Store', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.CharField(max_length=55)), ('description', models.TextField()), ('website', models.CharField(max_length=255)), ('fb_url', models.CharField(max_length=255)), ('main_picture', models.ImageField(upload_to='media/uploads/stores/')), ('thumb', models.ImageField(upload_to='media/uploads/stores/thumbs')), ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='Created At')), ('updated_at', models.DateTimeField(auto_now=True, verbose_name='Updated At')), ], ), migrations.CreateModel( name='StoreBranch', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.CharField(max_length=55)), ('address', models.CharField(blank=True, max_length=127)), ('city', models.CharField(blank=True, max_length=55)), ('zip_code', models.CharField(blank=True, max_length=6)), ('state', models.CharField(blank=True, max_length=31, null=True)), ('lat', models.FloatField(verbose_name='Latitude')), ('lng', models.FloatField(verbose_name='Longitude')), ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='Created At')), ('updated_at', models.DateTimeField(auto_now=True, verbose_name='Updated At')), ('store', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.Store')), ], ), migrations.CreateModel( name='SubCategory', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.CharField(max_length=55)), ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='Created At')), ('updated_at', models.DateTimeField(auto_now=True, verbose_name='Updated At')), ('category', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.Category')), ('store', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.Store')), ], ), migrations.AddField( model_name='product', name='subcategory', field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.SubCategory'), ), migrations.AddField( model_name='orderedproduct', name='product', field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='api.Product'), ), migrations.AddField( model_name='orderedproduct', name='product_variation', field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='api.ProductVariation'), ), migrations.AddField( model_name='order', name='address', field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='api.OrderAddress'), ), migrations.AddField( model_name='order', name='user', field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL), ), migrations.AddField( model_name='category', name='store', field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.Store'), ), ]
61.243094
688
0.607307
1,170
11,085
5.571795
0.131624
0.091118
0.062126
0.076699
0.773892
0.744593
0.7133
0.655315
0.655315
0.654855
0
0.01224
0.240866
11,085
180
689
61.583333
0.762448
0.00406
0
0.630058
1
0
0.165882
0.010509
0
0
0
0
0
1
0
false
0
0.017341
0
0.040462
0
0
0
0
null
0
0
0
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
4
71f86b873e409e084fdec74a7706cf82432d52ee
308
py
Python
backend/api/admin.py
UAACC/404-project
54800622fae711471bced22d8e16aa962289065c
[ "Apache-2.0" ]
null
null
null
backend/api/admin.py
UAACC/404-project
54800622fae711471bced22d8e16aa962289065c
[ "Apache-2.0" ]
3
2021-02-25T23:59:28.000Z
2021-03-03T03:59:27.000Z
backend/api/admin.py
UAACC/404-project
54800622fae711471bced22d8e16aa962289065c
[ "Apache-2.0" ]
4
2021-01-27T07:02:00.000Z
2021-04-10T18:22:11.000Z
from django.contrib import admin from .models import Node, Author, Post, Comment, Likes, FriendRequest, Inbox admin.site.register(Node) admin.site.register(Author) admin.site.register(Post) admin.site.register(Comment) admin.site.register(Likes) admin.site.register(FriendRequest) admin.site.register(Inbox)
30.8
76
0.814935
43
308
5.837209
0.348837
0.250996
0.474104
0
0
0
0
0
0
0
0
0
0.068182
308
9
77
34.222222
0.874564
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.222222
0
0.222222
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
0
0
0
0
0
4
9c025b8be8dc3b884145fbed853df64c3d21b749
515
py
Python
models/SysUserDao.py
chenghao/haoAdmin
b627f3ead498cce29b23038c92230a63b3a0548f
[ "Apache-2.0" ]
1
2017-12-15T11:27:31.000Z
2017-12-15T11:27:31.000Z
models/SysUserDao.py
chenghao/haoAdmin
b627f3ead498cce29b23038c92230a63b3a0548f
[ "Apache-2.0" ]
null
null
null
models/SysUserDao.py
chenghao/haoAdmin
b627f3ead498cce29b23038c92230a63b3a0548f
[ "Apache-2.0" ]
null
null
null
# coding:utf-8 __author__ = "gaunt" from . import SysUser from utils import decorator_does_not_exist @decorator_does_not_exist def login(username, password): user = SysUser.get(SysUser.username == username, SysUser.password == password) return user @decorator_does_not_exist def get(user_id): user = SysUser.get(SysUser.user_id == user_id) return user def update_pwd(user_id, new_psw): rowid = SysUser.update(password=new_psw).where(SysUser.user_id == user_id).execute() return rowid
22.391304
88
0.747573
74
515
4.905405
0.378378
0.099174
0.132231
0.173554
0.236915
0
0
0
0
0
0
0.002288
0.151456
515
22
89
23.409091
0.828375
0.023301
0
0.285714
0
0
0.00998
0
0
0
0
0
0
1
0.214286
false
0.214286
0.142857
0
0.571429
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
1
0
0
4
9c101a85f8e706a86193944fab7eeee0322749f2
129
py
Python
apps/example/hashing/models.py
mcodegeeks/django-portfolio
2b3ef218b50e731d707e06d06c2b3b305dc86308
[ "MIT" ]
1
2019-09-21T10:05:55.000Z
2019-09-21T10:05:55.000Z
apps/example/hashing/models.py
mcodegeeks/django-portfolio
2b3ef218b50e731d707e06d06c2b3b305dc86308
[ "MIT" ]
6
2021-06-05T00:06:03.000Z
2022-03-12T00:54:07.000Z
Python/Django/hashthat/hashing/models.py
MKY01/Portfolio
aab2d184674e376e7bfea89f85987a2bbb296b66
[ "Apache-2.0" ]
null
null
null
from django.db import models class Hash(models.Model): text = models.TextField() hash = models.CharField(max_length=64)
21.5
42
0.728682
18
129
5.166667
0.777778
0.215054
0
0
0
0
0
0
0
0
0
0.018519
0.162791
129
5
43
25.8
0.842593
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.25
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
0
0
0
0
1
0
0
4
9c3a611927afccc812102d183dd4dfec836c2206
262
py
Python
chapter01/test-chapter01-07.py
manabu/nlp100-2015-python
c0f73937f5a3b832ed400cc67c213ec997c6d39e
[ "MIT" ]
null
null
null
chapter01/test-chapter01-07.py
manabu/nlp100-2015-python
c0f73937f5a3b832ed400cc67c213ec997c6d39e
[ "MIT" ]
null
null
null
chapter01/test-chapter01-07.py
manabu/nlp100-2015-python
c0f73937f5a3b832ed400cc67c213ec997c6d39e
[ "MIT" ]
null
null
null
import unittest import chapter01_07 class TestCalc(unittest.TestCase): def test_07_1(self): self.assertEqual(chapter01_07.execute("x","y","z"),"x時のyはz") def test_07_2(self): self.assertEqual(chapter01_07.execute(12,"気温",22.4),"x時のyはz")
26.2
69
0.698473
38
262
4.631579
0.578947
0.1875
0.102273
0.318182
0.420455
0.420455
0
0
0
0
0
0.102679
0.145038
262
9
70
29.111111
0.683036
0
0
0
0
0
0.064886
0
0
0
0
0
0.285714
1
0.285714
false
0
0.285714
0
0.714286
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
4
9c408582820fb525a14ecdd657fa776adc38edc2
2,648
py
Python
ddtrace/vendor/__init__.py
zhammer/dd-trace-py
4c30f6e36bfa34a63cd9b6884677c977f76d2a01
[ "Apache-2.0", "BSD-3-Clause" ]
5
2020-03-07T01:12:29.000Z
2021-04-21T00:53:19.000Z
ddtrace/vendor/__init__.py
zhammer/dd-trace-py
4c30f6e36bfa34a63cd9b6884677c977f76d2a01
[ "Apache-2.0", "BSD-3-Clause" ]
4
2019-11-22T20:58:01.000Z
2020-08-17T21:16:13.000Z
ddtrace/vendor/__init__.py
zhammer/dd-trace-py
4c30f6e36bfa34a63cd9b6884677c977f76d2a01
[ "Apache-2.0", "BSD-3-Clause" ]
3
2020-03-18T16:29:20.000Z
2020-07-20T16:05:10.000Z
""" ddtrace.vendor ============== Install vendored dependencies under a different top level package to avoid importing `ddtrace/__init__.py` whenever a dependency is imported. Doing this allows us to have a little more control over import order. Dependencies ============ six --- Website: https://six.readthedocs.io/ Source: https://github.com/benjaminp/six Version: 1.11.0 License: MIT Notes: `six/__init__.py` is just the source code's `six.py` `curl https://raw.githubusercontent.com/benjaminp/six/1.11.0/six.py > ddtrace/vendor/six/__init__.py` wrapt ----- Website: https://wrapt.readthedocs.io/en/latest/ Source: https://github.com/GrahamDumpleton/wrapt/ Version: 1.11.1 License: BSD 2-Clause "Simplified" License Notes: `wrapt/__init__.py` was updated to include a copy of `wrapt`'s license: https://github.com/GrahamDumpleton/wrapt/blob/1.11.1/LICENSE `setup.py` will attempt to build the `wrapt/_wrappers.c` C module dogstatsd --------- Website: https://datadogpy.readthedocs.io/en/latest/ Source: https://github.com/DataDog/datadogpy Version: 0.28.0 License: Copyright (c) 2015, Datadog <info@datadoghq.com> Notes: `dogstatsd/__init__.py` was updated to include a copy of the `datadogpy` license: https://github.com/DataDog/datadogpy/blob/master/LICENSE Only `datadog.dogstatsd` module was vendored to avoid unnecessary dependencies `datadog/util/compat.py` was copied to `dogstatsd/compat.py` monotonic --------- Website: https://pypi.org/project/monotonic/ Source: https://github.com/atdt/monotonic Version: 1.5 License: Apache License 2.0 Notes: The source `monotonic.py` was added as `monotonic/__init__.py` No other changes were made debtcollector ------------- Website: https://docs.openstack.org/debtcollector/latest/index.html Source: https://github.com/openstack/debtcollector Version: 1.22.0 License: Apache License 2.0 Notes: Removed dependency on `pbr` and manually set `__version__` psutil ------ Website: https://github.com/giampaolo/psutil Source: https://github.com/giampaolo/psutil Version: 5.6.7 License: BSD 3 attrs ----- Website: http://www.attrs.org/ Source: https://github.com/python-attrs/attrs Version: 19.3.0 License: MIT """ # Initialize `ddtrace.vendor.datadog.base.log` logger with our custom rate limited logger # DEV: This helps ensure if there are connection issues we do not spam their logs # DEV: Overwrite `base.log` instead of `get_logger('datadog.dogstatsd')` so we do # not conflict with any non-vendored datadog.dogstatsd logger from ..internal.logger import get_logger from .dogstatsd import base base.log = get_logger('ddtrace.vendor.dogstatsd')
26.48
140
0.743958
388
2,648
4.994845
0.404639
0.05676
0.072239
0.072239
0.184727
0.103199
0.075335
0.075335
0.033024
0
0
0.018384
0.116692
2,648
99
141
26.747475
0.810175
0.948263
0
0
0
0
0.192
0.192
0
0
0
0
0
1
0
true
0
0.666667
0
0.666667
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
4
9c5b57655efd2128cc7a22a272ba0c4ab1fc2ad4
88
py
Python
examples/apps/django2/sliders/apps.py
datalayer-contrib/holoviz-panel
c97b57e8eaff4b5f542add41f496395da2483b23
[ "BSD-3-Clause" ]
1,130
2019-11-23T09:53:37.000Z
2022-03-31T11:30:07.000Z
examples/apps/django2/sliders/apps.py
datalayer-contrib/holoviz-panel
c97b57e8eaff4b5f542add41f496395da2483b23
[ "BSD-3-Clause" ]
2,265
2019-11-20T17:09:09.000Z
2022-03-31T22:09:38.000Z
examples/apps/django2/sliders/apps.py
datalayer-contrib/holoviz-panel
c97b57e8eaff4b5f542add41f496395da2483b23
[ "BSD-3-Clause" ]
215
2019-11-26T11:49:04.000Z
2022-03-30T10:23:11.000Z
from django.apps import AppConfig class SlidersConfig(AppConfig): name = 'sliders'
17.6
33
0.761364
10
88
6.7
0.9
0
0
0
0
0
0
0
0
0
0
0
0.159091
88
4
34
22
0.905405
0
0
0
0
0
0.079545
0
0
0
0
0
0
1
0
false
0
0.333333
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
0
0
1
0
1
0
0
4
9c6770e02f37faeb6077a76ab92a8bc4960c3978
110
py
Python
django_credentials/apps.py
camuthig/python-env-credentials
d1eda1c81d79317a137574c79247f9e4804db2e9
[ "MIT" ]
null
null
null
django_credentials/apps.py
camuthig/python-env-credentials
d1eda1c81d79317a137574c79247f9e4804db2e9
[ "MIT" ]
null
null
null
django_credentials/apps.py
camuthig/python-env-credentials
d1eda1c81d79317a137574c79247f9e4804db2e9
[ "MIT" ]
null
null
null
from django.apps import AppConfig class DjangoCredentialsConfig(AppConfig): name = "django_credentials"
18.333333
41
0.8
11
110
7.909091
0.818182
0
0
0
0
0
0
0
0
0
0
0
0.136364
110
5
42
22
0.915789
0
0
0
0
0
0.163636
0
0
0
0
0
0
1
0
false
0
0.333333
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
0
0
1
0
1
0
0
4
9c6baab8365e442558dd4e8498e91ebb99997a75
280
py
Python
community/managers.py
buketkonuk/pythondotorg
4d8d9728eea7c7b2fef32eb6f24fda409cf24a06
[ "Apache-2.0" ]
911
2015-01-03T22:16:06.000Z
2022-03-31T23:56:22.000Z
community/managers.py
buketkonuk/pythondotorg
4d8d9728eea7c7b2fef32eb6f24fda409cf24a06
[ "Apache-2.0" ]
1,342
2015-01-02T16:14:45.000Z
2022-03-28T08:01:20.000Z
community/managers.py
buketkonuk/pythondotorg
4d8d9728eea7c7b2fef32eb6f24fda409cf24a06
[ "Apache-2.0" ]
551
2015-01-04T02:17:31.000Z
2022-03-23T11:59:25.000Z
from django.db.models.query import QuerySet class PostQuerySet(QuerySet): def public(self): return self.filter(status__exact=self.model.STATUS_PUBLIC) def private(self): return self.filter(status__in=[ self.model.STATUS_PRIVATE, ])
21.538462
66
0.675
34
280
5.382353
0.558824
0.10929
0.153005
0.218579
0.284153
0
0
0
0
0
0
0
0.228571
280
12
67
23.333333
0.847222
0
0
0
0
0
0
0
0
0
0
0
0
1
0.25
false
0
0.125
0.25
0.75
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
4
9c7a60629d78289ecad437fc4e1d28850ae27f76
2,583
py
Python
app/routes.py
kendrajmoore/flask-portfolio
42303ede585ddf9c5a605b364124e6b1f4dcd4a1
[ "MIT" ]
null
null
null
app/routes.py
kendrajmoore/flask-portfolio
42303ede585ddf9c5a605b364124e6b1f4dcd4a1
[ "MIT" ]
12
2021-06-20T21:44:16.000Z
2021-06-22T13:27:09.000Z
app/routes.py
kendrajmoore/flask-portfolio
42303ede585ddf9c5a605b364124e6b1f4dcd4a1
[ "MIT" ]
null
null
null
import os from app import app from app import db from flask import render_template, request, redirect from app.models import UserModel from werkzeug.security import check_password_hash, generate_password_hash from app.forms import RegistrationForm from app.forms import LoginForm @app.route("/") def index(): return render_template("index.html", title="Welcome", url=os.getenv("URL")), 200 @app.route("/health") def health(): return "Works" @app.route("/about") def about(): return render_template("about.html", title="About Me", url=os.getenv("URL")), 200 @app.route("/blog") def blog(): return render_template("blog_two.html", title="Blogs", url=os.getenv("URL")), 200 @app.route("/code") def project(): return render_template("project.html", title="Projects", url=os.getenv("URL")), 200 @app.route("/register", methods=("GET", "POST")) def register(): form = RegistrationForm() if request.method == "POST": username = request.form.get("username") password = request.form.get("password") error = None if not username: error = "Username is required." elif not password: error = "Password is required." if error is None: new_user = UserModel(username, generate_password_hash(password)) db.session.add(new_user) db.session.commit() return render_template("index.html", title="Registered", url=os.getenv("URL")), 200 else: return error, 418 # TODO: Return a restister page return render_template("register.html", title="Register", form=form), 200 @app.route("/login", methods=("GET", "POST")) def login(): form = LoginForm() if request.method == "POST": username = request.form.get("username") password = request.form.get("password") error = None user = UserModel.query.filter_by(username=username).first() if user is None: error = "Incorrect username." elif not check_password_hash(user.password, password): error = "Incorrect password." if error is None: return render_template("index.html", title="Logged In", url=os.getenv("URL")), 200 else: return error, 418 # TODO: Return a login page return render_template("login.html", title="Login", form=form), 200 @app.route("/resume") def resume(): return redirect("./static/files/kendra.pdf") @app.errorhandler(404) def page_not_found(error): return render_template("404.html", title="Login"), 404
28.384615
95
0.644599
324
2,583
5.064815
0.256173
0.085314
0.109689
0.051188
0.309567
0.286411
0.224254
0.163315
0.163315
0.163315
0
0.019221
0.214479
2,583
90
96
28.7
0.789552
0.021293
0
0.215385
1
0
0.154059
0.009901
0
0
0
0.011111
0
1
0.138462
false
0.123077
0.123077
0.107692
0.461538
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
0
0
1
0
1
0
0
0
4
9c7b60f27dbdcd96d828d21772d8bd498f6924d7
229
py
Python
dassl/data/datasets/da/__init__.py
weiliuxm/Dassl.pytorch
8084b66332623c7a2394ea1404f2d043ef415ebb
[ "MIT" ]
563
2020-03-17T13:57:40.000Z
2022-03-31T02:38:47.000Z
dassl/data/datasets/da/__init__.py
weiliuxm/Dassl.pytorch
8084b66332623c7a2394ea1404f2d043ef415ebb
[ "MIT" ]
37
2020-05-21T02:12:47.000Z
2022-03-30T06:10:47.000Z
dassl/data/datasets/da/__init__.py
weiliuxm/Dassl.pytorch
8084b66332623c7a2394ea1404f2d043ef415ebb
[ "MIT" ]
99
2020-03-17T15:23:15.000Z
2022-03-27T14:52:30.000Z
from .digit5 import Digit5 from .visda17 import VisDA17 from .cifarstl import CIFARSTL from .office31 import Office31 from .domainnet import DomainNet from .office_home import OfficeHome from .mini_domainnet import miniDomainNet
28.625
41
0.847162
30
229
6.4
0.4
0.15625
0
0
0
0
0
0
0
0
0
0.049751
0.122271
229
7
42
32.714286
0.905473
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
0
0
0
null
0
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
4
92ddf83764ce35e49a4399bd0e3f0c56a8029312
131
py
Python
django_web/web_home/apps.py
stone-jin/django_web
f397735afd711e14acd0e659f324022d80164a05
[ "MIT" ]
null
null
null
django_web/web_home/apps.py
stone-jin/django_web
f397735afd711e14acd0e659f324022d80164a05
[ "MIT" ]
null
null
null
django_web/web_home/apps.py
stone-jin/django_web
f397735afd711e14acd0e659f324022d80164a05
[ "MIT" ]
null
null
null
from __future__ import unicode_literals from django.apps import AppConfig class WebHomeConfig(AppConfig): name = 'web_home'
16.375
39
0.793893
16
131
6.125
0.8125
0
0
0
0
0
0
0
0
0
0
0
0.152672
131
7
40
18.714286
0.882883
0
0
0
0
0
0.061069
0
0
0
0
0
0
1
0
false
0
0.5
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
0
0
1
0
1
0
0
4
131fcb0d930875dbaa8cd1fb1df32f097b0ea7d6
231
py
Python
ArticleAlerts/alerts/yaml_loader.py
danielSoler93/ArticleAlerts
88d4729e560239c6f295d0035557f75e2ee9dcc4
[ "MIT" ]
1
2020-05-24T13:51:48.000Z
2020-05-24T13:51:48.000Z
ArticleAlerts/alerts/yaml_loader.py
danielSoler93/ArticleAlerts
88d4729e560239c6f295d0035557f75e2ee9dcc4
[ "MIT" ]
5
2020-05-14T01:18:13.000Z
2020-05-16T02:05:44.000Z
ArticleAlerts/alerts/yaml_loader.py
danielSoler93/ArticleAlerts
88d4729e560239c6f295d0035557f75e2ee9dcc4
[ "MIT" ]
null
null
null
import yaml class YamlLoader(): def __init__(self, input_yaml): self.input_yaml = input_yaml def load(self): with open(self.input_yaml) as file: return yaml.load(file, Loader=yaml.FullLoader)
21
58
0.65368
31
231
4.612903
0.516129
0.251748
0.272727
0
0
0
0
0
0
0
0
0
0.251082
231
11
58
21
0.82659
0
0
0
0
0
0
0
0
0
0
0
0
1
0.285714
false
0
0.142857
0
0.714286
0
0
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
4
1352eaa0a63fc37eb40d775edf193a8ac6658975
84
py
Python
convertfrom/errors.py
diogobaeder/convertfrom
5e4c98800729c05951a3ab8d3c7b2dc6203226c9
[ "BSD-2-Clause" ]
null
null
null
convertfrom/errors.py
diogobaeder/convertfrom
5e4c98800729c05951a3ab8d3c7b2dc6203226c9
[ "BSD-2-Clause" ]
null
null
null
convertfrom/errors.py
diogobaeder/convertfrom
5e4c98800729c05951a3ab8d3c7b2dc6203226c9
[ "BSD-2-Clause" ]
null
null
null
class ConversionError(Exception): """Raised when there's a conversion error."""
28
49
0.72619
10
84
6.1
1
0
0
0
0
0
0
0
0
0
0
0
0.142857
84
2
50
42
0.847222
0.464286
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0
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
0
0
1
0
0
4
1356f33e905456392698588de6d106816dd892da
51
py
Python
models/__init__.py
sinjohr/train-CLIP
6da045049752d094b0b1ae27def135d905b79812
[ "MIT" ]
258
2021-05-18T05:23:42.000Z
2022-03-31T08:42:52.000Z
models/__init__.py
sinjohr/train-CLIP
6da045049752d094b0b1ae27def135d905b79812
[ "MIT" ]
29
2021-05-18T06:53:23.000Z
2022-03-26T02:06:02.000Z
models/__init__.py
sinjohr/train-CLIP
6da045049752d094b0b1ae27def135d905b79812
[ "MIT" ]
27
2021-05-21T20:30:08.000Z
2022-03-30T07:02:43.000Z
from .wrapper import CLIPWrapper, CustomCLIPWrapper
51
51
0.882353
5
51
9
1
0
0
0
0
0
0
0
0
0
0
0
0.078431
51
1
51
51
0.957447
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
4
139f1d19e8250beaee59d2ca25fb9e579b1dcb20
82
py
Python
src/cliquematch/__init__.py
ahgamut/cliquematch
3065b9edfa8ed3dc9986b7152913436ada26d195
[ "MIT" ]
4
2020-07-28T18:41:43.000Z
2021-12-23T10:00:41.000Z
src/cliquematch/__init__.py
ahgamut/cliquematch
3065b9edfa8ed3dc9986b7152913436ada26d195
[ "MIT" ]
null
null
null
src/cliquematch/__init__.py
ahgamut/cliquematch
3065b9edfa8ed3dc9986b7152913436ada26d195
[ "MIT" ]
null
null
null
from cliquematch.core import Graph from .wrappers import * __version__ = "2.2.1"
16.4
34
0.756098
12
82
4.833333
0.75
0
0
0
0
0
0
0
0
0
0
0.042857
0.146341
82
4
35
20.5
0.785714
0
0
0
0
0
0.060976
0
0
0
0
0
0
1
0
false
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
0
0
1
0
1
0
0
4
13a16eaddc046791b7be23e9c0e1cd825950844e
45
py
Python
bird.py
lzbferrari/ljb_python
e545891c707e412bb12601c94b456be721c85573
[ "MIT" ]
null
null
null
bird.py
lzbferrari/ljb_python
e545891c707e412bb12601c94b456be721c85573
[ "MIT" ]
null
null
null
bird.py
lzbferrari/ljb_python
e545891c707e412bb12601c94b456be721c85573
[ "MIT" ]
null
null
null
''' 弹出海龟界面 ''' import turtle t = turtle.Pen()
9
16
0.622222
6
45
4.666667
0.833333
0
0
0
0
0
0
0
0
0
0
0
0.155556
45
5
16
9
0.736842
0.133333
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
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
0
0
0
0
4
13b3528b2458af06549b127a05d5c035a783b6c3
172
py
Python
tests/feature/conftest.py
veliakiner/pytest-bdd
dc82652f82a08df3410d51afc30891f8ec0c5d37
[ "MIT" ]
1
2015-11-21T17:46:49.000Z
2015-11-21T17:46:49.000Z
tests/feature/conftest.py
veliakiner/pytest-bdd
dc82652f82a08df3410d51afc30891f8ec0c5d37
[ "MIT" ]
1
2019-01-12T13:09:35.000Z
2019-01-12T13:09:35.000Z
tests/feature/conftest.py
veliakiner/pytest-bdd
dc82652f82a08df3410d51afc30891f8ec0c5d37
[ "MIT" ]
null
null
null
from pytest_bdd import given, then @given('I have a bar') def bar(): return 'bar' @then('bar should have value "bar"') def bar_is_bar(bar): assert bar == 'bar'
14.333333
36
0.645349
29
172
3.724138
0.551724
0.111111
0.166667
0
0
0
0
0
0
0
0
0
0.209302
172
11
37
15.636364
0.794118
0
0
0
0
0
0.261628
0
0
0
0
0
0.142857
1
0.285714
false
0
0.142857
0.142857
0.571429
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
1
1
0
0
4
13bfe5d4f6f121341cc400b95ac1b5705f2a26ad
134
py
Python
hello.py
isyoo1213/7_27_GIT-GITHUB
497ecf37107b892b549bd4e304a2d88154bb5de0
[ "MIT" ]
null
null
null
hello.py
isyoo1213/7_27_GIT-GITHUB
497ecf37107b892b549bd4e304a2d88154bb5de0
[ "MIT" ]
1
2021-07-27T09:01:01.000Z
2021-07-27T09:01:24.000Z
hello.py
isyoo1213/7_27_GIT-GITHUB
497ecf37107b892b549bd4e304a2d88154bb5de0
[ "MIT" ]
null
null
null
for i in range(1, 10+1): if i%3 == 0: print('hello') elif i%5 == 0: print('world') else: print(i)
16.75
24
0.425373
22
134
2.590909
0.681818
0.210526
0
0
0
0
0
0
0
0
0
0.098765
0.395522
134
7
25
19.142857
0.604938
0
0
0
0
0
0.074627
0
0
0
0
0
0
1
0
false
0
0
0
0
0.428571
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
0
0
0
1
0
4
13c39cdf1e47bd44d75239e947a6f9417bd4be31
46
py
Python
tisb/aws.py
secdevopsai/Threat-Intel-Slack-Bot
e04b5254c67f9475ade38648b4380ca05690e799
[ "MIT" ]
29
2019-06-26T15:00:39.000Z
2022-03-31T15:14:51.000Z
tisb/aws.py
secdevopsai/Threat-Intel-Slack-Bot
e04b5254c67f9475ade38648b4380ca05690e799
[ "MIT" ]
1
2019-07-02T01:58:33.000Z
2019-07-02T01:58:33.000Z
tisb/aws.py
secdevopsai/Threat-Intel-Slack-Bot
e04b5254c67f9475ade38648b4380ca05690e799
[ "MIT" ]
9
2019-06-23T16:28:25.000Z
2021-09-26T01:09:01.000Z
import boto3 LAMBDA = boto3.client("lambda")
11.5
31
0.73913
6
46
5.666667
0.666667
0
0
0
0
0
0
0
0
0
0
0.05
0.130435
46
3
32
15.333333
0.8
0
0
0
0
0
0.130435
0
0
0
0
0
0
1
0
false
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
0
0
1
0
0
0
0
4
13d0f6fb5886478373a11dcca25985652b188c0b
115
py
Python
util.py
dedeibel/humtemp
f50d1a97209895c21affd7390bddab2d03007143
[ "MIT" ]
null
null
null
util.py
dedeibel/humtemp
f50d1a97209895c21affd7390bddab2d03007143
[ "MIT" ]
null
null
null
util.py
dedeibel/humtemp
f50d1a97209895c21affd7390bddab2d03007143
[ "MIT" ]
null
null
null
def pprint(obj): return repr(obj) def to_hex_str(data): return ''.join("{0:x}".format(b) for b in data)
14.375
51
0.617391
21
115
3.285714
0.761905
0
0
0
0
0
0
0
0
0
0
0.01087
0.2
115
7
52
16.428571
0.73913
0
0
0
0
0
0.044248
0
0
0
0
0
0
1
0.5
false
0
0
0.5
1
0.25
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
0
0
0
4
13d164a88eb4498505434a464b6e3789a3180ec9
123
py
Python
xTool/plugins/exceptions.py
fengzhongzhu1621/xTool
5e7f4a9191d8a9a1440d033c28ec3fb59abba5c5
[ "Apache-2.0" ]
2
2020-09-02T13:46:06.000Z
2020-10-11T16:11:02.000Z
xTool/plugins/exceptions.py
fengzhongzhu1621/xTool
5e7f4a9191d8a9a1440d033c28ec3fb59abba5c5
[ "Apache-2.0" ]
null
null
null
xTool/plugins/exceptions.py
fengzhongzhu1621/xTool
5e7f4a9191d8a9a1440d033c28ec3fb59abba5c5
[ "Apache-2.0" ]
4
2018-10-15T07:08:34.000Z
2019-11-26T01:52:47.000Z
# -*- coding: utf-8 -*- class PluginException(Exception): pass class PluginTypeNotFound(PluginException): pass
12.3
42
0.691057
11
123
7.727273
0.727273
0
0
0
0
0
0
0
0
0
0
0.01
0.186992
123
9
43
13.666667
0.84
0.170732
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
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
4
13dad30d90a5fe83f152ab32ac60e3cf6144c9f2
5,606
py
Python
openprocurement/auctions/core/tests/plugins/awarding/v3/tests/blanks/migration_blanks.py
EBRD-ProzorroSale/openprocurement.auctions.core
52bd59f193f25e4997612fca0f87291decf06966
[ "Apache-2.0" ]
2
2016-09-15T20:17:43.000Z
2017-01-08T03:32:43.000Z
openprocurement/auctions/core/tests/plugins/awarding/v3/tests/blanks/migration_blanks.py
EBRD-ProzorroSale/openprocurement.auctions.core
52bd59f193f25e4997612fca0f87291decf06966
[ "Apache-2.0" ]
183
2017-12-21T11:04:37.000Z
2019-03-27T08:14:34.000Z
openprocurement/auctions/core/tests/plugins/awarding/v3/tests/blanks/migration_blanks.py
EBRD-ProzorroSale/openprocurement.auctions.core
52bd59f193f25e4997612fca0f87291decf06966
[ "Apache-2.0" ]
12
2016-09-05T12:07:48.000Z
2019-02-26T09:24:17.000Z
from uuid import uuid4 from copy import deepcopy from isodate import parse_datetime from openprocurement.api.utils import get_now, set_specific_hour from openprocurement.auctions.core.plugins.awarding.v2.tests.award import ( award_fixture ) from openprocurement.auctions.core.plugins.contracting.v3.constants import ( CONTRACT_SIGNING_PERIOD_END_DATE_HOUR ) def migrate_pendingVerification_pending(self): auction = self.db.get(self.auction_id) pending_verification_award = award_fixture(auction, 'pending.verification', 0) pending_waiting_award = award_fixture(auction, 'pending.waiting', 1) auction['awards'] = [pending_waiting_award, pending_verification_award] auction.update(auction) self.db.save(auction) self.migrate_data(self.app.app.registry) response = self.app.get('/auctions/{}'.format(self.auction_id)) auction = response.json['data'] self.assertEqual(auction['status'], u'active.qualification') self.assertEqual(auction['awards'][1]['status'], u'pending') self.assertEqual(auction['awards'][0]['status'], u'pending.waiting') def migrate_pendingPayment_active(self): auction = self.db.get(self.auction_id) pending_payment_award = award_fixture(auction, 'pending.payment', 0) pending_waiting_award = award_fixture(auction, 'pending.waiting', 1) auction['awards'] = [pending_waiting_award, pending_payment_award] auction.update(auction) self.db.save(auction) self.migrate_data(self.app.app.registry) response = self.app.get('/auctions/{}'.format(self.auction_id)) auction = response.json['data'] self.assertEqual(auction['status'], u'active.awarded') self.assertEqual(auction['awards'][1]['status'], u'active') self.assertEqual(auction['awards'][0]['status'], u'pending.waiting') response = self.app.get('/auctions/{}/contracts'.format(self.auction_id)) contracts = response.json['data'] self.assertEqual(len(contracts), 1) self.assertEqual(contracts[0]['status'], 'pending') signing_period_end_date = set_specific_hour( parse_datetime(pending_payment_award['signingPeriod']['endDate']), CONTRACT_SIGNING_PERIOD_END_DATE_HOUR ) pending_payment_award['signingPeriod']['endDate'] = signing_period_end_date.isoformat() self.assertEqual(contracts[0]['signingPeriod'], pending_payment_award['signingPeriod']) def migrate_contract_cancelled(self): auction = self.db.get(self.auction_id) now = get_now() pending_verification_award = award_fixture(auction, 'pending.verification', 0) unsuccessful_award = award_fixture(auction, 'unsuccessful', 1) auction['awards'] = [unsuccessful_award, pending_verification_award] auction['contracts'] = [{ 'awardID': unsuccessful_award['id'], 'suppliers': unsuccessful_award['suppliers'], 'value': unsuccessful_award['value'], 'date': now.isoformat(), 'items': auction['items'], 'contractID': '{}-11'.format(auction['auctionID']), 'status': 'cancelled' }] auction.update(auction) self.db.save(auction) self.migrate_data(self.app.app.registry) response = self.app.get('/auctions/{}'.format(self.auction_id)) auction = response.json['data'] self.assertEqual(auction['status'], u'active.qualification') self.assertEqual(auction['awards'][1]['status'], u'pending') response = self.app.get('/auctions/{}/contracts'.format(self.auction_id)) contracts = response.json['data'] self.assertEqual(len(contracts), 1) self.assertEqual(contracts[0]['status'], 'cancelled') signing_period_end_date = set_specific_hour( parse_datetime(unsuccessful_award['signingPeriod']['endDate']), CONTRACT_SIGNING_PERIOD_END_DATE_HOUR ) unsuccessful_award['signingPeriod']['endDate'] = signing_period_end_date.isoformat() self.assertEqual(contracts[0]['signingPeriod'], unsuccessful_award['signingPeriod']) def migrate_contract_pending(self): self.set_status('active.awarded') auction = self.db.get(self.auction_id) now = get_now() active_award = award_fixture(auction, 'active', 0) pending_waiting_award = award_fixture(auction, 'pending.waiting', 1) auction['awards'] = [active_award, pending_waiting_award] auction['contracts'] = [{ 'awardID': active_award['id'], 'suppliers': active_award['suppliers'], 'value': active_award['value'], 'date': now.isoformat(), 'items': auction['items'], 'contractID': '{}-11'.format(auction['auctionID']), 'status': 'pending', 'signingPeriod': active_award['signingPeriod'], }] auction.update(auction) self.db.save(auction) self.migrate_data(self.app.app.registry) response = self.app.get('/auctions/{}'.format(self.auction_id)) auction = response.json['data'] self.assertEqual(auction['status'], u'active.awarded') self.assertEqual(auction['awards'][0]['status'], u'active') self.assertEqual(auction['awards'][1]['status'], u'pending.waiting') response = self.app.get('/auctions/{}/contracts'.format(self.auction_id)) contracts = response.json['data'] self.assertEqual(len(contracts), 1) self.assertEqual(contracts[0]['status'], 'pending') signing_period_end_date = set_specific_hour( parse_datetime(active_award['signingPeriod']['endDate']), CONTRACT_SIGNING_PERIOD_END_DATE_HOUR ) active_award['signingPeriod']['endDate'] = signing_period_end_date.isoformat() self.assertEqual(contracts[0]['signingPeriod'], active_award['signingPeriod'])
38.930556
91
0.708705
646
5,606
5.944272
0.117647
0.078125
0.03724
0.052083
0.798177
0.731771
0.723438
0.716146
0.707552
0.578385
0
0.006436
0.140742
5,606
143
92
39.202797
0.790741
0
0
0.59292
0
0
0.179451
0.011773
0
0
0
0
0.176991
1
0.035398
false
0
0.053097
0
0.088496
0
0
0
0
null
0
0
0
0
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
13e18470005abc6a6b7d6e1588990c4a15c8e964
133
py
Python
website/views/sample/main.py
rignova/manadu
62c62fb3629b1ba2c7fe51a41962d27da498a1a0
[ "MIT" ]
5
2019-10-19T02:05:25.000Z
2021-11-11T10:20:36.000Z
website/views/sample/main.py
rajkumartreads/manadu
62c62fb3629b1ba2c7fe51a41962d27da498a1a0
[ "MIT" ]
11
2019-12-05T16:20:38.000Z
2022-03-11T23:57:56.000Z
website/views/sample/main.py
rajkumartreads/manadu
62c62fb3629b1ba2c7fe51a41962d27da498a1a0
[ "MIT" ]
6
2019-10-15T09:52:39.000Z
2020-02-17T17:48:56.000Z
from django.shortcuts import render def web_home(request): template = 'sample/index.html' return render(request, template)
19
36
0.744361
17
133
5.764706
0.823529
0.306122
0
0
0
0
0
0
0
0
0
0
0.165414
133
6
37
22.166667
0.882883
0
0
0
0
0
0.12782
0
0
0
0
0
0
1
0.25
false
0
0.25
0
0.75
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
0
0
0
4
13e6f8dcf9ff8e60ca90eee788520c89dc660dc4
153
py
Python
test_module/test.py
VilhelmC/foc-intro-to-git
30fabe89f2102626ea5b4d05871f855194b1915f
[ "MIT" ]
null
null
null
test_module/test.py
VilhelmC/foc-intro-to-git
30fabe89f2102626ea5b4d05871f855194b1915f
[ "MIT" ]
null
null
null
test_module/test.py
VilhelmC/foc-intro-to-git
30fabe89f2102626ea5b4d05871f855194b1915f
[ "MIT" ]
null
null
null
class gr(): def __init__(self): age = 28 def stop(self): return 1+1 if __name__ == "__main__": print("hello") pass
13.909091
26
0.509804
19
153
3.473684
0.842105
0
0
0
0
0
0
0
0
0
0
0.040816
0.359477
153
11
27
13.909091
0.632653
0
0
0
0
0
0.084416
0
0
0
0
0
0
1
0.25
false
0.125
0
0.125
0.5
0.125
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
1
0
0
0
4
13eb17684365adc62ce8021f879fb44780848ebc
51
py
Python
tests/__init__.py
Ligh7bringer/Chatbot
80294efeb165e6d1b41af0ee7a4a5bef85e3c0ec
[ "MIT" ]
3
2020-01-03T06:07:18.000Z
2020-08-31T13:25:10.000Z
tests/__init__.py
Ligh7bringer/Chatbot
80294efeb165e6d1b41af0ee7a4a5bef85e3c0ec
[ "MIT" ]
7
2019-02-13T19:05:54.000Z
2021-04-05T09:33:09.000Z
tests/__init__.py
Ligh7bringer/Chatbot
80294efeb165e6d1b41af0ee7a4a5bef85e3c0ec
[ "MIT" ]
null
null
null
# pytest requires that the test folder is a module
25.5
50
0.784314
9
51
4.444444
1
0
0
0
0
0
0
0
0
0
0
0
0.196078
51
1
51
51
0.97561
0.941176
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
13ee583081904cc323cfb3fdd01b2a2f66203c47
2,851
py
Python
hadmin/conf_test.py
trozamon/hadmin
971bf7f7d4835c7440b8fca945e44e0f8e3e0a8a
[ "MIT" ]
2
2021-11-26T13:23:41.000Z
2021-11-30T09:40:12.000Z
hadmin/conf_test.py
trozamon/hadmin
971bf7f7d4835c7440b8fca945e44e0f8e3e0a8a
[ "MIT" ]
11
2016-06-17T19:51:03.000Z
2016-07-28T01:35:41.000Z
hadmin/conf_test.py
trozamon/hadmin
971bf7f7d4835c7440b8fca945e44e0f8e3e0a8a
[ "MIT" ]
null
null
null
from hadmin.conf import QueueGenerator from unittest2 import TestCase class QueueGeneratorTest(TestCase): def setUp(self): self.root = QueueGenerator.load_dir('data/queues').generate() self.prod = self.root.subqueue('prod') self.dev = self.root.subqueue('dev') self.dev1 = self.dev.subqueue('product1') self.dev2 = self.dev.subqueue('product2') def testRootCapacity(self): self.assertEqual(100.0, self.root.cap_min) def testRootUserLimitFactor(self): self.assertEqual(1.0, self.root.user_limit_factor) def testRootUsers(self): self.assertEqual(['*'], self.root.users) def testRootAdmins(self): self.assertEqual(['*'], self.root.admins) def testProdAdmins(self): self.assertEqual(['alec'], self.prod.admins) def testProdCapacity(self): self.assertEqual(90.0, self.prod.cap_min) def testProdUsers(self): self.assertEqual(['alec', 'trozamon'], self.prod.users) def testProdUserLimitFactor(self): self.assertAlmostEqual(50.0 / 90.0, self.prod.user_limit_factor) def testProdRunning(self): self.assertEqual(True, self.prod.running) def testProdMaxCapacity(self): self.assertEqual(100.0, self.prod.cap_max) def testDevCapacity(self): self.assertEqual(10.0, self.dev.cap_min) def testDevMaxCapacity(self): self.assertEqual(100.0, self.dev.cap_max) def testDevAdmins(self): self.assertEqual(['alec', 'trozamon'], self.dev.admins) def testDevUsers(self): self.assertEqual(['alec', 'trozamon'], self.dev.users) def testDevUserLimitFactor(self): self.assertEqual(10.0, self.dev.user_limit_factor) def testDevRunning(self): self.assertEqual(True, self.dev.running) def testDev1Capacity(self): self.assertEqual(50.0, self.dev1.cap_min) def testDev1MaxCapacity(self): self.assertEqual(100.0, self.dev1.cap_max) def testDev1Admins(self): self.assertEqual(['alec'], self.dev1.admins) def testDev1Users(self): self.assertEqual(['alec'], self.dev1.users) def testDev1UserLimitFactor(self): self.assertEqual(1.0, self.dev1.user_limit_factor) def testDev1Running(self): self.assertEqual(False, self.dev1.running) def testDev2Capacity(self): self.assertEqual(50.0, self.dev2.cap_min) def testDev2MaxCapacity(self): self.assertEqual(100.0, self.dev2.cap_max) def testDev2Admins(self): self.assertEqual(['trozamon'], self.dev2.admins) def testDev2Users(self): self.assertEqual(['trozamon'], self.dev2.users) def testDev2UserLimitFactor(self): self.assertEqual(1.0, self.dev2.user_limit_factor) def testDev2Running(self): self.assertEqual(True, self.dev2.running)
29.391753
72
0.675903
335
2,851
5.692537
0.220896
0.121657
0.269009
0.072365
0.380178
0.295228
0.070267
0
0
0
0
0.033101
0.194669
2,851
96
73
29.697917
0.797474
0
0
0
1
0
0.035075
0
0
0
0
0
0.430769
1
0.446154
false
0
0.030769
0
0.492308
0
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
1
0
1
0
0
0
0
0
0
0
4