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
338a66e1769808d73fc21fa2d8bbca45f77e733d
700
py
Python
cracking_the_coding_interview_qs/3.6/animal_shelter_test.py
angelusualle/algorithms
86286a49db2a755bc57330cb455bcbd8241ea6be
[ "Apache-2.0" ]
null
null
null
cracking_the_coding_interview_qs/3.6/animal_shelter_test.py
angelusualle/algorithms
86286a49db2a755bc57330cb455bcbd8241ea6be
[ "Apache-2.0" ]
null
null
null
cracking_the_coding_interview_qs/3.6/animal_shelter_test.py
angelusualle/algorithms
86286a49db2a755bc57330cb455bcbd8241ea6be
[ "Apache-2.0" ]
null
null
null
from animal_shelter import Animal, Animal_Shelter import unittest class Test_Case_Animal_Shelter(unittest.TestCase): def test_animal_shelter(self): shelter = Animal_Shelter() shelter.enqueue(Animal('felix', 'cat')) shelter.enqueue(Animal('woof', 'dog')) self.assertEqual(shelter.deque_any().name, 'felix') shelter.enqueue(Animal('woof2', 'dog')) self.assertEqual(shelter.deque_any().name, 'woof') shelter.enqueue(Animal('felix', 'cat')) shelter.enqueue(Animal('woof', 'dog')) shelter.enqueue(Animal('felix', 'cat')) shelter.enqueue(Animal('woof', 'dog')) self.assertEqual(shelter.deque_any().name, 'woof2')
41.176471
59
0.66
80
700
5.6375
0.2625
0.217295
0.310421
0.166297
0.59867
0.59867
0.59867
0.51663
0.51663
0.51663
0
0.00349
0.181429
700
16
60
43.75
0.783595
0
0
0.4
0
0
0.095714
0
0
0
0
0
0.2
1
0.066667
false
0
0.133333
0
0.266667
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
338d4515ff2230145cdfd5442de2992c6d5aabdf
608
py
Python
web/cohapp/migrations/0015_auto_20171130_1315.py
Simon-Will/cohviz
b5d0097cbd5f3586dcd03e05d9b17c3e46cc356f
[ "MIT" ]
null
null
null
web/cohapp/migrations/0015_auto_20171130_1315.py
Simon-Will/cohviz
b5d0097cbd5f3586dcd03e05d9b17c3e46cc356f
[ "MIT" ]
null
null
null
web/cohapp/migrations/0015_auto_20171130_1315.py
Simon-Will/cohviz
b5d0097cbd5f3586dcd03e05d9b17c3e46cc356f
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- # Generated by Django 1.11.4 on 2017-11-30 12:15 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('cohapp', '0014_auto_20171124_1717'), ] operations = [ migrations.RemoveField( model_name='textdata', name='cld_draft_question3', ), migrations.RemoveField( model_name='textdata', name='cld_middle_question3', ), migrations.RemoveField( model_name='textdata', name='cld_revision_question3', ), ]
21.714286
48
0.570724
58
608
5.775862
0.62069
0.18806
0.232836
0.268657
0.456716
0.456716
0.456716
0.322388
0
0
0
0.086331
0.314145
608
27
49
22.518519
0.717026
0.111842
0
0.473684
1
0
0.212291
0.083799
0
0
0
0
0
1
0
false
0
0.052632
0
0.210526
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
338d81474aa50ec4e9baa6b717ac07fe6dbe1542
224
py
Python
Task1C.py
ahip2/Flood-Sytem-135
23b85b51342a2f935914df843fee9ad61df3a68d
[ "MIT" ]
2
2022-02-07T11:28:34.000Z
2022-02-17T18:40:38.000Z
Task1C.py
ahip2/Flood-Sytem-135
23b85b51342a2f935914df843fee9ad61df3a68d
[ "MIT" ]
null
null
null
Task1C.py
ahip2/Flood-Sytem-135
23b85b51342a2f935914df843fee9ad61df3a68d
[ "MIT" ]
1
2022-02-07T11:28:35.000Z
2022-02-07T11:28:35.000Z
from floodsystem.geo import stations_within_radius from floodsystem.stationdata import build_station_list stations = build_station_list() Cam_centre= stations_within_radius(stations,(52.2053,0.1218),10) print(Cam_centre)
24.888889
64
0.848214
32
224
5.625
0.59375
0.166667
0.222222
0
0
0
0
0
0
0
0
0.062802
0.075893
224
8
65
28
0.806763
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.4
0
0.4
0.2
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
0
0
1
0
0
0
0
3
33a3cfa0490b38624f37cee4d96faaf5c85d8203
2,626
py
Python
tests/readoperation_in_exception_test.py
RahmanAnsari/xkye_python
3ddfdf946d6297b509b0b7490a765534d2c3ce01
[ "MIT" ]
null
null
null
tests/readoperation_in_exception_test.py
RahmanAnsari/xkye_python
3ddfdf946d6297b509b0b7490a765534d2c3ce01
[ "MIT" ]
6
2021-06-03T18:44:33.000Z
2021-06-15T18:03:52.000Z
tests/readoperation_in_exception_test.py
RahmanAnsari/xkye_python
3ddfdf946d6297b509b0b7490a765534d2c3ce01
[ "MIT" ]
null
null
null
""" Test to check the read-in operation exception """ import os import pytest from xkye import IO as io # To test if the span for the clutch is already declared def test_read_file_in_exception_1(): """ test_read_file_in_exception_1 """ xky_file = "in/read_in_exception_1.xky" dir_path = os.path.dirname(os.path.realpath(__file__)) xky_file = dir_path + "/" + xky_file with pytest.raises(Exception): xkye = io(xky_file) dictionary = xkye.read() assert dictionary is None # To test if the key is already declared for the clutch def test_read_file_in_exception_2(): """ test_read_file_in_exception_2 """ xky_file = "in/read_in_exception_2.xky" dir_path = os.path.dirname(os.path.realpath(__file__)) xky_file = dir_path + "/" + xky_file with pytest.raises(Exception): xkye = io(xky_file) dictionary = xkye.read() assert dictionary is None # To test if clutchset span is greater than the declared span limit def test_read_file_in_exception_3(): """ test_read_file_in_exception_3 """ xky_file = "in/read_in_exception_3.xky" dir_path = os.path.dirname(os.path.realpath(__file__)) xky_file = dir_path + "/" + xky_file with pytest.raises(Exception): xkye = io(xky_file) dictionary = xkye.read() assert dictionary is None # To test if clutchset is not declared with the span limit def test_read_file_in_exception_4(): """ test_read_file_in_exception_4 """ xky_file = "in/read_in_exception_4.xky" dir_path = os.path.dirname(os.path.realpath(__file__)) xky_file = dir_path + "/" + xky_file with pytest.raises(Exception): xkye = io(xky_file) dictionary = xkye.read() assert dictionary is None # To test if subclutch is not defined before this call def test_read_file_in_exception_5(): """ test_read_file_in_exception_5 """ xky_file = "in/read_in_exception_5.xky" dir_path = os.path.dirname(os.path.realpath(__file__)) xky_file = dir_path + "/" + xky_file with pytest.raises(Exception): xkye = io(xky_file) dictionary = xkye.read() assert dictionary is None # To test if the defined subclutch span is exceeding declared span limit def test_read_file_in_exception_6(): """ test_read_file_in_exception_6 """ xky_file = "in/read_in_exception_6.xky" dir_path = os.path.dirname(os.path.realpath(__file__)) xky_file = dir_path + "/" + xky_file with pytest.raises(Exception): xkye = io(xky_file) dictionary = xkye.read() assert dictionary is None
26.26
72
0.685834
391
2,626
4.253197
0.132992
0.101022
0.086591
0.101022
0.840048
0.840048
0.616356
0.616356
0.59531
0.543596
0
0.008763
0.217822
2,626
99
73
26.525253
0.800876
0.225057
0
0.705882
0
0
0.081571
0.07855
0
0
0
0
0.117647
1
0.117647
false
0
0.058824
0
0.176471
0
0
0
0
null
0
0
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
33a5e59c3ac45b84f7cb89d5805258488e7c6e35
277
py
Python
home/urls.py
zhangpotato/kx_backmanage
5a484c19616a77a75698f63b8fa220ee027c0c17
[ "Apache-2.0" ]
null
null
null
home/urls.py
zhangpotato/kx_backmanage
5a484c19616a77a75698f63b8fa220ee027c0c17
[ "Apache-2.0" ]
null
null
null
home/urls.py
zhangpotato/kx_backmanage
5a484c19616a77a75698f63b8fa220ee027c0c17
[ "Apache-2.0" ]
null
null
null
from django.urls import path,include from django.conf.urls import url from . import views from cars import views as cars_views urlpatterns = [ # path('', views.index, name='index'), url(r'^', views.index, name='index'), url(r'^index', views.index, name='index'), ]
27.7
46
0.68231
41
277
4.585366
0.365854
0.159574
0.223404
0.303191
0.244681
0.244681
0
0
0
0
0
0
0.158845
277
10
47
27.7
0.806867
0.129964
0
0
0
0
0.070833
0
0
0
0
0
0
1
0
false
0
0.5
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
0
0
1
0
0
0
0
3
33a7eba73403328d6ab6d4045fc2f989518a6efb
25
py
Python
admin_tools/menu/migrations/__init__.py
asherf/django-admin-tools
26a993545de7d68286be56ac640fe12acf1a1abe
[ "MIT" ]
711
2015-06-21T10:08:06.000Z
2022-03-25T08:46:37.000Z
django_admin_row_actions/tests/__init__.py
adamchainz/django-admin-row-actions
9d6c1720aee11c6699ed320a8bae6d75121393f7
[ "MIT" ]
102
2015-06-22T12:38:21.000Z
2022-03-29T14:00:54.000Z
django_admin_row_actions/tests/__init__.py
adamchainz/django-admin-row-actions
9d6c1720aee11c6699ed320a8bae6d75121393f7
[ "MIT" ]
149
2015-06-21T10:16:49.000Z
2022-03-28T13:11:47.000Z
__author__ = 'andybaker'
12.5
24
0.76
2
25
7.5
1
0
0
0
0
0
0
0
0
0
0
0
0.12
25
1
25
25
0.681818
0
0
0
0
0
0.36
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
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
33b2510695ea09518e6b13c9e77583d6160c669f
10,118
py
Python
myapp/models.py
menghao2015/MyBlog
8cc7b74295bfbdfc0f825665c915bf36bbf772fe
[ "MIT" ]
null
null
null
myapp/models.py
menghao2015/MyBlog
8cc7b74295bfbdfc0f825665c915bf36bbf772fe
[ "MIT" ]
null
null
null
myapp/models.py
menghao2015/MyBlog
8cc7b74295bfbdfc0f825665c915bf36bbf772fe
[ "MIT" ]
null
null
null
from flask.ext.login import UserMixin, AnonymousUserMixin from werkzeug.security import generate_password_hash, check_password_hash from . import db, login_manager from itsdangerous import TimedJSONWebSignatureSerializer as Serializer from flask import current_app, request import hashlib from datetime import datetime from markdown import markdown import bleach class Follow(db.Model): __tablename__ = 'follows' follower_id = db.Column(db.Integer, db.ForeignKey('users.id'), primary_key = True) followed_id = db.Column(db.Integer, db.ForeignKey('users.id'), primary_key = True) timestamp = db.Column(db.DateTime, default=datetime.utcnow) class Permission: FOLLOW = 0x01 COMMENT = 0x02 WRITE_ARTICLES = 0x04 MODERATE_COMMENTS = 0x08 ADMINISTER = 0x80 class Post(db.Model): __tablename__ = 'posts' id = db.Column(db.Integer, primary_key=True) body = db.Column(db.Text) body_html = db.Column(db.Text) timestamp = db.Column(db.DateTime, index=True, default=datetime.utcnow) author_id = db.Column(db.Integer, db.ForeignKey('users.id')) comments = db.relationship('Comment', backref='post', lazy='dynamic') @staticmethod def generate_fake(count=100): from random import seed, randint import forgery_py seed() user_count = User.query.count() for i in range(count): u = User.query.offset(randint(0, user_count -1)).first() p = Post(body=forgery_py.lorem_ipsum.sentences(randint(1, 3)), timestamp=forgery_py.date.date(True), author=u) db.session.add(p) db.session.commit() @staticmethod def on_changed_body(target, value, oldvalue, initiator): allowed_tags = ['a', 'abbr', 'acronym', 'b','blockquote', 'code', 'em', 'i', 'li', 'ol', 'pre', 'strong', 'ul', 'h1', 'h2', 'h3', 'p'] target.body_html = bleach.linkify(bleach.clean(markdown( value, output_format='html'),tags=allowed_tags, strip=True)) db.event.listen(Post.body, 'set', Post.on_changed_body) class Comment(db.Model): __tablename__ = 'comments' id = db.Column(db.Integer, primary_key=True) body = db.Column(db.Text) body_html = db.Column(db.Text) timestamp = db.Column(db.DateTime, index=True, default=datetime.utcnow) disabled = db.Column(db.Boolean) author_id = db.Column(db.Integer, db.ForeignKey('users.id')) posts_id = db.Column(db.Integer, db.ForeignKey('posts.id')) @staticmethod def on_changed_body(target, value, oldvalue, initiator): allowed_tags = ['a', 'abbr', 'acronym', 'b', 'code', 'em', 'i', 'strong'] target.body_html = bleach.linkify(bleach.clean(markdown( value, output_format='html'), tags=allowed_tags, strip=True)) db.event.listen(Comment.body, 'set', Comment.on_changed_body) class Role(db.Model): __tablename__='roles' id=db.Column(db.Integer,primary_key=True) name=db.Column(db.String(64),unique=True) default=db.Column(db.Boolean,default=False,index=True) permission=db.Column(db.Integer) users=db.relationship('User',backref='role',lazy='dynamic') @staticmethod def insert_roles(): roles = { 'User':(Permission.FOLLOW | Permission.COMMENT | Permission.WRITE_ARTICLES, True), 'Moderator':( Permission.FOLLOW | Permission.COMMENT | Permission.WRITE_ARTICLES |Permission.MODERATE_COMMENTS, False), 'Administrator':( 0xff, False) } for r in roles: role = Role.query.filter_by(name=r).first() if role is None: role = Role(name=r) role.permission = roles[r][0] role.default = roles[r][1] db.session.add(role) db.session.commit() def __repr__(self): return '<Role %r>' % self.name class User(UserMixin, db.Model): __tablename__ = 'users' id = db.Column(db.Integer, primary_key=True) email = db.Column(db.String(64), unique=True, index=True) username = db.Column(db.String(64), unique=True, index=True) role_id = db.Column(db.Integer, db.ForeignKey('roles.id')) password_hash = db.Column(db.String(128)) confirmed = db.Column(db.Boolean, default=False) name = db.Column(db.String(64)) location = db.Column(db.String(64)) about_me = db.Column(db.Text()) member_since = db.Column(db.DateTime(), default=datetime.utcnow) last_seen = db.Column(db.DateTime(), default=datetime.utcnow) avatar_hash = db.Column(db.String(64)) posts = db.relationship('Post', backref='author', lazy='dynamic') followed = db.relationship('Follow', foreign_keys=[Follow.follower_id], backref=db.backref('follower', lazy='joined'), lazy='dynamic', cascade='all, delete-orphan') followers = db.relationship('Follow', foreign_keys=[Follow.followed_id], backref=db.backref('followed', lazy='joined'), lazy='dynamic', cascade='all, delete-orphan') comments = db.relationship('Comment', backref='author', lazy='dynamic') def __init__(self, **kwargs): super(User, self).__init__(**kwargs) if self.role is None: if self.email == current_app.config['FLASKY_ADMIN']: self.role = Role.query.filter_by(permission=0xff).first() if self.role is None: self.role = Role.query.filter_by(default=True).first() if self.email is not None and self.avatar_hash is None: self.avatar_hash = hashlib.md5(self.email.encode('utf-8')).hexdigest() self.follow(self) def follow(self, user): if not self.is_following(user): f = Follow(follower=self, followed=user) db.session.add(f) db.session.commit() def unfollow(self, user): f = self.followed.filter_by(followed_id = user.id).first() if f: db.session.delete(f) def is_following(self, user): return self.followed.filter_by(followed_id = user.id).first() is not None def is_followed_by(self, user): return self.followes.filter_by(followes_id = user.id).first() is not None @staticmethod def add_self_follow(): for user in User.query.all(): if not user.is_following(user): user.follow(user) db.session.add(user) db.session.commit() @staticmethod def generate_fake(count=100): from sqlalchemy.exc import IntegrityError from random import seed import forgery_py seed() for i in range(count): u = User(email=forgery_py.internet.email_address(), username=forgery_py.internet.user_name(True), password=forgery_py.lorem_ipsum.word(), confirmed=True, name=forgery_py.name.full_name(), location=forgery_py.address.city(), about_me=forgery_py.lorem_ipsum.sentence(), member_since=forgery_py.date.date(True)) db.session.add(u) try: db.session.commit() except IntegrityError: db.session.rollback() @property def followed_posts(self): return Post.query.join(Follow, Follow.followed_id == Post.author_id).filter(Follow.follower_id == self.id) @property def password(self): raise AttributeError('password is not readable') @password.setter def password(self, password): self.password_hash = generate_password_hash(password) def verify_password(self, password): return check_password_hash(self.password_hash, password) def change_password(self, new_password): self.password_hash = generate_password_hash(new_password) def generate_confirmation_token(self, expiration=3600): s = Serializer(current_app.config['SECRET_KEY'], expiration) return s.dumps({'confirm':self.id }) def confirmation_token(self, token): s = Serializer(current_app.config['SECRET_KEY']) try: data = s.loads(token) except: return False if data.get('confirm') != self.id: return False self.confirmed = True db.session.add(self) db.session.commit() return True def generate_reset_passwd_token(self, expiration=3600): s = Serializer(current_app.config['SECRET_KEY'], expiration) return s.dumps({ 'reset':self.id }) def reset_passwd(self, token, new_passwd): s = Serializer(current_app.config['SECRET_KEY']) try: data = s.loads(token) except: return False if data.get('reset') != self.id: return False self.password_hash = generate_password_hash(new_passwd) db.session.add(self) db.session.commit() return True def generate_change_email_token(self, new_email, expiration=3600): s = Serializer(current_app.config['SECRET_KEY'], expiration) return s.dumps({ 'change_email':self.id , 'new_email':new_email }) def change_email(self, token): s = Serializer(current_app.config['SECRET_KEY']) try: data = s.loads(token) except: return False if data.get('change_email') != self.id: return False new_email = data.get('new_email') if new_email is None: return False self.email = new_email self.avatar_hash = hashlib.md5(self.email.encode('utf-8')).hexdigest() db.session.add(self) db.session.commit() return True def can(self, permission): return self.role is not None and (self.role.permission & permission) == permission def is_administrator(self): return self.can(0xff) def ping(self): self.last_seen = datetime.utcnow() db.session.add(self) db.session.commit() def gravatar(self, size=100, default='identicon', rating='g'): if request.is_secure: url = 'https://secure.gravatar.com/avatar' else: url = 'http://cn.gravatar.com/avatar' hash = hashlib.md5(self.email.encode('utf-8')).hexdigest() return '{url}/{hash}?s={size}&d={default}&r={rating}'.format( url=url, hash=hash, size=size, default=default, rating=rating) def __repr__(self): return '<User %r>' % self.username class AnonymousUser(AnonymousUserMixin): def can(self, permission): return False def is_administrator(self): return False login_manager.anonymous_user = AnonymousUser @login_manager.user_loader def load_user(user_id): return User.query.get(int(user_id)) #1,##### Test ########## registrations = db.Table('registrations', db.Column('student_id', db.Integer, db.ForeignKey('students.id')), db.Column('class_id', db.Integer, db.ForeignKey('classes.id')) ) class Student(db.Model): __tablename__ = 'students' id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(64)) classes = db.relationship('Class', secondary=registrations, backref=db.backref('students', lazy='dynamic'), lazy='dynamic') class Class(db.Model): __tablename__ = 'classes' id = db.Column(db.Integer, primary_key = True) name = db.Column(db.String(64)) #1,###### Test #########
31.132308
108
0.717731
1,433
10,118
4.92254
0.173064
0.041962
0.049617
0.03133
0.477176
0.408137
0.3778
0.290899
0.274029
0.251914
0
0.008563
0.134315
10,118
324
109
31.228395
0.79678
0.00168
0
0.34981
1
0
0.075693
0.004371
0
0
0.003179
0
0
1
0.117871
false
0.057034
0.053232
0.041825
0.505703
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
0
1
0
0
1
0
0
3
33bf3562244a9491f3192d12e86ba5e7ce73a306
363
py
Python
src/TwoToOne2.py
Helianus/Python-Exercises
eb0a7f3010bd55b3eb619980153888ba336245c6
[ "MIT" ]
null
null
null
src/TwoToOne2.py
Helianus/Python-Exercises
eb0a7f3010bd55b3eb619980153888ba336245c6
[ "MIT" ]
null
null
null
src/TwoToOne2.py
Helianus/Python-Exercises
eb0a7f3010bd55b3eb619980153888ba336245c6
[ "MIT" ]
null
null
null
s1 = "xyaabbbccccdefwwsadfhlgfdfhgskdghkdfzhgzjhgkdzhgfkxhgfkzhgkjfdhgizfghkzhgkzdhfgkz" s2 = "xxxxyyyyabklmopqdfaiusfghskjghsjkdgbsdkgjbsdgbskdkfbnsdkhsgb" # take 2 strings s1 and s2 including only letters from ato z. # Return a new sorted string, the longest possible, containing distinct letters def longest(s1, s2): s = sorted(set(s1 + s2)) return s
45.375
88
0.804408
38
363
7.684211
0.710526
0.027397
0
0
0
0
0
0
0
0
0
0.028754
0.137741
363
8
89
45.375
0.904153
0.380165
0
0
0
0
0.632287
0.632287
0
0
0
0
0
1
0.2
false
0
0
0
0.4
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
1
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
33c0a27e97a5b434a641ab7594613d260368c1c9
337
py
Python
server/ltiplatform/ltiutil.py
Brightspace/ltibootcamp
f7777b290ec7189f1550ccfd597aa7ba9c060b46
[ "Apache-2.0" ]
1
2020-11-25T13:56:23.000Z
2020-11-25T13:56:23.000Z
server/ltiplatform/ltiutil.py
Brightspace/ltibootcamp
f7777b290ec7189f1550ccfd597aa7ba9c060b46
[ "Apache-2.0" ]
2
2021-02-02T22:52:49.000Z
2021-06-02T02:23:36.000Z
server/ltiplatform/ltiutil.py
Brightspace/ltibootcamp
f7777b290ec7189f1550ccfd597aa7ba9c060b46
[ "Apache-2.0" ]
1
2019-02-04T16:03:33.000Z
2019-02-04T16:03:33.000Z
def fc(claim, s=None): suffix = ('-'+s) if s else '' return 'https://purl.imsglobal.org/spec/lti{0}/claim/{1}'.format(suffix, claim) def fdlc(claim): return fc(claim, s='dl') def scope(scope, s=None): suffix = ('-'+s) if s else '' return 'https://purl.imsglobal.org/spec/lti{0}/scope/{1}'.format(suffix, scope)
30.636364
83
0.608309
54
337
3.796296
0.388889
0.068293
0.078049
0.117073
0.526829
0.526829
0.526829
0.526829
0.526829
0.526829
0
0.014286
0.169139
337
11
84
30.636364
0.717857
0
0
0.25
0
0
0.295858
0
0
0
0
0
0
1
0.375
false
0
0
0.125
0.75
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
0
0
0
1
1
0
0
3
33dfd999154a9df5688824b8d77264277132252b
818
py
Python
tag 3 aufgabe campy.py
lacharogerio10/lacharogerio10.github.io
325dcb6f64e3a80764e85849ac2f40cc72f06f2b
[ "CC0-1.0" ]
null
null
null
tag 3 aufgabe campy.py
lacharogerio10/lacharogerio10.github.io
325dcb6f64e3a80764e85849ac2f40cc72f06f2b
[ "CC0-1.0" ]
null
null
null
tag 3 aufgabe campy.py
lacharogerio10/lacharogerio10.github.io
325dcb6f64e3a80764e85849ac2f40cc72f06f2b
[ "CC0-1.0" ]
null
null
null
print ("Bitte gebe deine gesamte Lernzeit ein") input("") print ("Lernzeitphase") input("") print("Pause") input ("") print("Los gehts!!!") import time time.sleep(2) x=print("Ok!!!Zeit für eine Pause!!!") import time time.sleep(1) print("Die Pause ist vorbei!!Zurück an die Arbeit") import time time.sleep(2) print("Ok!!!Zeit für eine Pause!!!") import time time.sleep(1) print("Die Pause ist vorbei!!Zurück an die Arbeit") import time time.sleep(2) print("Ok!!!Zeit für eine Pause!!!") import time time.sleep(1) print("Die Pause ist vorbei!!Zurück an die Arbeit") import time time.sleep(2) print("Puuuh!!! Du hast es geschafft!!!") while True: pausen=0 x= print("Ok!!!Zeit für eine Pause!!!") if x: print("Du hast "+str(pausen)+"gemacht") pausen+=1
19.47619
52
0.640587
125
818
4.192
0.32
0.133588
0.187023
0.253817
0.679389
0.641221
0.641221
0.593511
0.593511
0.593511
0
0.013616
0.191932
818
41
53
19.95122
0.779123
0
0
0.705882
0
0
0.447876
0
0
0
0
0
0
1
0
false
0
0.205882
0
0.205882
0.382353
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
33e69ff1da138fc1c32f1d1c6769e71919d6230e
141
py
Python
exp6.py
Uday3114/AI
cf89e8a0a361fa84744f39ecb514b5687ae5a5fa
[ "BSD-3-Clause" ]
null
null
null
exp6.py
Uday3114/AI
cf89e8a0a361fa84744f39ecb514b5687ae5a5fa
[ "BSD-3-Clause" ]
null
null
null
exp6.py
Uday3114/AI
cf89e8a0a361fa84744f39ecb514b5687ae5a5fa
[ "BSD-3-Clause" ]
null
null
null
import cv2 img = cv2.imread('uday.jpg') gaussianBlurImg = cv2.GaussianBlur(img,(21,21),0) cv2.imwrite('gaussianBlurImg.jpg',gaussianBlurImg)
28.2
50
0.77305
19
141
5.736842
0.578947
0.330275
0
0
0
0
0
0
0
0
0
0.068182
0.06383
141
5
50
28.2
0.757576
0
0
0
0
0
0.190141
0
0
0
0
0
0
1
0
false
0
0.25
0
0.25
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
0
0
0
3
33e752a08a0c0a5188f257405cae6bad9bc864d6
235
py
Python
your_order_please.py
Kunalpod/codewars
8dc1af2f3c70e209471045118fd88b3ea1e627e5
[ "MIT" ]
null
null
null
your_order_please.py
Kunalpod/codewars
8dc1af2f3c70e209471045118fd88b3ea1e627e5
[ "MIT" ]
null
null
null
your_order_please.py
Kunalpod/codewars
8dc1af2f3c70e209471045118fd88b3ea1e627e5
[ "MIT" ]
null
null
null
#Kunal Gautam #Codewars : @Kunalpod #Problem name: Your order, please #Problem level: 6 kyu import re def key(x): return int(re.sub("[a-zA-Z]+", "", x)) def order(sentence): return " ".join(sorted(sentence.split(), key = key))
19.583333
54
0.655319
36
235
4.277778
0.75
0
0
0
0
0
0
0
0
0
0
0.005076
0.161702
235
11
55
21.363636
0.77665
0.357447
0
0
0
0
0.068027
0
0
0
0
0
0
1
0.4
false
0
0.2
0.4
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
0
0
0
1
1
0
0
3
d50796743d01eda3b728bf484ed999331418df01
126
py
Python
various/import_order/dundunall/package/functions/module.py
sideroff/python-exercises
6a9cc55735d977a71697204c734b3ade84a0c4fd
[ "MIT" ]
null
null
null
various/import_order/dundunall/package/functions/module.py
sideroff/python-exercises
6a9cc55735d977a71697204c734b3ade84a0c4fd
[ "MIT" ]
4
2020-03-24T18:00:07.000Z
2021-06-02T00:51:22.000Z
various/import_order/dundunall/package/functions/module.py
sideroff/python-exercises
6a9cc55735d977a71697204c734b3ade84a0c4fd
[ "MIT" ]
null
null
null
def func(): print('func') def func2(): print('func2') def func3(): print('func3') __all__ = ['func2', 'func3']
11.454545
28
0.547619
15
126
4.333333
0.4
0
0
0
0
0
0
0
0
0
0
0.061224
0.222222
126
11
28
11.454545
0.602041
0
0
0
0
0
0.192
0
0
0
0
0
0
1
0.428571
false
0
0
0
0.428571
0.428571
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
0
0
1
0
3
d50d337b2ff868a33e954da5a0d7f90b3c10414a
2,343
py
Python
release/stubs.min/Autodesk/Revit/DB/__init___parts/BaseArray.py
YKato521/ironpython-stubs
b1f7c580de48528490b3ee5791b04898be95a9ae
[ "MIT" ]
null
null
null
release/stubs.min/Autodesk/Revit/DB/__init___parts/BaseArray.py
YKato521/ironpython-stubs
b1f7c580de48528490b3ee5791b04898be95a9ae
[ "MIT" ]
null
null
null
release/stubs.min/Autodesk/Revit/DB/__init___parts/BaseArray.py
YKato521/ironpython-stubs
b1f7c580de48528490b3ee5791b04898be95a9ae
[ "MIT" ]
null
null
null
class BaseArray(Element, IDisposable): """ An abstract base class that represents an array within the Revit project. """ def Dispose(self): """ Dispose(self: Element,A_0: bool) """ pass def getBoundingBox(self, *args): """ getBoundingBox(self: Element,view: View) -> BoundingBoxXYZ """ pass def GetCopiedMemberIds(self): """ GetCopiedMemberIds(self: BaseArray) -> ICollection[ElementId] Retrieves the copied member Ids of the Array. Returns: The copied member Ids of the Array """ pass def GetOriginalMemberIds(self): """ GetOriginalMemberIds(self: BaseArray) -> ICollection[ElementId] Retrieves the original member Ids of the Array. Returns: The original member Ids of the Array """ pass def ReleaseUnmanagedResources(self, *args): """ ReleaseUnmanagedResources(self: Element,disposing: bool) """ pass def setElementType(self, *args): """ setElementType(self: Element,type: ElementType,incompatibleExceptionMessage: str) """ pass def __enter__(self, *args): """ __enter__(self: IDisposable) -> object """ pass def __exit__(self, *args): """ __exit__(self: IDisposable,exc_type: object,exc_value: object,exc_back: object) """ pass def __init__(self, *args): """ x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """ pass Label = property(lambda self: object(), lambda self, v: None, lambda self: None) """The family parameter label of the BaseArray. Get: Label(self: BaseArray) -> FamilyParameter Set: Label(self: BaseArray)=value """ Name = property(lambda self: object(), lambda self, v: None, lambda self: None) """Get and Set the Name property Set: Name(self: BaseArray)=value """ NumMembers = property( lambda self: object(), lambda self, v: None, lambda self: None ) """Retrieves or changes the number of the arrayed members. Get: NumMembers(self: BaseArray) -> int Set: NumMembers(self: BaseArray)=value """
25.467391
221
0.627401
251
2,343
5.61753
0.302789
0.06383
0.031206
0.039716
0.35461
0.35461
0.295035
0.192908
0.192908
0.192908
0
0.000576
0.258643
2,343
91
222
25.747253
0.811169
0.408451
0
0.375
0
0
0
0
0
0
0
0
0
1
0.375
false
0.375
0
0
0.541667
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
0
1
0
0
1
0
0
3
d514f8aee6362dfcd0583815fa42b1334b983c59
1,784
py
Python
Protheus_WebApp/Modules/SIGAFIN/FINA171TESTCASE.py
HelenaAdrignoli/tir-script-samples
bb4f4ab3a49f723216c93f66a4395e5aa328b846
[ "MIT" ]
null
null
null
Protheus_WebApp/Modules/SIGAFIN/FINA171TESTCASE.py
HelenaAdrignoli/tir-script-samples
bb4f4ab3a49f723216c93f66a4395e5aa328b846
[ "MIT" ]
null
null
null
Protheus_WebApp/Modules/SIGAFIN/FINA171TESTCASE.py
HelenaAdrignoli/tir-script-samples
bb4f4ab3a49f723216c93f66a4395e5aa328b846
[ "MIT" ]
null
null
null
from tir import Webapp import unittest class FINA171(unittest.TestCase): @classmethod def setUpClass(inst): inst.oHelper = Webapp() inst.oHelper.Setup('SIGAFIN','12/09/2019','T1','D MG 01 ','06') inst.oHelper.Program("FINA171") def test_FINA171_CT006(self): self.oHelper.SetButton("Incluir") self.oHelper.SetBranch('D MG 01') self.oHelper.SetValue('Numero','FITIR1') self.oHelper.SetValue('Modelo',"A") self.oHelper.SetValue('Operacao',"CDB") self.oHelper.SetValue('Banco',"033") self.oHelper.SetValue('Agencia', '00001') self.oHelper.SetValue('Conta Banco', '0000000004') self.oHelper.SetValue('Vlr.Operacao', '1000,00') self.oHelper.SetValue('Moeda', '1') self.oHelper.SetButton("Salvar") self.oHelper.SetButton("Cancelar") self.oHelper.SetButton("Visualizar") self.oHelper.CheckResult('EH_NUMERO','FITIR1') self.oHelper.CheckResult('EH_APLEMP','APL') self.oHelper.CheckResult('EH_TIPO','CDB') self.oHelper.CheckResult('EH_BANCO','033') self.oHelper.CheckResult('EH_AGENCIA','00001') self.oHelper.CheckResult('EH_CONTA','0000000004') self.oHelper.CheckResult('EH_VALOR','1000,00') self.oHelper.SetButton("Cancelar") self.oHelper.SearchBrowse(f"D MG 01 FITIR101") self.oHelper.SetButton("Outras Ações", "Excluir") self.oHelper.CheckResult('EH_NUMERO','FITIR1') self.oHelper.CheckResult('EH_APLEMP','APL') self.oHelper.CheckResult('EH_TIPO','CDB') self.oHelper.CheckResult('EH_BANCO','033') self.oHelper.CheckResult('EH_AGENCIA','00001') self.oHelper.CheckResult('EH_CONTA','0000000004') self.oHelper.CheckResult('EH_VALOR','1000,00') self.oHelper.SetButton("Confirmar") self.oHelper.AssertTrue() @classmethod def tearDownClass(inst): inst.oHelper.TearDown() if __name__ == "__main__": unittest.main()
34.980392
65
0.733184
226
1,784
5.681416
0.309735
0.274143
0.239875
0.261682
0.453271
0.453271
0.4081
0.4081
0.4081
0.4081
0
0.066339
0.087444
1,784
51
66
34.980392
0.722359
0
0
0.391304
0
0
0.236415
0
0
0
0
0
0.021739
1
0.065217
false
0
0.043478
0
0.130435
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
d51579fb56a1dcca8eee3db133790f0ee7a7dfea
66
py
Python
python/testData/refactoring/move/dunderAllTwoElementsTuple/before/src/a.py
truthiswill/intellij-community
fff88cfb0dc168eea18ecb745d3e5b93f57b0b95
[ "Apache-2.0" ]
2
2019-04-28T07:48:50.000Z
2020-12-11T14:18:08.000Z
python/testData/refactoring/move/dunderAllTwoElementsTuple/before/src/a.py
truthiswill/intellij-community
fff88cfb0dc168eea18ecb745d3e5b93f57b0b95
[ "Apache-2.0" ]
173
2018-07-05T13:59:39.000Z
2018-08-09T01:12:03.000Z
python/testData/refactoring/move/dunderAllTwoElementsTuple/before/src/a.py
truthiswill/intellij-community
fff88cfb0dc168eea18ecb745d3e5b93f57b0b95
[ "Apache-2.0" ]
2
2020-03-15T08:57:37.000Z
2020-04-07T04:48:14.000Z
__all__ = ('func', 'C') def func(): pass class C: pass
7.333333
23
0.5
9
66
3.222222
0.666667
0
0
0
0
0
0
0
0
0
0
0
0.318182
66
9
24
7.333333
0.644444
0
0
0.4
0
0
0.074627
0
0
0
0
0
0
1
0.2
false
0.4
0
0
0.4
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
1
0
0
0
0
0
3
1d1a3605cf0586a8836ef7ea3a36878389f52043
189
py
Python
django-system/src/tsm_api/urls.py
Deepak-Kharah/ioe-project
6f83ddcfced25130e0f05c3380dde97429d1f224
[ "MIT" ]
null
null
null
django-system/src/tsm_api/urls.py
Deepak-Kharah/ioe-project
6f83ddcfced25130e0f05c3380dde97429d1f224
[ "MIT" ]
null
null
null
django-system/src/tsm_api/urls.py
Deepak-Kharah/ioe-project
6f83ddcfced25130e0f05c3380dde97429d1f224
[ "MIT" ]
null
null
null
from rest_framework import routers from .api import MeasurementViewSet router = routers.DefaultRouter() router.register('', MeasurementViewSet, 'measurements') urlpatterns = router.urls
21
55
0.809524
19
189
8
0.684211
0
0
0
0
0
0
0
0
0
0
0
0.10582
189
8
56
23.625
0.899408
0
0
0
0
0
0.063492
0
0
0
0
0
0
1
0
false
0
0.4
0
0.4
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
0
0
0
3
1d1a612892a739c70db961a3b3d77494789e8f7a
2,815
py
Python
cstruct.py
HenryHu/pybbs
cb2a870f3879d5432739d0748a01842660793ba9
[ "BSD-2-Clause-FreeBSD" ]
14
2015-01-18T16:27:20.000Z
2021-06-20T19:27:32.000Z
cstruct.py
HenryHu/pybbs
cb2a870f3879d5432739d0748a01842660793ba9
[ "BSD-2-Clause-FreeBSD" ]
null
null
null
cstruct.py
HenryHu/pybbs
cb2a870f3879d5432739d0748a01842660793ba9
[ "BSD-2-Clause-FreeBSD" ]
2
2016-04-11T07:08:04.000Z
2018-08-02T15:39:27.000Z
from Util import Util import struct class CStruct(object): def unpack(self, data): Util.Unpack(self, self.parser.unpack(data)) def pack(self): return self.parser.pack(*Util.Pack(self)) def __init__(self, data = None): if (data == None): Util.InitStruct(self) else: self.unpack(data) class InmemStruct(object): def __init__(self): self.value = ['\0'] * self.size def read(self, pos, len): return "".join(self.value[pos:pos+len]) def write(self, pos, data): self.value[pos:pos+len(data)] = list(data) class Field(object): def __init__(self): self._parser = struct.Struct(self._format) self._base = 0 def setbase(self, base): self._base = base def __get__(self, obj, objtype): return self._parser.unpack(obj.read(self._base, self._parser.size))[0] def __set__(self, obj, val): obj.write(self._base, self._parser.pack(val)) @property def size(self): return self._parser.size class I8(Field): _format = '=b' class U8(Field): _format = '=B' class I32(Field): _format = '=i' class U32(Field): _format = '=I' class FixStr(Field): def __init__(self, len): self._format = "%ds" % len Field.__init__(self) class Str(FixStr): def __init__(self, len): FixStr.__init__(self, len) # no problem in __set__: auto pad 0 def __get__(self, obj, val): return Util.CString(Field.__get__(self, obj, val)) class Array(object): def __init__(self, childtype, count): self.childtype = childtype self.children = [] for i in range(0, count): self.children.append(childtype()) self._base = 0 def __get__(self, obj, objtype): # the point is to pass obj to __get__ return ArrayWithOwner(self, obj, objtype) def setbase(self, base): self._base = base i = 0 for child in self.children: child.setbase(base + child.size * i) i += 1 @property def size(self): if (len(self.children) > 0): return len(self.children) * self.children[0].size else: return 0 class ArrayWithOwner(object): def __init__(self, array, obj, objtype): self.array = array self.obj = obj self.objtype = objtype def __getitem__(self, index): return self.array.children[index].__get__(self.obj, self.objtype) def __setitem__(self, index, val): return self.array.children[index].__set__(self.obj, val) @property def _base(self): return self.array._base @property def size(self): return self.array.size def init_fields(cls): Util.InitFields(cls) return cls
23.458333
78
0.596803
363
2,815
4.352617
0.206612
0.04557
0.048734
0.043038
0.194304
0.074684
0.037975
0
0
0
0
0.008374
0.278863
2,815
119
79
23.655462
0.769951
0.024512
0
0.238636
0
0
0.004739
0
0
0
0
0
0
1
0.272727
false
0
0.022727
0.113636
0.613636
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
0
0
0
1
1
0
0
3
1d269b09276a41e997172eda2e2b2c7f1812760a
287
py
Python
bauh/commons/html.py
alesmuc/bauh
5f9fbd7f38eea6f54b5d6a97848c1ee8b6a43ecb
[ "Zlib" ]
507
2019-08-12T16:15:55.000Z
2022-03-28T15:49:39.000Z
bauh/commons/html.py
alesmuc/bauh
5f9fbd7f38eea6f54b5d6a97848c1ee8b6a43ecb
[ "Zlib" ]
176
2019-08-14T02:35:21.000Z
2022-03-31T21:43:56.000Z
bauh/commons/html.py
alesmuc/bauh
5f9fbd7f38eea6f54b5d6a97848c1ee8b6a43ecb
[ "Zlib" ]
57
2019-09-02T04:09:22.000Z
2022-03-21T21:37:16.000Z
import re HTML_RE = re.compile(r'<[^>]+>') def strip_html(string: str): return HTML_RE.sub('', string) def bold(text: str) -> str: return '<span style="font-weight: bold">{}</span>'.format(text) def link(url: str) -> str: return '<a href="{}">{}</a>'.format(url, url)
17.9375
67
0.58885
43
287
3.860465
0.511628
0.162651
0.144578
0
0
0
0
0
0
0
0
0
0.167247
287
15
68
19.133333
0.694561
0
0
0
0
0
0.233449
0
0
0
0
0
0
1
0.375
false
0
0.125
0.375
0.875
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
0
0
0
1
1
0
0
3
1d38289853433a301b25c49d3e148d554e7ff912
853
py
Python
tests/test_surpac.py
cmrajan/pygslib
acdf96d9ec17658f18fe9f078104c6259b479f52
[ "MIT" ]
94
2015-10-23T20:35:26.000Z
2022-03-23T08:24:49.000Z
tests/test_surpac.py
kaufmanno/pygslib
7fb0c201eba6304b1914cf88a437aa9dc42e7021
[ "MIT" ]
55
2016-09-19T17:20:46.000Z
2022-03-20T03:44:01.000Z
tests/test_surpac.py
kaufmanno/pygslib
7fb0c201eba6304b1914cf88a437aa9dc42e7021
[ "MIT" ]
47
2016-03-31T08:17:47.000Z
2022-03-18T02:35:33.000Z
from pygslib.surpac import Surpac def test_surpac(): SURPAC = Surpac('C:/OG_Python/pygslib/tests/test_surpac/surpac_strings.txt') assert(SURPAC.location == 'smp') assert(SURPAC.date == '8-Feb-94') assert(SURPAC.purpose == '') assert(SURPAC.memo == 'Sample string file') assert(SURPAC.axis.x_1 == 2440.000) assert(SURPAC.axis.z_2 == 152.541) assert(SURPAC.records[0].string_record[5].d[1] == 'second description field') assert(SURPAC.records[1].string_record[8].x == 2449.300) assert(len(SURPAC.records[2].string_record) == 15) assert(len(SURPAC.records) == 4) assert(SURPAC.records[3].number == 93 ) assert(SURPAC.records[0].string_record[12].length_d == 1) # assert(SURPAC.records[0].string_record[13].length_d == 0) assert(SURPAC.records[0].string_record[5].length_d == 3) test_surpac()
44.894737
81
0.68347
126
853
4.5
0.412698
0.253968
0.201058
0.141093
0.229277
0.229277
0.116402
0
0
0
0
0.065663
0.143025
853
19
82
44.894737
0.709986
0.066823
0
0
0
0
0.138365
0.071698
0
0
0
0
0.764706
1
0.058824
false
0
0.058824
0
0.117647
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
1
0
0
0
0
0
0
0
0
0
3
1d525ae60d9860c091fae9755ae3c40dde361602
2,637
py
Python
server/src/examples/generateMatrix.py
vladimirnitu/Illustry_dis
412f405b8b62236036123a7dd77215260f8999d0
[ "Apache-2.0" ]
null
null
null
server/src/examples/generateMatrix.py
vladimirnitu/Illustry_dis
412f405b8b62236036123a7dd77215260f8999d0
[ "Apache-2.0" ]
3
2022-03-08T15:31:17.000Z
2022-03-12T08:32:34.000Z
server/src/examples/generateMatrix.py
vladimirnitu/Illustry_dis
412f405b8b62236036123a7dd77215260f8999d0
[ "Apache-2.0" ]
null
null
null
import json import random nodes=[] links=[] colors=["blue","green","red"] for i in range(1,200): nodes.append( {"name":f'nameG1${i}', "group":1,"properties":[{ "label":"Size(%)", "value": random.randint(1, 50), "style": { "font-weight": "bold", "color": "green" } }, { "label": "Devs", "value": random.randint(1, 50), "style": { "font-weight": "bold" } }, { "label": "Active Devs", "value": random.randint(1, 50), "style": { "font-weight": "bold" } }, { "label": "APKS(%)", "value": random.randint(1, 50), "style": { "font-weight": "bold" } } ], "style": { "font-weight": "bold", "color": "green" } }) for i in range(1,30): nodes.append( { "name": f'nameG2${i}', "group": 2, "properties": [ { "label": "Knowledge(%)", "value": random.randint(1, 50), "tooltip":{ "val1": random.randint(1,20), "val2": random.randint(1,20), "val3": random.randint(1,20), "val4": random.randint(1,20), "val5": "Aberation Matrix" }, "style": { "font-weight": "bold", "color": "black", "background-color": "green" } }, { "label": "Components", "value": random.randint(1, 50), "tooltip":{ "val1": random.randint(1,20), "val2": random.randint(1,20), "val3": random.randint(1,20), "val4": random.randint(1,20), "val5": "Aberation Matrix" }, "style": { "font-weight": "bold" } } ], "style": { "font-weight": "bold", "color": "black", "background-color": "green" } }) for i in range(1,200): for j in range(1,30): links.append({ "source":f'nameG1${i}', "target":f'nameG2${j}', "value": random.randint(1, 50), "tooltip":{ "val1": random.randint(1,20), "val2": random.randint(1,20), "val3": random.randint(1,20), "val4": random.randint(1,20), "val5": "Aberation Matrix" }, "style": { "background-color": random.choice(colors) } }) fh = open("generatedMatrix1.json", "a+") fh.write(json.dumps({"illustrationData": {"Matrix":{ "nodes":nodes, "links":links }}})) # added an extra ')'.. code will now work fh.close()
24.64486
71
0.436102
258
2,637
4.457364
0.267442
0.214783
0.231304
0.166957
0.662609
0.662609
0.638261
0.613043
0.613043
0.453913
0
0.055291
0.362154
2,637
107
72
24.64486
0.628419
0.01479
0
0.504762
0
0
0.256065
0.008086
0
0
0
0
0
1
0
false
0
0.019048
0
0.019048
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
1d5c0477c56edb07cd006e02cc23e9b470c85d9e
357
py
Python
sciencebeam_pipelines/utils/logging.py
elifesciences/sciencebeam-pipelines
3bbffb1060262d517bd0efd474f0b477e6854c06
[ "MIT" ]
null
null
null
sciencebeam_pipelines/utils/logging.py
elifesciences/sciencebeam-pipelines
3bbffb1060262d517bd0efd474f0b477e6854c06
[ "MIT" ]
49
2021-11-08T11:12:11.000Z
2022-03-29T19:17:32.000Z
sciencebeam_pipelines/utils/logging.py
elifesciences/sciencebeam-pipelines
3bbffb1060262d517bd0efd474f0b477e6854c06
[ "MIT" ]
null
null
null
import logging def configure_logging( level=logging.WARNING, sciencebeam_level=logging.INFO): logging.basicConfig(level=level) logging.getLogger('sciencebeam_pipelines').setLevel(sciencebeam_level) logging.getLogger('sciencebeam_utils').setLevel(sciencebeam_level) logging.getLogger('__main__').setLevel(sciencebeam_level)
32.454545
74
0.77591
36
357
7.388889
0.388889
0.225564
0.259399
0.240602
0.300752
0
0
0
0
0
0
0
0.123249
357
10
75
35.7
0.84984
0
0
0
0
0
0.128852
0.058824
0
0
0
0
0
1
0.125
false
0
0.125
0
0.25
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
1d5c0e89dbaefa3901ace29379db47cc0a6feca2
1,002
py
Python
Ene-Jun-2021/perez-arroyo-jose-fernando/Parcial_1/Examen/Ejercicio_3/Ejercicio_3.py
bryanbalderas/DAS_Sistemas
1e31f088c0de7134471025a5730b0abfc19d936e
[ "MIT" ]
41
2017-09-26T09:36:32.000Z
2022-03-19T18:05:25.000Z
Ene-Jun-2021/perez-arroyo-jose-fernando/Parcial_1/Examen/Ejercicio_3/Ejercicio_3.py
bryanbalderas/DAS_Sistemas
1e31f088c0de7134471025a5730b0abfc19d936e
[ "MIT" ]
67
2017-09-11T05:06:12.000Z
2022-02-14T04:44:04.000Z
Ene-Jun-2021/perez-arroyo-jose-fernando/Parcial_1/Examen/Ejercicio_3/Ejercicio_3.py
bryanbalderas/DAS_Sistemas
1e31f088c0de7134471025a5730b0abfc19d936e
[ "MIT" ]
210
2017-09-01T00:10:08.000Z
2022-03-19T18:05:12.000Z
class LavadoraFacade(object): def lavar(self): self._lavar = Lavar() self._lavar.subsistema_operation() def enjuagar(self): self._enjuagar = Enjuagar() self._enjuagar.subsistema_operation() def centrifugado(self): self._centrifugado = Centrifugado() self._centrifugado.subsistema_operation() def ciclo_completo(self): self._ciclo_completo = Completo() self._ciclo_completo.subsistema_operation() class Lavar(object): def subsistema_operation(self): print("Lavando...\nFinalizado!") class Enjuagar(object): def subsistema_operation(self): print("Enjuagando...\nFinalizado!") class Centrifugado(object): def subsistema_operation(self): print("Centrifugando...\nFinalizado!") class Completo(object): def subsistema_operation(self): print ("Lavando...\nEnjuagando...\nCentrifugando...\nFinalizado!") if __name__ == "__main__": print(LavadoraFacade().ciclo_completo())
29.470588
74
0.683633
95
1,002
6.915789
0.231579
0.231355
0.115677
0.170472
0.246575
0.246575
0.133942
0
0
0
0
0
0.189621
1,002
33
75
30.363636
0.809113
0
0
0.148148
0
0
0.141858
0.133866
0
0
0
0
0
1
0.296296
false
0
0
0
0.481481
0.185185
0
0
0
null
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
3
1d64ebac0052c30d446f7f9601e3f877b649f072
3,144
py
Python
user.py
ZephonMakale/Password_Locker
3dd4e5e455dcf74e5748c870b666100e0448a48b
[ "MIT" ]
null
null
null
user.py
ZephonMakale/Password_Locker
3dd4e5e455dcf74e5748c870b666100e0448a48b
[ "MIT" ]
null
null
null
user.py
ZephonMakale/Password_Locker
3dd4e5e455dcf74e5748c870b666100e0448a48b
[ "MIT" ]
null
null
null
import random import string import pyperclip class User: """ Creates a user class that generates new intances of the User. """ user_list = [] def __init__(self, username, password): """ This function method gets to define the properties of the user. That's their username and password. """ self.username = username self.password = password def save_users(self): """ save_users method saves new users into user_list """ User.user_list.append(self) @classmethod def display_user(cls): return cls.user_list def delete_user(self): """ delete_user method deletes a saved user account """ User.user_list.remove(self) class Credentials(): """ Credentials class to help create new objects of credentials """ credentials_list = [] @classmethod def user_verification(cls, username, password): """ user verification method verifies whether is in the user_list """ x_user = "" for user in User.user_list: if(user.username == username and user.password == password): x_user == user.username return x_user def __init__(self, account, usernames, passwords): """ this function method defines user credentials """ self.account = account self.usernames = usernames self.passwords = passwords def save_attributes(self): """ save details method stores a new credential into the credentials list """ Credentials.credentials_list.append(self) def delete_credentials(self): """ delete_credentials method deletes saved credentials from the credentials_list """ Credentials.credentials_list.remove(self) @classmethod def find_credentials(cls, account): """ Method that takes in an account name and returns a credential that matches that account name """ for credential in cls.credentials_list: if credential.account == account: return credential @classmethod def copy_password(cls, account): found_credentials = Credentials.find_credentials(account) pyperclip.copy(found_credentials.passwords) @classmethod def credentials_exist(cls, account): """ Method that checks if a credential exists from the credential list """ for credential in cls.credentials_list: if credential.account == account: return True return False @classmethod def display_credentials(cls): """ Method that returns the credentials """ return cls.credentials_list def generate_password(self, stringlength=6): #Generate a random password string of letters, digits and special character" password = string.ascii_uppercase + string.ascii_lowercase + "!@#$%&*" result_str = ''.join(random.choice(password) for i in range(int(stringlength))) return result_str
27.33913
125
0.625636
341
3,144
5.633431
0.27566
0.062467
0.024987
0.030193
0.113483
0.113483
0.067673
0.067673
0.067673
0.067673
0
0.000454
0.298664
3,144
115
126
27.33913
0.870748
0.269402
0
0.185185
1
0
0.003436
0
0
0
0
0
0
1
0.240741
false
0.203704
0.055556
0.018519
0.5
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
1
0
1
0
0
0
0
0
3
1d7128d22f8060d1485449ab776ad4e54cf6c9ba
254
py
Python
L1Trigger/TrackerTFP/python/Customize_cff.py
Jingyan95/cmssw
f78d843f0837f269ee6811b0e0f4c0432928c190
[ "Apache-2.0" ]
5
2020-07-02T19:05:26.000Z
2022-02-25T14:37:09.000Z
L1Trigger/TrackerTFP/python/Customize_cff.py
Jingyan95/cmssw
f78d843f0837f269ee6811b0e0f4c0432928c190
[ "Apache-2.0" ]
61
2020-07-14T17:22:52.000Z
2022-03-16T11:11:12.000Z
L1Trigger/TrackerTFP/python/Customize_cff.py
dally96/cmssw
c37b9bfa391850cb349c71190b0bbb2d04224cc8
[ "Apache-2.0" ]
8
2020-06-08T16:28:54.000Z
2021-11-16T14:40:00.000Z
import FWCore.ParameterSet.Config as cms def setupUseTMTT(process): process.TrackTriggerDataFormats.UseHybrid = False process.TrackTriggerSetup.TrackingParticle.MinPt = 3.0 process.TrackTriggerSetup.Firmware.MaxdPhi = 0.01 return process
36.285714
58
0.799213
27
254
7.518519
0.777778
0.236453
0
0
0
0
0
0
0
0
0
0.022624
0.129921
254
7
59
36.285714
0.895928
0
0
0
0
0
0
0
0
0
0
0
0
1
0.166667
false
0
0.166667
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
0
0
0
0
0
3
1d7fe859e8cf619da00ca87cc584290b37fb83d4
2,944
py
Python
src/spinnaker_ros_lsm/venv/lib/python2.7/site-packages/spinn_front_end_common/utilities/report_functions/front_end_common_network_specification_report_partitioned_graph_report.py
Roboy/LSM_SpiNNaker_MyoArm
04fa1eaf78778edea3ba3afa4c527d20c491718e
[ "BSD-3-Clause" ]
2
2020-11-01T13:22:11.000Z
2020-11-01T13:22:20.000Z
src/spinnaker_ros_lsm/venv/lib/python2.7/site-packages/spinn_front_end_common/utilities/report_functions/front_end_common_network_specification_report_partitioned_graph_report.py
Roboy/LSM_SpiNNaker_MyoArm
04fa1eaf78778edea3ba3afa4c527d20c491718e
[ "BSD-3-Clause" ]
null
null
null
src/spinnaker_ros_lsm/venv/lib/python2.7/site-packages/spinn_front_end_common/utilities/report_functions/front_end_common_network_specification_report_partitioned_graph_report.py
Roboy/LSM_SpiNNaker_MyoArm
04fa1eaf78778edea3ba3afa4c527d20c491718e
[ "BSD-3-Clause" ]
null
null
null
import logging import os import time logger = logging.getLogger(__name__) class FrontEndCommonNetworkSpecificationReportPartitionedGraphReport(object): """ """ def __call__(self, report_folder, partitioned_graph, hostname): """ :param report_folder: the directory to which reports are stored :type report_folder: str :param partitioned_graph: the partitioned graph generated from the \ tools :type partitioned_graph:\ pacman.model.partitioned_graph.partitioned_graph.PartitionedGraph :param hostname: the machine name :type hostname: :return: None """ filename = report_folder + os.sep + "network_specification.rpt" f_network_specification = None try: f_network_specification = open(filename, "w") except IOError: logger.error("Generate_placement_reports: Can't open file {}" " for writing.".format(filename)) f_network_specification.write(" Network Specification\n") f_network_specification.write(" =====================\n\n") time_date_string = time.strftime("%c") f_network_specification.write("Generated: {}".format(time_date_string)) f_network_specification.write( " for target machine '{}'".format(hostname)) f_network_specification.write("\n\n") # Print information on vertices: f_network_specification.write("*** Vertices:\n") for vertex in partitioned_graph.subvertices: label = vertex.label model = vertex.model_name constraints = vertex.constraints f_network_specification.write("Vertex {}\n".format(label)) f_network_specification.write("Model: {}\n".format(model)) for constraint in constraints: constraint_str = constraint.label f_network_specification.write("constraint: {}\n" .format(constraint_str)) f_network_specification.write("\n") # Print information on edges: f_network_specification.write("*** Edges:\n") for edge in partitioned_graph.subedges: label = edge.label model = "No Model" if hasattr(edge, "connector"): model = edge.connector.__class__.__name__ pre_v = edge.pre_subvertex post_v = edge.post_subvertex pre_v_label = pre_v.label post_v_label = post_v.label edge_str = "Edge {} from vertex: '{}' to vertex: '{}' \n"\ .format(label, pre_v_label, post_v_label) f_network_specification.write(edge_str) f_network_specification.write(" Model: {}\n".format(model)) f_network_specification.write("\n") # Close file: f_network_specification.close()
40.328767
85
0.606997
299
2,944
5.685619
0.287625
0.223529
0.21
0.214118
0.189412
0.111765
0.078824
0.050588
0
0
0
0
0.292459
2,944
72
86
40.888889
0.816131
0.145041
0
0.083333
0
0
0.135091
0.031713
0
0
0
0
0
1
0.020833
false
0
0.0625
0
0.104167
0
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
d5322a091a19baabe3ec4fa4252737504c19dd7a
680
py
Python
academic/schools/models.py
David100459/final
ebd096e35e09f553e01dfcbba3562c75d76aca19
[ "MIT" ]
null
null
null
academic/schools/models.py
David100459/final
ebd096e35e09f553e01dfcbba3562c75d76aca19
[ "MIT" ]
null
null
null
academic/schools/models.py
David100459/final
ebd096e35e09f553e01dfcbba3562c75d76aca19
[ "MIT" ]
null
null
null
from django.db import models # Create your models here. class student(models.Model) : firt_name = models.CharField(max_length=50) last_name = models.CharField(max_length=50) code = models.CharField(max_length=10) created_at = models.DateTimeField() class subject(models.Model) : name = models.CharField(max_length=50) code = models.CharField(max_length=10) course = models.CharField(max_length=3) created_at = models.DateTimeField() class subject2(models.Model) : id_student = models.ForeignKey(student, on_delete=models.CASCADE) id_subject = models.ForeignKey(subject, on_delete=models.CASCADE) created_at = models.DateTimeField()
32.380952
69
0.747059
89
680
5.539326
0.359551
0.182556
0.219067
0.292089
0.438134
0.30426
0.243408
0.243408
0.243408
0.243408
0
0.020725
0.148529
680
20
70
34
0.830743
0.035294
0
0.333333
0
0
0
0
0
0
0
0
0
1
0
false
0
0.066667
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
0
0
1
0
0
3
d53c410b832a0b7cf260e4f6a911c38b33b0dbcb
386
py
Python
captum/attr/_utils/custom_modules.py
greentfrapp/captum
03f89a5825ae389d117ebdb6b9924e97bc311a4b
[ "BSD-3-Clause" ]
1
2020-12-09T03:26:09.000Z
2020-12-09T03:26:09.000Z
captum/attr/_utils/custom_modules.py
greentfrapp/captum
03f89a5825ae389d117ebdb6b9924e97bc311a4b
[ "BSD-3-Clause" ]
null
null
null
captum/attr/_utils/custom_modules.py
greentfrapp/captum
03f89a5825ae389d117ebdb6b9924e97bc311a4b
[ "BSD-3-Clause" ]
1
2021-09-26T01:31:46.000Z
2021-09-26T01:31:46.000Z
#!/usr/bin/env python3 import torch.nn as nn class Addition_Module(nn.Module): """Custom addition module that uses multiple inputs to assure correct relevance propagation. Any addition in a forward function needs to be replaced with the module before using LRP.""" def __init__(self): super().__init__() def forward(self, x1, x2): return x1 + x2
25.733333
83
0.69171
55
386
4.690909
0.745455
0.108527
0
0
0
0
0
0
0
0
0
0.016722
0.225389
386
14
84
27.571429
0.846154
0.520725
0
0
0
0
0
0
0
0
0
0
0
1
0.333333
false
0
0.166667
0.166667
0.833333
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
0
0
0
1
1
0
0
3
d541ebab7a773defa86887803598f9b40ff7d7b0
229
py
Python
demo/test_func2.py
jagg01/my-repo2
b379be385c7347f2cc4724f51ee540583f932781
[ "MIT" ]
null
null
null
demo/test_func2.py
jagg01/my-repo2
b379be385c7347f2cc4724f51ee540583f932781
[ "MIT" ]
null
null
null
demo/test_func2.py
jagg01/my-repo2
b379be385c7347f2cc4724f51ee540583f932781
[ "MIT" ]
null
null
null
import numpy as np import func as fc import pytest @pytest.mark.parametrize( "myinput", "myref", [(1, np.pi), (0, 0), (2.1, np.pi * 2.1 ** 2)] ) def test_area_circ(myinput, myref): assert fc.area_circ(myinput) == myref
20.818182
69
0.646288
39
229
3.717949
0.512821
0.248276
0.068966
0.275862
0
0
0
0
0
0
0
0.042553
0.179039
229
10
70
22.9
0.728723
0
0
0
0
0
0.052402
0
0
0
0
0
0.125
1
0.125
false
0
0.375
0
0.5
0
0
0
0
null
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
d57608f3b597bbb858feac31a1459ea68cd3ae23
168
py
Python
day02/ex00/ft_filter.py
agelloz/42AI-python-bootcamp
843099a6f6ea088f7c2f415ed0a33e9decd20641
[ "MIT" ]
1
2019-11-11T10:37:49.000Z
2019-11-11T10:37:49.000Z
day02/ex00/ft_filter.py
agelloz/42AI-python-bootcamp
843099a6f6ea088f7c2f415ed0a33e9decd20641
[ "MIT" ]
null
null
null
day02/ex00/ft_filter.py
agelloz/42AI-python-bootcamp
843099a6f6ea088f7c2f415ed0a33e9decd20641
[ "MIT" ]
null
null
null
def ft_filter(function_to_apply, list_of_inputs): for elem in list_of_inputs: res = function_to_apply(elem) if res is True: yield elem
24
49
0.654762
26
168
3.884615
0.653846
0.19802
0.29703
0
0
0
0
0
0
0
0
0
0.291667
168
6
50
28
0.84874
0
0
0
0
0
0
0
0
0
0
0
0
1
0.2
false
0
0
0
0.2
0
1
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
633c75c0fbdf7f1549ffede454e87ef7d81f2771
112
py
Python
week_3b/count_backward.py
emiliska/python-farms
88efb1af1c7e23cf24f1217479d8ab25a2c7da66
[ "MIT" ]
null
null
null
week_3b/count_backward.py
emiliska/python-farms
88efb1af1c7e23cf24f1217479d8ab25a2c7da66
[ "MIT" ]
null
null
null
week_3b/count_backward.py
emiliska/python-farms
88efb1af1c7e23cf24f1217479d8ab25a2c7da66
[ "MIT" ]
null
null
null
# create a loop counter = 10 while counter > 0: print(counter) counter = counter -1 print('Blastoff!!')
16
24
0.651786
15
112
4.866667
0.666667
0.383562
0
0
0
0
0
0
0
0
0
0.045977
0.223214
112
7
25
16
0.793103
0.116071
0
0
0
0
0.102041
0
0
0
0
0
0
1
0
false
0
0
0
0
0.4
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
638bf4c04c787039b357aed7abb6d0075974e709
292
py
Python
todo/music/models.py
huynhminhtruong/django-rest-framework
ec9bf3530cfabcb231f23cd81b6405d536eb0f4d
[ "MIT" ]
null
null
null
todo/music/models.py
huynhminhtruong/django-rest-framework
ec9bf3530cfabcb231f23cd81b6405d536eb0f4d
[ "MIT" ]
null
null
null
todo/music/models.py
huynhminhtruong/django-rest-framework
ec9bf3530cfabcb231f23cd81b6405d536eb0f4d
[ "MIT" ]
null
null
null
from django.db import models # Create your models here. class Song(models.Model): title = models.CharField(max_length=255) created = models.DateTimeField(auto_now_add=True) def __str__(self): return self.title def body_preview(self): return self.body[:50]
20.857143
53
0.695205
40
292
4.875
0.725
0.102564
0.14359
0
0
0
0
0
0
0
0
0.021645
0.208904
292
13
54
22.461538
0.822511
0.082192
0
0
0
0
0
0
0
0
0
0
0
1
0.25
false
0
0.125
0.25
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
0
0
0
1
1
0
0
3
639e234dd9aa794cf3e317138d7f53e339936659
152
py
Python
test-files/test small.py
nelmiux/CS347-Data_Management
1e9d87097b5a373f9312b0d6b413198e495fd6c0
[ "CNRI-Jython" ]
null
null
null
test-files/test small.py
nelmiux/CS347-Data_Management
1e9d87097b5a373f9312b0d6b413198e495fd6c0
[ "CNRI-Jython" ]
null
null
null
test-files/test small.py
nelmiux/CS347-Data_Management
1e9d87097b5a373f9312b0d6b413198e495fd6c0
[ "CNRI-Jython" ]
null
null
null
from BatchRemote import BatchRemote service = BatchRemote() mybatches ROOT in service : for files in ROOT.getFileNames(ROOT.getcwd()) : print files
25.333333
48
0.776316
19
152
6.210526
0.631579
0
0
0
0
0
0
0
0
0
0
0
0.151316
152
6
49
25.333333
0.914729
0
0
0
0
0
0
0
0
0
0
0
0
0
null
null
0
0.2
null
null
0.2
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
1
0
0
0
0
0
0
0
0
3
63a183dc8cf80b9cddd81a14282a727a1c259353
184
py
Python
permissions/templatetags/permissions.py
zhuitrec/django-perms
c2050b790f1c6e6d0d0c3a6c507fbf9d5ed22ebd
[ "MIT" ]
null
null
null
permissions/templatetags/permissions.py
zhuitrec/django-perms
c2050b790f1c6e6d0d0c3a6c507fbf9d5ed22ebd
[ "MIT" ]
null
null
null
permissions/templatetags/permissions.py
zhuitrec/django-perms
c2050b790f1c6e6d0d0c3a6c507fbf9d5ed22ebd
[ "MIT" ]
null
null
null
""" Dynamically create template filters for every can_* permission in the perms module that accepts one or two arguments. """ from django import template register = template.Library()
26.285714
69
0.788043
25
184
5.76
0.92
0
0
0
0
0
0
0
0
0
0
0
0.146739
184
6
70
30.666667
0.917197
0.63587
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
0
1
0
0
null
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
3
63bbf3dd590b5567494453550db718c8e245f1ce
238
py
Python
zinnia/models/entry.py
mcfletch/django-blog-zinnia
8777ef61c4de29d2a8f2ba6a767f7a80733c9b1f
[ "BSD-3-Clause" ]
2
2017-02-24T15:36:29.000Z
2017-12-30T15:59:34.000Z
zinnia/models/entry.py
mcfletch/django-blog-zinnia
8777ef61c4de29d2a8f2ba6a767f7a80733c9b1f
[ "BSD-3-Clause" ]
null
null
null
zinnia/models/entry.py
mcfletch/django-blog-zinnia
8777ef61c4de29d2a8f2ba6a767f7a80733c9b1f
[ "BSD-3-Clause" ]
null
null
null
"""Entry model for Zinnia""" from zinnia.settings import ENTRY_BASE_MODEL from zinnia.models_bases import load_model_class class Entry(load_model_class(ENTRY_BASE_MODEL)): """ The final Entry model based on inheritence. """
23.8
48
0.760504
34
238
5.058824
0.5
0.116279
0.162791
0
0
0
0
0
0
0
0
0
0.155462
238
9
49
26.444444
0.855721
0.277311
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.666667
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
0
0
0
3
63bce6ae682ac2555d6865cdf3d8776fb8773e1a
846
py
Python
kb/category/feeds.py
movermeyer/django-kb
3c3246761f4f6d60221049f46ce9702fd56384a8
[ "BSD-3-Clause" ]
7
2015-04-17T12:01:29.000Z
2021-06-21T01:54:15.000Z
kb/category/feeds.py
movermeyer/django-kb
3c3246761f4f6d60221049f46ce9702fd56384a8
[ "BSD-3-Clause" ]
null
null
null
kb/category/feeds.py
movermeyer/django-kb
3c3246761f4f6d60221049f46ce9702fd56384a8
[ "BSD-3-Clause" ]
3
2015-04-17T16:21:42.000Z
2018-06-06T13:34:03.000Z
from __future__ import unicode_literals from django.contrib.syndication.views import Feed from django.shortcuts import get_object_or_404 from .models import Category class CategoryFeed(Feed): def get_object(self, request, slug): return get_object_or_404(Category.objects.categories(), slug=slug) def link(self, obj): return obj.get_absolute_url() def title(self, obj): return obj.name def description(self, obj): return obj.description def items(self, obj): return obj.articles.published() def item_description(self, item): return item.content.rendered def item_pubdate(self, item): return item.created def item_categories(self, item): return item.tags.all() def item_author_name(self, item): return item.created_by.username
22.864865
74
0.696217
111
846
5.126126
0.414414
0.049209
0.091388
0.112478
0.087873
0
0
0
0
0
0
0.009091
0.219858
846
36
75
23.5
0.85303
0
0
0
0
0
0
0
0
0
0
0
0
1
0.391304
false
0
0.173913
0.391304
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
0
0
0
1
1
0
0
3
63c0e47b367f3f495fa833a32eedf942720b86c4
963
py
Python
src/aws_lambda_module_loader/__init__.py
tvsquared/aws-lambda-module-loader
89b16b903bca6b6929d9a041eb4eb06eb00e5301
[ "MIT" ]
null
null
null
src/aws_lambda_module_loader/__init__.py
tvsquared/aws-lambda-module-loader
89b16b903bca6b6929d9a041eb4eb06eb00e5301
[ "MIT" ]
null
null
null
src/aws_lambda_module_loader/__init__.py
tvsquared/aws-lambda-module-loader
89b16b903bca6b6929d9a041eb4eb06eb00e5301
[ "MIT" ]
null
null
null
import importlib import pkgutil class SubModuleImporterExpection(Exception): pass def import_submodules(package:str, recursive=True): """[summary] Args: package (str): [description] recursive (bool, optional): [description]. Defaults to True. Returns: [dict]: [list of imported modules] """ try: package = importlib.import_module(package) except ModuleNotFoundError: raise SubModuleImporterExpection(f'No such module: {package}') if not hasattr(package, '__path__'): # this ain't a package raise SubModuleImporterExpection(f'No such package: {package}') results = {} for loader, name, is_pkg in pkgutil.walk_packages(package.__path__): full_name = package.__name__ + '.' + name results[full_name] = importlib.import_module(full_name) if recursive and is_pkg: results.update(import_submodules(full_name)) return results
27.514286
72
0.669782
103
963
6.038835
0.533981
0.051447
0.067524
0.109325
0.122187
0
0
0
0
0
0
0
0.232606
963
34
73
28.323529
0.841678
0.192108
0
0
0
0
0.080321
0
0
0
0
0
0
1
0.055556
false
0.055556
0.5
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
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
1
0
1
0
0
3
894ac0351d24025e27a52d8502753450b3b42b0a
820
py
Python
objectives.py
anshul3899/Structured-Graph-Learning
fabefa3d160baf8faefbffd7961a455348d6f068
[ "MIT" ]
3
2021-09-05T12:49:24.000Z
2021-10-01T16:51:48.000Z
objectives.py
anshul3899/Structured-Graph-Learning
fabefa3d160baf8faefbffd7961a455348d6f068
[ "MIT" ]
null
null
null
objectives.py
anshul3899/Structured-Graph-Learning
fabefa3d160baf8faefbffd7961a455348d6f068
[ "MIT" ]
null
null
null
import numpy as np import math class Objectives: def objective(self, Lw, U, lamda, K, beta): return self.negloglikelihood(Lw, lamda, K) + self.prior(beta, Lw, lamda, U) def negloglikelihood(self, Lw, lamda, K): return np.sum(-np.log(lamda)) + np.trace(K @ Lw) def prior(self, beta, Lw, lamda, U): return 0.5 * beta * np.linalg.norm(Lw - U @ np.diag(lamda) @ U.T)**2 def bipartite_nll(self, Lw, K, J): return np.sum(-np.log(np.linalg.eigvals(Lw + J)) + np.diag(K @ Lw)) def bipartite_prior(self, nu, Aw, psi, V): return 0.5 * nu * np.linalg.norm(Aw - V @ np.diag(psi) @ V.T) ** 2 def bipartite_obj(self, Aw, Lw, V, psi, K, J, nu): return self.bipartite_nll(Lw = Lw, K = K, J = J) + self.bipartite_prior(nu = nu, Aw = Aw, psi = psi, V = V)
37.272727
115
0.589024
142
820
3.366197
0.260563
0.058577
0.033473
0.050209
0.066946
0
0
0
0
0
0
0.009677
0.243902
820
21
116
39.047619
0.76129
0
0
0
0
0
0
0
0
0
0
0
0
1
0.4
false
0
0.133333
0.4
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
0
0
0
1
1
0
0
3
89524bc5e615da49bd623b81f087d58e5f7883e2
92
py
Python
rest_live/apps.py
trevelyansPackAndCool/django-rest-live
ff8b20cbd31cd1a3330c3cc081c6b61bed4cb541
[ "MIT" ]
50
2020-08-30T18:26:36.000Z
2022-01-19T16:12:51.000Z
rest_live/apps.py
trevelyansPackAndCool/django-rest-live
ff8b20cbd31cd1a3330c3cc081c6b61bed4cb541
[ "MIT" ]
16
2020-12-09T22:32:42.000Z
2022-03-08T01:35:21.000Z
rest_live/apps.py
trevelyansPackAndCool/django-rest-live
ff8b20cbd31cd1a3330c3cc081c6b61bed4cb541
[ "MIT" ]
8
2020-11-09T14:14:47.000Z
2022-01-27T17:25:31.000Z
from django.apps import AppConfig class RestLiveConfig(AppConfig): name = "rest_live"
15.333333
33
0.76087
11
92
6.272727
0.909091
0
0
0
0
0
0
0
0
0
0
0
0.163043
92
5
34
18.4
0.896104
0
0
0
0
0
0.097826
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
0
0
0
3
8955331072fc07afcf35bc80a486abdae5034aae
851
py
Python
virtual_warehouse/environment.py
kbrownnn/virtual-warehouse
8a527a8fedc5b8309b1962e95e41725c784d30f3
[ "BSD-3-Clause" ]
1
2021-03-09T14:59:09.000Z
2021-03-09T14:59:09.000Z
virtual_warehouse/environment.py
kbrownnn/virtual-warehouse
8a527a8fedc5b8309b1962e95e41725c784d30f3
[ "BSD-3-Clause" ]
null
null
null
virtual_warehouse/environment.py
kbrownnn/virtual-warehouse
8a527a8fedc5b8309b1962e95e41725c784d30f3
[ "BSD-3-Clause" ]
1
2021-07-16T20:13:46.000Z
2021-07-16T20:13:46.000Z
"""Different environment settings.""" # TODO: Add correct objects LOCATION_TYPE_MAP = { "floor": {"color": "gray", "gray_color": "gray", "mesh": ":/objects/floor.obj",}, "rack": {"color": "#62ca5f", "gray_color": "gray", "mesh": ":/objects/rack.obj",}, "wall": {"color": "black", "gray_color": "black", "mesh": ":/objects/floor.obj",}, "inbound_door": { "color": "#fde724", "gray_color": "#222", "mesh": ":/objects/floor.obj", }, "outbound_door": { "color": "#fd8a24", "gray_color": "#aaa", "mesh": ":/objects/floor.obj", }, "staging_area": { "color": "#2c728e", "gray_color": "#ddd", "mesh": ":/objects/floor.obj", }, "custom": { "color": "#ca5f5f", "gray_color": "white", "mesh": ":/objects/floor.obj", }, }
29.344828
86
0.499412
83
851
4.975904
0.39759
0.152542
0.232446
0.276029
0.116223
0
0
0
0
0
0
0.028081
0.246769
851
28
87
30.392857
0.616225
0.068155
0
0.16
0
0
0.501906
0
0
0
0
0.035714
0
1
0
false
0
0
0
0
0
0
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
0
0
3
8984b3428e71303093186284a24d31247a32e398
2,096
py
Python
123DDOS.py
tfqhkm/123DDOS
e72a3eec428da87696e5cd5b214abfd025343fb5
[ "Apache-2.0" ]
null
null
null
123DDOS.py
tfqhkm/123DDOS
e72a3eec428da87696e5cd5b214abfd025343fb5
[ "Apache-2.0" ]
null
null
null
123DDOS.py
tfqhkm/123DDOS
e72a3eec428da87696e5cd5b214abfd025343fb5
[ "Apache-2.0" ]
null
null
null
import time import socket import random import sys def usage(): print "\033[1;32m#########################################################" print "#------------------------[\033[1;91mLITE-DDOS\033[1;32m]---------------------#" print "#-------------------------------------------------------#" print "# \033[1;91mCommand: " "python2 123DDOS.py " "<ip> <port> <packet> \033[1;32m #" print "# #" print "#\033[1;91mCreator:TAUFIQ \033[1;32m## ### ## #" print "#\033[1;91mInsta : tfqhkm._ \033[1;32m## # ## #" print "#\033[1;91mVersion:1.0 \033[1;32m## ### ## #" print "# ## \033[1;91m ## \033[1;32m# \033[1;91m## \033[1;32m## #" print "# ## \033[1;91m## \033[1;32m### \033[1;91m## \033[1;32m###### #" print "# \033[1;91m<--[Malaysia Security Lite]--> \033[1;32m#" print "#########################################################" print " @@@@@@@@@@" print " @@@@@@@@@@@@" print " @@@@@@@@@@@@@@@@" def flood(victim, vport, duration): # Support US :) # Okey Here I Make A Server, When I Call "SOCK_DGRAM" thats mean UDP type program client = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) # 20000 representasi one byte on server bytes = random._urandom(20000) timeout = time.time() + duration sent = 3000 while 1: if time.time() > timeout: break else: pass client.sendto(bytes, (victim, vport)) sent = sent + 1 print "\033[1;91mMemulai \033[1;32m%s \033[1;91mPACKET SENT \033[1;32m%s \033[1;91mPORT \033[1;32m%s "%(sent, victim, vport) def main(): print len(sys.argv) if len(sys.argv) != 4: usage() else: flood(sys.argv[1], int(sys.argv[2]), int(sys.argv[3])) if __name__ == '__main__': main()
43.666667
132
0.41126
222
2,096
3.824324
0.369369
0.127208
0.11543
0.127208
0.254417
0.234393
0.149588
0.100118
0.100118
0.100118
0
0.132956
0.325382
2,096
47
133
44.595745
0.467468
0.062977
0
0.04878
0
0.073171
0.563042
0.167432
0
0
0
0
0
0
null
null
0.02439
0.097561
null
null
0.414634
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
1
0
3
89913f28cc6fad41bafc765595b535eb313265af
9,182
py
Python
REM/Tool/IDA 7.3/python/ida_registry.py
dodieboy/Np_class
af9ec993eda3c1e2bf70257c8384696bb64a5e9d
[ "MIT" ]
null
null
null
REM/Tool/IDA 7.3/python/ida_registry.py
dodieboy/Np_class
af9ec993eda3c1e2bf70257c8384696bb64a5e9d
[ "MIT" ]
null
null
null
REM/Tool/IDA 7.3/python/ida_registry.py
dodieboy/Np_class
af9ec993eda3c1e2bf70257c8384696bb64a5e9d
[ "MIT" ]
2
2021-03-30T00:46:58.000Z
2021-12-12T23:41:12.000Z
# This file was automatically generated by SWIG (http://www.swig.org). # Version 2.0.12 # # Do not make changes to this file unless you know what you are doing--modify # the SWIG interface file instead. """ IDA Plugin SDK API wrapper: registry """ from sys import version_info if version_info >= (2,6,0): def swig_import_helper(): from os.path import dirname import imp fp = None try: fp, pathname, description = imp.find_module('_ida_registry', [dirname(__file__)]) except ImportError: import _ida_registry return _ida_registry if fp is not None: try: _mod = imp.load_module('_ida_registry', fp, pathname, description) finally: fp.close() return _mod _ida_registry = swig_import_helper() del swig_import_helper else: import _ida_registry del version_info try: _swig_property = property except NameError: pass # Python < 2.2 doesn't have 'property'. def _swig_setattr_nondynamic(self,class_type,name,value,static=1): if (name == "thisown"): return self.this.own(value) if (name == "this"): if type(value).__name__ == 'SwigPyObject': self.__dict__[name] = value return method = class_type.__swig_setmethods__.get(name,None) if method: return method(self,value) if (not static): self.__dict__[name] = value else: raise AttributeError("You cannot add attributes to %s" % self) def _swig_setattr(self,class_type,name,value): return _swig_setattr_nondynamic(self,class_type,name,value,0) def _swig_getattr(self,class_type,name): if (name == "thisown"): return self.this.own() method = class_type.__swig_getmethods__.get(name,None) if method: return method(self) raise AttributeError(name) def _swig_repr(self): try: strthis = "proxy of " + self.this.__repr__() except: strthis = "" return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,) try: _object = object _newclass = 1 except AttributeError: class _object : pass _newclass = 0 def _swig_setattr_nondynamic_method(set): def set_attr(self,name,value): if (name == "thisown"): return self.this.own(value) if hasattr(self,name) or (name == "this"): set(self,name,value) else: raise AttributeError("You cannot add attributes to %s" % self) return set_attr try: import weakref weakref_proxy = weakref.proxy except: weakref_proxy = lambda x: x import ida_idaapi import sys _BC695 = sys.modules["__main__"].IDAPYTHON_COMPAT_695_API if _BC695: def bc695redef(func): ida_idaapi._BC695.replace_fun(func) return func def reg_read_string(*args): """ reg_read_string(name, subkey=None, _def=None) -> PyObject * Read a string from the registry. @param name: value name (C++: const char *) @param subkey: key name (C++: const char *) @return: success """ return _ida_registry.reg_read_string(*args) def reg_data_type(*args): """ reg_data_type(name, subkey=None) -> regval_type_t Get data type of a given value. @param name: value name (C++: const char *) @param subkey: key name (C++: const char *) @return: false if the [key+]value doesn't exist """ return _ida_registry.reg_data_type(*args) def reg_read_binary(*args): """ reg_read_binary(name, subkey=None) -> PyObject * Read binary data from the registry. @param name: value name (C++: const char *) @param subkey: key name (C++: const char *) @return: false if 'data' is not large enough to hold all data present. in this case 'data' is left untouched. """ return _ida_registry.reg_read_binary(*args) def reg_write_binary(*args): """ reg_write_binary(name, py_bytes, subkey=None) Write binary data to the registry. @param name: value name (C++: const char *) @param subkey: key name (C++: const char *) """ return _ida_registry.reg_write_binary(*args) def reg_subkey_subkeys(*args): """ reg_subkey_subkeys(name) -> PyObject * Get all subkey names of given key. @param name (C++: const char *) """ return _ida_registry.reg_subkey_subkeys(*args) def reg_subkey_values(*args): """ reg_subkey_values(name) -> PyObject * Get all value names under given key. @param name (C++: const char *) """ return _ida_registry.reg_subkey_values(*args) ROOT_KEY_NAME = _ida_registry.ROOT_KEY_NAME """ Key used to store IDA settings in registry (Windows version).this name is automatically prepended to all key names passed to functions in this file. """ reg_unknown = _ida_registry.reg_unknown reg_sz = _ida_registry.reg_sz reg_binary = _ida_registry.reg_binary reg_dword = _ida_registry.reg_dword def reg_delete_subkey(*args): """ reg_delete_subkey(name) -> bool Delete a key from the registry. @param name (C++: const char *) """ return _ida_registry.reg_delete_subkey(*args) def reg_delete_tree(*args): """ reg_delete_tree(name) -> bool Delete a subtree from the registry. @param name (C++: const char *) """ return _ida_registry.reg_delete_tree(*args) def reg_delete(*args): """ reg_delete(name, subkey=None) -> bool Delete a value from the registry. @param name: value name (C++: const char *) @param subkey: parent key (C++: const char *) @return: success """ return _ida_registry.reg_delete(*args) def reg_subkey_exists(*args): """ reg_subkey_exists(name) -> bool Is there already a key with the given name? @param name (C++: const char *) """ return _ida_registry.reg_subkey_exists(*args) def reg_exists(*args): """ reg_exists(name, subkey=None) -> bool Is there already a value with the given name? @param name: value name (C++: const char *) @param subkey: parent key (C++: const char *) """ return _ida_registry.reg_exists(*args) def reg_read_strlist(*args): """ reg_read_strlist(subkey) Retrieve all string values associated with the given key. Also see 'reg_update_strlist()' . @param subkey (C++: const char *) """ return _ida_registry.reg_read_strlist(*args) def reg_update_strlist(*args): """ reg_update_strlist(subkey, add, maxrecs, rem=None, ignorecase=False) Update list of strings associated with given key. @param subkey: key name (C++: const char *) @param add: string to be added to list, can be NULL (C++: const char *) @param maxrecs: limit list to this size (C++: size_t) @param rem: string to be removed from list, can be NULL (C++: const char *) @param ignorecase: ignore case for 'add' and 'rem' (C++: bool) """ return _ida_registry.reg_update_strlist(*args) def reg_write_string(*args): """ reg_write_string(name, utf8, subkey=None) Write a string to the registry. @param name: value name (C++: const char *) @param utf8: utf8-encoded string (C++: const char *) @param subkey: key name (C++: const char *) """ return _ida_registry.reg_write_string(*args) def reg_read_int(*args): """ reg_read_int(name, defval, subkey=None) -> int Read integer value from the registry. @param name: value name (C++: const char *) @param defval: default value (C++: int) @param subkey: key name (C++: const char *) @return: the value read from the registry, or 'defval' if the read failed """ return _ida_registry.reg_read_int(*args) def reg_write_int(*args): """ reg_write_int(name, value, subkey=None) Write integer value to the registry. @param name: value name (C++: const char *) @param value: value to write (C++: int) @param subkey: key name (C++: const char *) """ return _ida_registry.reg_write_int(*args) def reg_read_bool(*args): """ reg_read_bool(name, defval, subkey=None) -> bool Read boolean value from the registry. @param name: value name (C++: const char *) @param defval: default value (C++: bool) @param subkey: key name (C++: const char *) @return: boolean read from registry, or 'defval' if the read failed """ return _ida_registry.reg_read_bool(*args) def reg_write_bool(*args): """ reg_write_bool(name, value, subkey=None) Write boolean value to the registry. @param name: value name (C++: const char *) @param value: boolean to write (nonzero = true) (C++: int) @param subkey: key name (C++: const char *) """ return _ida_registry.reg_write_bool(*args) def reg_update_filestrlist(*args): """ reg_update_filestrlist(subkey, add, maxrecs, rem=None) Update registry with a file list. Case sensitivity will vary depending on the target OS.'add' and 'rem' must be UTF-8, just like for regular string operations. @param subkey (C++: const char *) @param add (C++: const char *) @param maxrecs (C++: size_t) @param rem (C++: const char *) """ return _ida_registry.reg_update_filestrlist(*args) def reg_load(*args): """ reg_load() """ return _ida_registry.reg_load(*args) def reg_flush(*args): """ reg_flush() """ return _ida_registry.reg_flush(*args)
24.036649
93
0.668591
1,305
9,182
4.472797
0.168582
0.035977
0.059962
0.062361
0.403975
0.34761
0.342128
0.319513
0.277369
0.255439
0
0.004422
0.211936
9,182
381
94
24.099738
0.802239
0.464605
0
0.131148
1
0
0.036583
0
0
0
0
0
0
1
0.237705
false
0.016393
0.098361
0.008197
0.57377
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
3
899724056fb2b8739f84d2aa1ee6f9aa8a2e5970
200
py
Python
apps/laboratorio/models.py
alejandrobolivar/sist_inv_coesbicop
36a068f21adb28f1f711b540841786538dbf8411
[ "CC0-1.0" ]
null
null
null
apps/laboratorio/models.py
alejandrobolivar/sist_inv_coesbicop
36a068f21adb28f1f711b540841786538dbf8411
[ "CC0-1.0" ]
null
null
null
apps/laboratorio/models.py
alejandrobolivar/sist_inv_coesbicop
36a068f21adb28f1f711b540841786538dbf8411
[ "CC0-1.0" ]
null
null
null
from django.db import models # Create your models here. class Laboratorio(models.Model): nombre_lab = models.CharField(max_length=200) def __str__(self): return self.nombre_lab
20
49
0.715
27
200
5.037037
0.777778
0.132353
0
0
0
0
0
0
0
0
0
0.018868
0.205
200
9
50
22.222222
0.836478
0.12
0
0
0
0
0
0
0
0
0
0
0
1
0.2
false
0
0.2
0.2
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
0
1
0
0
0
3
89a4ed1d75f76d13720e469d101c96e50811bd26
2,774
py
Python
behavioral/specification.py
sunminghui81/python-design-pattern
fe6ca6ea1bdba6b43f49452ce99e17d4b2b089bb
[ "Apache-2.0" ]
2
2021-03-07T17:13:49.000Z
2022-03-29T08:55:17.000Z
behavioral/specification.py
sunminghui81/python-design-pattern
fe6ca6ea1bdba6b43f49452ce99e17d4b2b089bb
[ "Apache-2.0" ]
1
2021-06-10T20:17:55.000Z
2021-06-10T20:17:55.000Z
design-patterns/behavioral/specification.py
QuantFinEcon/py-learn
7151f01df9f7f096312e43434fe8026d1d7d7828
[ "Apache-2.0" ]
null
null
null
#!/usr/bin/env python # -*- coding: utf-8 -*- """ @author: Gordeev Andrey <gordeev.and.and@gmail.com> *TL;DR80 Provides recombination business logic by chaining together using boolean logic. """ from abc import abstractmethod class Specification(object): def and_specification(self, candidate): raise NotImplementedError() def or_specification(self, candidate): raise NotImplementedError() def not_specification(self): raise NotImplementedError() @abstractmethod def is_satisfied_by(self, candidate): pass class CompositeSpecification(Specification): @abstractmethod def is_satisfied_by(self, candidate): pass def and_specification(self, candidate): return AndSpecification(self, candidate) def or_specification(self, candidate): return OrSpecification(self, candidate) def not_specification(self): return NotSpecification(self) class AndSpecification(CompositeSpecification): _one = Specification() _other = Specification() def __init__(self, one, other): self._one = one self._other = other def is_satisfied_by(self, candidate): return bool(self._one.is_satisfied_by(candidate) and self._other.is_satisfied_by(candidate)) class OrSpecification(CompositeSpecification): _one = Specification() _other = Specification() def __init__(self, one, other): self._one = one self._other = other def is_satisfied_by(self, candidate): return bool(self._one.is_satisfied_by(candidate) or self._other.is_satisfied_by(candidate)) class NotSpecification(CompositeSpecification): _wrapped = Specification() def __init__(self, wrapped): self._wrapped = wrapped def is_satisfied_by(self, candidate): return bool(not self._wrapped.is_satisfied_by(candidate)) class User(object): def __init__(self, super_user=False): self.super_user = super_user class UserSpecification(CompositeSpecification): def is_satisfied_by(self, candidate): return isinstance(candidate, User) class SuperUserSpecification(CompositeSpecification): def is_satisfied_by(self, candidate): return getattr(candidate, 'super_user', False) if __name__ == '__main__': print('Specification') andrey = User() ivan = User(super_user=True) vasiliy = 'not User instance' root_specification = UserSpecification().\ and_specification(SuperUserSpecification()) print(root_specification.is_satisfied_by(andrey)) print(root_specification.is_satisfied_by(ivan)) print(root_specification.is_satisfied_by(vasiliy)) ### OUTPUT ### # Specification # False # True # False
23.310924
79
0.703317
293
2,774
6.368601
0.232082
0.088424
0.104502
0.060021
0.515541
0.463023
0.349946
0.311361
0.178993
0.178993
0
0.00136
0.204758
2,774
118
80
23.508475
0.844515
0.080389
0
0.5
0
0
0.018957
0
0
0
0
0
0
1
0.265625
false
0.03125
0.015625
0.125
0.609375
0.0625
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
0
0
3
89b3faa5bf50a7571fa4fe8fed0ab830eff0faf2
438
py
Python
mom/models/res_config.py
freezmeinster/odoome_project
f90b3a6c30453b1075200f22c0aa7efcb2c8e9b5
[ "BSD-3-Clause" ]
null
null
null
mom/models/res_config.py
freezmeinster/odoome_project
f90b3a6c30453b1075200f22c0aa7efcb2c8e9b5
[ "BSD-3-Clause" ]
null
null
null
mom/models/res_config.py
freezmeinster/odoome_project
f90b3a6c30453b1075200f22c0aa7efcb2c8e9b5
[ "BSD-3-Clause" ]
null
null
null
from odoo import api, exceptions, fields, models, _ # class MedinesiaInit(models.TransientModel): # _name = "medinesia.init" # _columns = {} # _defaults = {} # @api.model # def _init_settings(self): # config = self.env['res.config.settings'].create({}) # config.group_stock_multi_warehouses = True # config.group_stock_multi_locations = True # config.execute() # return True
27.375
61
0.630137
45
438
5.866667
0.688889
0.083333
0.121212
0.159091
0
0
0
0
0
0
0
0
0.246575
438
15
62
29.2
0.8
0.821918
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
0
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
3
89ba83ff6545e409db5512ffcbd3f31f69799f4c
257
py
Python
connect/config.py
slaurianodev/msgraph
617e5e7d890a06757ef38871d9ddecfac2852c84
[ "MIT" ]
null
null
null
connect/config.py
slaurianodev/msgraph
617e5e7d890a06757ef38871d9ddecfac2852c84
[ "MIT" ]
null
null
null
connect/config.py
slaurianodev/msgraph
617e5e7d890a06757ef38871d9ddecfac2852c84
[ "MIT" ]
null
null
null
# Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. # See LICENSE in the project root for license information. # Client ID and secret. client_id = '07c53e00-1adb-4fa7-8933-fd98f6a4da84' client_secret = '7CmTo1brGWMmh5RoFiTdO0n'
36.714286
79
0.789883
34
257
5.911765
0.794118
0.079602
0
0
0
0
0
0
0
0
0
0.103139
0.132296
257
6
80
42.833333
0.798206
0.607004
0
0
0
0
0.608247
0.608247
0
0
0
0
0
1
0
false
0
0
0
0
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
1
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
9822b09b36b1a534e5143628052e043ed403a7c2
1,001
py
Python
multichaindb/backend/localarangodb/__init__.py
mamaeo/multichaindb
7791f5fc935be40482f101b6cba3000d065ee136
[ "CC-BY-3.0", "CC0-1.0", "CC-BY-4.0" ]
null
null
null
multichaindb/backend/localarangodb/__init__.py
mamaeo/multichaindb
7791f5fc935be40482f101b6cba3000d065ee136
[ "CC-BY-3.0", "CC0-1.0", "CC-BY-4.0" ]
null
null
null
multichaindb/backend/localarangodb/__init__.py
mamaeo/multichaindb
7791f5fc935be40482f101b6cba3000d065ee136
[ "CC-BY-3.0", "CC0-1.0", "CC-BY-4.0" ]
null
null
null
"""ArangoDB backend implementation. Contains a ArangoDB-specific implementation of the :mod:`~multichaindb.backend.schema` and :mod:`~multichaindb.backend.query` interfaces. You can specify MultiChainDB to use ArangoDB as its database backend by either setting ``database.backend`` to ``'localarangodb'`` in your configuration file, or setting the ``MULTICHAINDB_DATABASE_BACKEND`` environment variable to ``'localarangodb'``. ArangoDB is the default database backend for MultiChainDB. If configured to use ArangoDB, MultiChainDB will automatically return instances of :class:`~multichain.backend.localarangodb.LocalArangoDBConnection` for :func:`~multichaindb.backend.connection.connect` and dispatch calls of the generic backend interfaces to the implementations in this module. """ # Register the single dispatched modules on import. from multichaindb.backend.localarangodb import schema, query # noqa # ArangoDBConnection should always be accessed via # ``multichaindb.backend.connect()``.
40.04
86
0.808192
120
1,001
6.725
0.566667
0.11772
0.054523
0
0
0
0
0
0
0
0
0
0.10989
1,001
24
87
41.708333
0.905724
0.921079
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
0
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
0
0
0
3
9829a41a4e9e0f70aac31015fd00c128d562b553
916
py
Python
simple_rl/utils/additional_datastructures.py
KorlaMarch/simple_rl
30086b5cf4fd3e9dee76ddfb5ae4f565593ce191
[ "Apache-2.0" ]
2
2020-02-13T22:37:31.000Z
2021-02-03T02:35:42.000Z
simple_rl/utils/additional_datastructures.py
samlobel/simple_rl_mbrl
ed868916d06dbf68f4af23bea83b0e852e88df6e
[ "Apache-2.0" ]
null
null
null
simple_rl/utils/additional_datastructures.py
samlobel/simple_rl_mbrl
ed868916d06dbf68f4af23bea83b0e852e88df6e
[ "Apache-2.0" ]
null
null
null
''' additional_datastructures.py: File containing custom utility data structures for use in simple_rl. ''' class SimpleRLStack(object): ''' Implementation for a basic Stack data structure ''' def __init__(self, _list=None): ''' Args: _list (list) : underlying elements in the stack ''' self._list = _list if _list is not None else [] def __repr__(self): r = '' for element in self._list: r += str(element) + ', ' return r def push(self, element): return self._list.append(element) def pop(self): if len(self._list) > 0: return self._list.pop() return None def peek(self): if len(self._list) > 0: return self._list[-1] return None def is_empty(self): return len(self._list) == 0 def size(self): return len(self._list)
25.444444
106
0.565502
113
916
4.371681
0.433628
0.161943
0.089069
0.072874
0.214575
0.129555
0.129555
0.129555
0.129555
0
0
0.006483
0.326419
916
35
107
26.171429
0.794165
0.223799
0
0.181818
0
0
0.003003
0
0
0
0
0
0
1
0.318182
false
0
0
0.136364
0.727273
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
0
0
0
1
1
0
0
3
982c606f3b18ad8f846b88dad7f1481eddbf1c79
18,323
py
Python
ecotaxa_py_client/api/samples_api.py
ecotaxa/ecotaxa_py_client
956e80a9eaa989679b8d5a108a466013c69ca08f
[ "RSA-MD" ]
1
2022-03-01T01:56:42.000Z
2022-03-01T01:56:42.000Z
ecotaxa_py_client/api/samples_api.py
ecotaxa/ecotaxa_py_client
956e80a9eaa989679b8d5a108a466013c69ca08f
[ "RSA-MD" ]
3
2021-12-23T04:48:50.000Z
2022-01-18T14:01:50.000Z
ecotaxa_py_client/api/samples_api.py
ecotaxa/ecotaxa_py_client
956e80a9eaa989679b8d5a108a466013c69ca08f
[ "RSA-MD" ]
null
null
null
""" EcoTaxa No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 The version of the OpenAPI document: 0.0.28 Generated by: https://openapi-generator.tech """ import re # noqa: F401 import sys # noqa: F401 from ecotaxa_py_client.api_client import ApiClient, Endpoint as _Endpoint from ecotaxa_py_client.model_utils import ( # noqa: F401 check_allowed_values, check_validations, date, datetime, file_type, none_type, validate_and_convert_types ) from ecotaxa_py_client.model.bulk_update_req import BulkUpdateReq from ecotaxa_py_client.model.http_validation_error import HTTPValidationError from ecotaxa_py_client.model.sample_model import SampleModel from ecotaxa_py_client.model.sample_taxo_stats_model import SampleTaxoStatsModel class SamplesApi(object): """NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech Do not edit the class manually. """ def __init__(self, api_client=None): if api_client is None: api_client = ApiClient() self.api_client = api_client self.sample_query_endpoint = _Endpoint( settings={ 'response_type': (SampleModel,), 'auth': [ 'BearerOrCookieAuth' ], 'endpoint_path': '/sample/{sample_id}', 'operation_id': 'sample_query', 'http_method': 'GET', 'servers': None, }, params_map={ 'all': [ 'sample_id', ], 'required': [ 'sample_id', ], 'nullable': [ ], 'enum': [ ], 'validation': [ ] }, root_map={ 'validations': { }, 'allowed_values': { }, 'openapi_types': { 'sample_id': (int,), }, 'attribute_map': { 'sample_id': 'sample_id', }, 'location_map': { 'sample_id': 'path', }, 'collection_format_map': { } }, headers_map={ 'accept': [ 'application/json' ], 'content_type': [], }, api_client=api_client ) self.sample_set_get_stats_endpoint = _Endpoint( settings={ 'response_type': ([SampleTaxoStatsModel],), 'auth': [ 'BearerOrCookieAuth' ], 'endpoint_path': '/sample_set/taxo_stats', 'operation_id': 'sample_set_get_stats', 'http_method': 'GET', 'servers': None, }, params_map={ 'all': [ 'sample_ids', ], 'required': [ 'sample_ids', ], 'nullable': [ ], 'enum': [ ], 'validation': [ ] }, root_map={ 'validations': { }, 'allowed_values': { }, 'openapi_types': { 'sample_ids': (str,), }, 'attribute_map': { 'sample_ids': 'sample_ids', }, 'location_map': { 'sample_ids': 'query', }, 'collection_format_map': { } }, headers_map={ 'accept': [ 'application/json' ], 'content_type': [], }, api_client=api_client ) self.samples_search_endpoint = _Endpoint( settings={ 'response_type': ([SampleModel],), 'auth': [ 'BearerOrCookieAuth' ], 'endpoint_path': '/samples/search', 'operation_id': 'samples_search', 'http_method': 'GET', 'servers': None, }, params_map={ 'all': [ 'project_ids', 'id_pattern', ], 'required': [ 'project_ids', 'id_pattern', ], 'nullable': [ ], 'enum': [ ], 'validation': [ ] }, root_map={ 'validations': { }, 'allowed_values': { }, 'openapi_types': { 'project_ids': (str,), 'id_pattern': (str,), }, 'attribute_map': { 'project_ids': 'project_ids', 'id_pattern': 'id_pattern', }, 'location_map': { 'project_ids': 'query', 'id_pattern': 'query', }, 'collection_format_map': { } }, headers_map={ 'accept': [ 'application/json' ], 'content_type': [], }, api_client=api_client ) self.update_samples_endpoint = _Endpoint( settings={ 'response_type': (int,), 'auth': [ 'BearerOrCookieAuth' ], 'endpoint_path': '/sample_set/update', 'operation_id': 'update_samples', 'http_method': 'POST', 'servers': None, }, params_map={ 'all': [ 'bulk_update_req', ], 'required': [ 'bulk_update_req', ], 'nullable': [ ], 'enum': [ ], 'validation': [ ] }, root_map={ 'validations': { }, 'allowed_values': { }, 'openapi_types': { 'bulk_update_req': (BulkUpdateReq,), }, 'attribute_map': { }, 'location_map': { 'bulk_update_req': 'body', }, 'collection_format_map': { } }, headers_map={ 'accept': [ 'application/json' ], 'content_type': [ 'application/json' ] }, api_client=api_client ) def sample_query( self, sample_id, **kwargs ): """Sample Query # noqa: E501 Returns **information about the sample** corresponding to the given id. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.sample_query(sample_id, async_req=True) >>> result = thread.get() Args: sample_id (int): Internal, the unique numeric id of this sample. Keyword Args: _return_http_data_only (bool): response data without head status code and headers. Default is True. _preload_content (bool): if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. _request_timeout (int/float/tuple): timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. Default is None. _check_input_type (bool): specifies if type checking should be done one the data sent to the server. Default is True. _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. async_req (bool): execute request asynchronously Returns: SampleModel If the method is called asynchronously, returns the request thread. """ kwargs['async_req'] = kwargs.get( 'async_req', False ) kwargs['_return_http_data_only'] = kwargs.get( '_return_http_data_only', True ) kwargs['_preload_content'] = kwargs.get( '_preload_content', True ) kwargs['_request_timeout'] = kwargs.get( '_request_timeout', None ) kwargs['_check_input_type'] = kwargs.get( '_check_input_type', True ) kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) kwargs['_host_index'] = kwargs.get('_host_index') kwargs['sample_id'] = \ sample_id return self.sample_query_endpoint.call_with_http_info(**kwargs) def sample_set_get_stats( self, sample_ids, **kwargs ): """Sample Set Get Stats # noqa: E501 Returns **classification statistics** for each sample of the given list. One block of stats is returned for each input ID. EXPECT A SLOW RESPONSE : No cache of such information anywhere. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.sample_set_get_stats(sample_ids, async_req=True) >>> result = thread.get() Args: sample_ids (str): String containing the list of one or more sample ids separated by non-num char. Keyword Args: _return_http_data_only (bool): response data without head status code and headers. Default is True. _preload_content (bool): if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. _request_timeout (int/float/tuple): timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. Default is None. _check_input_type (bool): specifies if type checking should be done one the data sent to the server. Default is True. _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. async_req (bool): execute request asynchronously Returns: [SampleTaxoStatsModel] If the method is called asynchronously, returns the request thread. """ kwargs['async_req'] = kwargs.get( 'async_req', False ) kwargs['_return_http_data_only'] = kwargs.get( '_return_http_data_only', True ) kwargs['_preload_content'] = kwargs.get( '_preload_content', True ) kwargs['_request_timeout'] = kwargs.get( '_request_timeout', None ) kwargs['_check_input_type'] = kwargs.get( '_check_input_type', True ) kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) kwargs['_host_index'] = kwargs.get('_host_index') kwargs['sample_ids'] = \ sample_ids return self.sample_set_get_stats_endpoint.call_with_http_info(**kwargs) def samples_search( self, project_ids, id_pattern, **kwargs ): """Samples Search # noqa: E501 **Search for samples.** # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.samples_search(project_ids, id_pattern, async_req=True) >>> result = thread.get() Args: project_ids (str): String containing the list of one or more project id separated by non-num char. id_pattern (str): Sample id textual pattern. Use * or '' for 'any matches'. Match is case-insensitive. Keyword Args: _return_http_data_only (bool): response data without head status code and headers. Default is True. _preload_content (bool): if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. _request_timeout (int/float/tuple): timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. Default is None. _check_input_type (bool): specifies if type checking should be done one the data sent to the server. Default is True. _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. async_req (bool): execute request asynchronously Returns: [SampleModel] If the method is called asynchronously, returns the request thread. """ kwargs['async_req'] = kwargs.get( 'async_req', False ) kwargs['_return_http_data_only'] = kwargs.get( '_return_http_data_only', True ) kwargs['_preload_content'] = kwargs.get( '_preload_content', True ) kwargs['_request_timeout'] = kwargs.get( '_request_timeout', None ) kwargs['_check_input_type'] = kwargs.get( '_check_input_type', True ) kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) kwargs['_host_index'] = kwargs.get('_host_index') kwargs['project_ids'] = \ project_ids kwargs['id_pattern'] = \ id_pattern return self.samples_search_endpoint.call_with_http_info(**kwargs) def update_samples( self, bulk_update_req, **kwargs ): """Update Samples # noqa: E501 Do the required **update for each sample in the set.** Any non-null field in the model is written to every impacted sample. **Returns the number of updated entities.** # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.update_samples(bulk_update_req, async_req=True) >>> result = thread.get() Args: bulk_update_req (BulkUpdateReq): Keyword Args: _return_http_data_only (bool): response data without head status code and headers. Default is True. _preload_content (bool): if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. _request_timeout (int/float/tuple): timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. Default is None. _check_input_type (bool): specifies if type checking should be done one the data sent to the server. Default is True. _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. async_req (bool): execute request asynchronously Returns: int If the method is called asynchronously, returns the request thread. """ kwargs['async_req'] = kwargs.get( 'async_req', False ) kwargs['_return_http_data_only'] = kwargs.get( '_return_http_data_only', True ) kwargs['_preload_content'] = kwargs.get( '_preload_content', True ) kwargs['_request_timeout'] = kwargs.get( '_request_timeout', None ) kwargs['_check_input_type'] = kwargs.get( '_check_input_type', True ) kwargs['_check_return_type'] = kwargs.get( '_check_return_type', True ) kwargs['_host_index'] = kwargs.get('_host_index') kwargs['bulk_update_req'] = \ bulk_update_req return self.update_samples_endpoint.call_with_http_info(**kwargs)
35.168906
209
0.503356
1,728
18,323
5.085069
0.12963
0.028679
0.023671
0.024582
0.73108
0.707522
0.679071
0.660749
0.64823
0.638671
0
0.004089
0.412705
18,323
520
210
35.236538
0.812471
0.368499
0
0.559767
1
0
0.222445
0.026934
0
0
0
0
0
1
0.014577
false
0
0.023324
0
0.052478
0
0
0
0
null
0
0
0
0
1
0
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
3
982ca7a7da85e984cb991ddecf539eb616248a03
260
py
Python
hyrodactil/tests/public/test_models.py
hizardapp/Hizard
a275a1a9ca45fddefc146421c7d53e080426cd36
[ "MIT" ]
1
2017-12-03T23:58:34.000Z
2017-12-03T23:58:34.000Z
hyrodactil/tests/public/test_models.py
hizardapp/Hizard
a275a1a9ca45fddefc146421c7d53e080426cd36
[ "MIT" ]
null
null
null
hyrodactil/tests/public/test_models.py
hizardapp/Hizard
a275a1a9ca45fddefc146421c7d53e080426cd36
[ "MIT" ]
1
2018-07-15T19:03:38.000Z
2018-07-15T19:03:38.000Z
from django.test import TestCase from ..factories._public import InterestFactory class PublicModelsTests(TestCase): def test_interest_unicode(self): interest = InterestFactory.build() self.assertEqual(unicode(interest), interest.email)
23.636364
59
0.761538
27
260
7.222222
0.62963
0
0
0
0
0
0
0
0
0
0
0
0.157692
260
10
60
26
0.890411
0
0
0
0
0
0
0
0
0
0
0
0.166667
1
0.166667
false
0
0.333333
0
0.666667
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
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
3
983385fcd2a5519a61fc3601017bfcb0024cbdfc
290
py
Python
jd/api/rest/KplOpenSearchAssociationalWordRequest.py
fengjinqi/linjuanbang
8cdc4e81df73ccd737ac547da7f2c7dca545862a
[ "MIT" ]
5
2019-10-30T01:16:30.000Z
2020-06-14T03:32:19.000Z
jd/api/rest/KplOpenSearchAssociationalWordRequest.py
fengjinqi/linjuanbang
8cdc4e81df73ccd737ac547da7f2c7dca545862a
[ "MIT" ]
2
2020-10-12T07:12:48.000Z
2021-06-02T03:15:47.000Z
jd/api/rest/KplOpenSearchAssociationalWordRequest.py
fengjinqi/linjuanbang
8cdc4e81df73ccd737ac547da7f2c7dca545862a
[ "MIT" ]
3
2019-12-06T17:33:49.000Z
2021-03-01T13:24:22.000Z
from jd.api.base import RestApi class KplOpenSearchAssociationalWordRequest(RestApi): def __init__(self,domain='gw.api.360buy.com',port=80): RestApi.__init__(self,domain, port) self.mapResuest = None def getapiname(self): return 'jd.kpl.open.search.associational.word'
18.125
56
0.751724
37
290
5.675676
0.702703
0.07619
0.133333
0
0
0
0
0
0
0
0
0.019841
0.131034
290
15
57
19.333333
0.813492
0
0
0
0
0
0.190141
0.130282
0
0
0
0
0
1
0.285714
false
0
0.142857
0.142857
0.714286
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
0
0
0
1
1
0
0
3
9834b1e1cb96302f675db7672e94ceff82e4ac12
44
py
Python
tuple.py
Srinivassan-Ramamurthy/python_programs
53b390669c7e88532c67d80b758a9199d6fde8cf
[ "bzip2-1.0.6" ]
null
null
null
tuple.py
Srinivassan-Ramamurthy/python_programs
53b390669c7e88532c67d80b758a9199d6fde8cf
[ "bzip2-1.0.6" ]
null
null
null
tuple.py
Srinivassan-Ramamurthy/python_programs
53b390669c7e88532c67d80b758a9199d6fde8cf
[ "bzip2-1.0.6" ]
null
null
null
a=('name','srini') for i in a: print(i)
11
18
0.522727
9
44
2.555556
0.777778
0
0
0
0
0
0
0
0
0
0
0
0.227273
44
3
19
14.666667
0.676471
0
0
0
0
0
0.204545
0
0
0
0
0
0
1
0
false
0
0
0
0
0.333333
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
0
0
0
0
0
3
984239105b89f06bdfbf4efad1f60b6d606cd25f
1,779
py
Python
python/ray/tune/stopper.py
vermashresth/ray
9aaaa508cacb90a5be714478970b2191aaa43170
[ "Apache-2.0" ]
4
2019-10-18T17:44:58.000Z
2021-04-14T14:37:21.000Z
python/ray/tune/stopper.py
vermashresth/ray
9aaaa508cacb90a5be714478970b2191aaa43170
[ "Apache-2.0" ]
3
2021-06-08T21:46:35.000Z
2022-03-12T00:35:21.000Z
python/ray/tune/stopper.py
vermashresth/ray
9aaaa508cacb90a5be714478970b2191aaa43170
[ "Apache-2.0" ]
1
2020-06-26T07:54:25.000Z
2020-06-26T07:54:25.000Z
class Stopper: """Base class for implementing a Tune experiment stopper. Allows users to implement experiment-level stopping via ``stop_all``. By default, this class does not stop any trials. Subclasses need to implement ``__call__`` and ``stop_all``. .. code-block:: python import time from ray import tune from ray.tune import Stopper class TimeStopper(Stopper): def __init__(self): self._start = time.time() self._deadline = 300 def __call__(self, trial_id, result): return False def stop_all(self): return time.time() - self._start > self.deadline tune.run(Trainable, num_samples=200, stop=TimeStopper()) """ def __call__(self, trial_id, result): """Returns true if the trial should be terminated given the result.""" raise NotImplementedError def stop_all(self): """Returns true if the experiment should be terminated.""" raise NotImplementedError class NoopStopper(Stopper): def __call__(self, trial_id, result): return False def stop_all(self): return False class FunctionStopper(Stopper): def __init__(self, function): self._fn = function def __call__(self, trial_id, result): return self._fn(trial_id, result) def stop_all(self): return False @classmethod def is_valid_function(cls, fn): is_function = callable(fn) and not issubclass(type(fn), Stopper) if is_function and hasattr(fn, "stop_all"): raise ValueError( "Stop object must be ray.tune.Stopper subclass to be detected " "correctly.") return is_function
27.796875
79
0.621135
211
1,779
4.995261
0.379147
0.04649
0.06167
0.060721
0.184061
0.184061
0.132827
0.104364
0.104364
0.104364
0
0.004781
0.294548
1,779
63
80
28.238095
0.83506
0.453626
0
0.44
0
0
0.089165
0
0
0
0
0
0
1
0.32
false
0
0
0.16
0.64
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
0
0
0
1
1
0
0
3
9844f81f828c61087f4598f2d6642f89f78efce9
2,048
py
Python
cvxpy_tinoco/functions/__init__.py
EnjoyLifeFund/macHighSierra-py36-pkgs
5668b5785296b314ea1321057420bcd077dba9ea
[ "BSD-3-Clause", "BSD-2-Clause", "MIT" ]
null
null
null
cvxpy_tinoco/functions/__init__.py
EnjoyLifeFund/macHighSierra-py36-pkgs
5668b5785296b314ea1321057420bcd077dba9ea
[ "BSD-3-Clause", "BSD-2-Clause", "MIT" ]
null
null
null
cvxpy_tinoco/functions/__init__.py
EnjoyLifeFund/macHighSierra-py36-pkgs
5668b5785296b314ea1321057420bcd077dba9ea
[ "BSD-3-Clause", "BSD-2-Clause", "MIT" ]
null
null
null
#***********************************************************************# # Copyright (C) 2010-2012 Tomas Tinoco De Rubira # # # # This file is part of CVXPY # # # # CVXPY is free software: you can redistribute it and/or modify # # it under the terms of the GNU General Public License as published by # # the Free Software Foundation, either version 3 of the License, or # # (at your option) any later version. # # # # CVXPY is distributed in the hope that it will be useful, # # but WITHOUT ANY WARRANTY; without even the implied warranty of # # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # # GNU General Public License for more details. # # # # You should have received a copy of the GNU General Public License # # along with this program. If not, see <http://www.gnu.org/licenses/>. # #***********************************************************************# from .abs import abs from .det_rootn import det_rootn from .exp import exp from .geo_mean import geo_mean from .huber import huber from .kl_div import kl_div from .lambda_max import lambda_max from .lambda_min import lambda_min from .log import log from .log_norm_cdf import log_norm_cdf from .log_sum_exp import log_sum_exp from .max import max from .min import min from .norm1 import norm1 from .norm2 import norm2 from .norm_inf import norm_inf from .nuclear_norm import nuclear_norm from .power_abs import power_abs from .power_p import power_p from .power_pos import power_pos from .quad_form import quad_form from .quad_over_lin import quad_over_lin from .sqrt import sqrt from .square import square
46.545455
78
0.545898
246
2,048
4.406504
0.434959
0.013838
0.035978
0.052583
0.075646
0.051661
0
0
0
0
0
0.009658
0.342773
2,048
43
79
47.627907
0.795691
0.628418
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
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
3
9864cde026fc1d1db03c82d279253e859dfbef35
396
py
Python
tests/unit/test_factory/conftest.py
adamlwgriffiths/vue.py
f4256454256ddfe54a8be6dea493d3fc915ef1a2
[ "MIT" ]
274
2018-07-07T00:57:17.000Z
2022-03-22T23:49:53.000Z
tests/unit/test_factory/conftest.py
adamlwgriffiths/vue.py
f4256454256ddfe54a8be6dea493d3fc915ef1a2
[ "MIT" ]
25
2018-11-24T17:19:44.000Z
2022-03-23T22:30:18.000Z
tests/unit/test_factory/conftest.py
adamlwgriffiths/vue.py
f4256454256ddfe54a8be6dea493d3fc915ef1a2
[ "MIT" ]
18
2019-07-04T07:18:18.000Z
2022-03-22T23:49:55.000Z
from unittest import mock from vue.bridge.list import window as list_window import pytest class ArrayMock(list): def __new__(cls, *args): return list(args) @staticmethod def isArray(obj): return isinstance(obj, list) @pytest.fixture(scope="module", autouse=True) def window_object(): with mock.patch.object(list_window, "Array", new=ArrayMock): yield
20.842105
64
0.69697
52
396
5.173077
0.596154
0.074349
0
0
0
0
0
0
0
0
0
0
0.199495
396
18
65
22
0.84858
0
0
0
0
0
0.027778
0
0
0
0
0
0
1
0.230769
false
0
0.230769
0.153846
0.692308
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
0
0
0
1
1
0
0
3
98725e3785ff67f89c25bf89741eab1082a1b0a2
485
py
Python
spoopy/refactored/preprocessing/property/illumination_extractor.py
rodrigobressan/PADify
362db2b3a33793ac53f938e89f90a6ecdf778e89
[ "MIT" ]
12
2019-11-26T07:44:08.000Z
2021-03-03T09:51:43.000Z
spoopy/refactored/preprocessing/property/illumination_extractor.py
rodrigobressan/PADify
362db2b3a33793ac53f938e89f90a6ecdf778e89
[ "MIT" ]
13
2020-01-28T22:09:41.000Z
2022-03-11T23:43:37.000Z
spoopy/refactored/preprocessing/property/illumination_extractor.py
rodrigobressan/PADify
362db2b3a33793ac53f938e89f90a6ecdf778e89
[ "MIT" ]
5
2020-01-02T09:52:42.000Z
2022-02-21T15:45:23.000Z
from refactored.preprocessing.property.property_extractor import PropertyExtractor from tools.depth import monodepth_simple from tools.vole import predict_illuminant class IlluminationExtractor(PropertyExtractor): def extract_from_folder(self, frames_path, output_path): predict_illuminant.predict_illuminant(frames_path, output_path) def get_property_alias(self) -> str: return "illumination" def get_frame_extension(self) -> str: return "png"
32.333333
82
0.787629
56
485
6.553571
0.553571
0.138965
0.087193
0.108992
0
0
0
0
0
0
0
0
0.148454
485
14
83
34.642857
0.88862
0
0
0
0
0
0.030928
0
0
0
0
0
0
1
0.3
false
0
0.3
0.2
0.9
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
0
0
0
1
1
0
0
3
98738a6f71e5b8231ca55a5c07bb3de387f961f1
412
py
Python
examples/sink_example.py
izi-global/izir
d1a4bfb5c082c3de1956402ef0280564014a3bd8
[ "MIT" ]
null
null
null
examples/sink_example.py
izi-global/izir
d1a4bfb5c082c3de1956402ef0280564014a3bd8
[ "MIT" ]
5
2021-03-18T21:01:05.000Z
2022-03-11T23:29:48.000Z
examples/sink_example.py
izi-global/izir
d1a4bfb5c082c3de1956402ef0280564014a3bd8
[ "MIT" ]
null
null
null
"""This is an example of a izi "sink", these enable all request URLs that start with the one defined to be captured To try this out, run this api with izi -f sink_example.py and hit any URL after localhost:8000/all/ (for example: localhost:8000/all/the/things/) and it will return the path sans the base URL. """ import izi @izi.sink('/all') def my_sink(request): return request.path.replace('/all', '')
34.333333
115
0.725728
74
412
4.013514
0.635135
0.047138
0.107744
0
0
0
0
0
0
0
0
0.023324
0.167476
412
11
116
37.454545
0.842566
0.742718
0
0
0
0
0.081633
0
0
0
0
0
0
1
0.25
false
0
0.25
0.25
0.75
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
0
0
0
1
1
0
0
3
9895cb875df69552a7b7ea5470c59d7f47b7e3d5
123
py
Python
bot/config.py
connor-ford/random-discord-bot
909cb0564f64891afe25aeb4dc0c40728f77648a
[ "MIT" ]
null
null
null
bot/config.py
connor-ford/random-discord-bot
909cb0564f64891afe25aeb4dc0c40728f77648a
[ "MIT" ]
null
null
null
bot/config.py
connor-ford/random-discord-bot
909cb0564f64891afe25aeb4dc0c40728f77648a
[ "MIT" ]
null
null
null
TOKEN = "<Your Bot Token Here>" LOG_LEVEL_STDOUT = "DEBUG" # Console log level LOG_LEVEL_FILE = "INFO" # File log level
24.6
47
0.707317
19
123
4.368421
0.578947
0.385542
0
0
0
0
0
0
0
0
0
0
0.186992
123
4
48
30.75
0.83
0.260163
0
0
0
0
0.340909
0
0
0
0
0
0
1
0
false
0
0
0
0
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
0
0
0
3
9897a187d99feed1e79a731dcb71750bbe8775f1
236
py
Python
librarybuddy/UserManager/apps.py
op3ntrap/mylibrary
2c053d9af89e8f16a2bd7c612a3405d4774844c6
[ "MIT" ]
null
null
null
librarybuddy/UserManager/apps.py
op3ntrap/mylibrary
2c053d9af89e8f16a2bd7c612a3405d4774844c6
[ "MIT" ]
null
null
null
librarybuddy/UserManager/apps.py
op3ntrap/mylibrary
2c053d9af89e8f16a2bd7c612a3405d4774844c6
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.apps import AppConfig class UserManagerConfig(AppConfig): name = 'UserManager' icon = '<i class="material-icons">&#xE8F9;</i>' # User Material Icon
23.6
73
0.70339
28
236
5.75
0.75
0
0
0
0
0
0
0
0
0
0
0.015152
0.161017
236
9
74
26.222222
0.79798
0.169492
0
0
0
0
0.253886
0.181347
0
0
0
0
0
1
0
false
0
0.4
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
0
0
0
3
9897f93afcb461adc53a26ee240170eadbeac829
237
py
Python
geneticml/__init__.py
DeepsMoseli/geneticml
175728c86916a6d134cb79d436ec4a5fd554eab1
[ "MIT" ]
null
null
null
geneticml/__init__.py
DeepsMoseli/geneticml
175728c86916a6d134cb79d436ec4a5fd554eab1
[ "MIT" ]
null
null
null
geneticml/__init__.py
DeepsMoseli/geneticml
175728c86916a6d134cb79d436ec4a5fd554eab1
[ "MIT" ]
null
null
null
import numpy as np import pandas as pd from sklearn import model_selection from sklearn.metrics import accuracy_score, roc_auc_score, mean_squared_error def Main(): print("Welcome to geneticml!") if __name__=="__main__": Main()
23.7
77
0.776371
35
237
4.857143
0.742857
0.129412
0
0
0
0
0
0
0
0
0
0
0.147679
237
10
78
23.7
0.841584
0
0
0
0
0
0.121849
0
0
0
0
0
0
1
0.125
true
0
0.5
0
0.625
0.125
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
0
1
0
1
0
1
0
0
3
989bbd9b097f3943c5eb7aa45d6c96e5cd8127fc
1,010
py
Python
07. Encapsulation - Lab/02_email_validator.py
elenaborisova/Python-OOP
584882c08f84045b12322917f0716c7c7bd9befc
[ "MIT" ]
1
2021-03-27T16:56:30.000Z
2021-03-27T16:56:30.000Z
07. Encapsulation - Lab/02_email_validator.py
elenaborisova/Python-OOP
584882c08f84045b12322917f0716c7c7bd9befc
[ "MIT" ]
null
null
null
07. Encapsulation - Lab/02_email_validator.py
elenaborisova/Python-OOP
584882c08f84045b12322917f0716c7c7bd9befc
[ "MIT" ]
1
2021-03-15T14:50:39.000Z
2021-03-15T14:50:39.000Z
import re class EmailValidator: def __init__(self, min_length: int, mails: list, domains: list): self.min_length = min_length self.mails = set(mails) self.domains = set(domains) def __validate_name(self, name: str): return len(name) >= self.min_length def __validate_mail(self, mail: str): return mail in self.mails def __validate_domain(self, domain: str): return domain in self.domains def validate(self, email: str): (name, mail, domain) = re.split(r"[@.]", email) return self.__validate_name(name) \ and self.__validate_mail(mail) \ and self.__validate_domain(domain) mails = ["gmail", "softuni"] domains = ["com", "bg"] email_validator = EmailValidator(6, mails, domains) print(email_validator.validate("pe77er@gmail.com")) print(email_validator.validate("georgios@gmail.net")) print(email_validator.validate("stamatito@abv.net")) print(email_validator.validate("abv@softuni.bg"))
28.857143
68
0.669307
128
1,010
5.039063
0.296875
0.108527
0.117829
0.167442
0.093023
0
0
0
0
0
0
0.003722
0.20198
1,010
34
69
29.705882
0.796526
0
0
0
0
0
0.085149
0
0
0
0
0
0
1
0.208333
false
0
0.041667
0.125
0.458333
0.166667
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
0
0
0
3
98a3c82a147f2b40c617f8032171517da038570f
783
py
Python
trydjango_1/Blog/views.py
KumarPython/Django-Projects
f69550debbd0850b4160f8b52d846c8c7e76c988
[ "MIT" ]
null
null
null
trydjango_1/Blog/views.py
KumarPython/Django-Projects
f69550debbd0850b4160f8b52d846c8c7e76c988
[ "MIT" ]
null
null
null
trydjango_1/Blog/views.py
KumarPython/Django-Projects
f69550debbd0850b4160f8b52d846c8c7e76c988
[ "MIT" ]
null
null
null
from django.shortcuts import render from .models import Article from .form import ArticleForm from django.views.generic import ListView,DetailView,CreateView,UpdateView,DeleteView class ArticleListView(ListView): queryset = Article.objects.all() class ArticleDetailView(DetailView): queryset = Article.objects.all() class ArticleCreateView(CreateView): queryset = Article.objects.all() form_class = ArticleForm template_name = 'Blog/article_create.html' class ArticleUpdateView(UpdateView): queryset = Article.objects.all() form_class = ArticleForm template_name = 'Blog/article_update.html' class ArticleDeleteView(DeleteView): queryset = Article.objects.all() template_name = 'Blog/article_delete.html' success_url = '/blog/'
24.46875
85
0.763729
85
783
6.929412
0.4
0.127334
0.186757
0.212224
0.332767
0.2309
0.2309
0.2309
0.2309
0.2309
0
0
0.145594
783
31
86
25.258065
0.880419
0
0
0.35
0
0
0.099744
0.092072
0
0
0
0
0
1
0
false
0
0.2
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
0
0
1
0
0
3
98abb8a72e5e83f186b9bdd96035c2a376e273ae
200
py
Python
client-lib-py/dp_client/__init__.py
sovaai/sova-bls-http-api
9da627d6cb7586eb2bb59528d6e4411a9bbfe7fc
[ "Apache-2.0" ]
42
2020-10-28T08:36:23.000Z
2020-10-29T12:37:55.000Z
client-lib-py/dp_client/__init__.py
sovaai/sova-bls-http-api
9da627d6cb7586eb2bb59528d6e4411a9bbfe7fc
[ "Apache-2.0" ]
null
null
null
client-lib-py/dp_client/__init__.py
sovaai/sova-bls-http-api
9da627d6cb7586eb2bb59528d6e4411a9bbfe7fc
[ "Apache-2.0" ]
1
2021-01-18T00:55:35.000Z
2021-01-18T00:55:35.000Z
from . import session, inf, answer, exceptions, client, others import pydpclient __all__ = [ "session", "inf", "answer", "exceptions", "client", "others", "pydpclient", ]
15.384615
62
0.595
18
200
6.388889
0.555556
0.173913
0.278261
0.452174
0.66087
0.66087
0
0
0
0
0
0
0.255
200
12
63
16.666667
0.771812
0
0
0
0
0
0.24
0
0
0
0
0
0
1
0
false
0
0.181818
0
0.181818
0
1
0
0
null
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
7f2b366573e032fb5145ef7b3269039ba9d672a7
1,111
py
Python
ToolsStudy/fontToolsExp/tianyancha/exp.py
yangliangguang/keep_learning
47ab39c726cb28713ad22bf4cf39d6b146715910
[ "MIT" ]
2
2020-11-23T03:26:12.000Z
2020-11-25T07:22:31.000Z
ToolsStudy/fontToolsExp/tianyancha/exp.py
yangliangguang/keep_learning
47ab39c726cb28713ad22bf4cf39d6b146715910
[ "MIT" ]
null
null
null
ToolsStudy/fontToolsExp/tianyancha/exp.py
yangliangguang/keep_learning
47ab39c726cb28713ad22bf4cf39d6b146715910
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- # @Topic : # @Title : # @Content : # @Author : LiQian # @Create Time : 2018/08/17 17:46 # @Update Time : 2018/08/17 17:46 import requests from fontTools.ttLib import TTFont url = "https://static.tianyancha.com/fonts-styles/fonts/b1/b17d9d87/tyc-num.woff" headers = { "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36", } r = requests.get(url, headers=headers) with open("./font.woff", "wb") as f: f.write(r.content) url = "https://static.tianyancha.com/fonts-styles/fonts/b1/b17d9d87/tyc-num.ttf" headers = { "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.87 Safari/537.36", } r = requests.get(url, headers=headers) with open("./font.ttf", "wb") as f: f.write(r.content) online_fonts = TTFont('font.woff') online_fonts.saveXML("text.xml") _dict = online_fonts.getBestCmap() print("字典:", _dict) # online_fonts = TTFont('font.tff') # # online_fonts.saveXML("text.xml") # # _dict = online_fonts.getBestCmap() # # print("字典:", _dict)
23.638298
125
0.676868
171
1,111
4.327485
0.426901
0.089189
0.060811
0.032432
0.786486
0.786486
0.743243
0.691892
0.691892
0.691892
0
0.094496
0.133213
1,111
47
126
23.638298
0.673936
0.230423
0
0.4
0
0.2
0.497027
0
0
0
0
0
0
1
0
false
0
0.1
0
0.1
0.05
0
0
0
null
0
0
0
0
1
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
7f2c0126dfcbff7bdf29b865c67ecbe381303cc9
1,396
py
Python
MLinAction/numpy_intro.py
akshaynagpal/data_science
a525ff87f737afa9a2abee27c506663f19396999
[ "MIT" ]
null
null
null
MLinAction/numpy_intro.py
akshaynagpal/data_science
a525ff87f737afa9a2abee27c506663f19396999
[ "MIT" ]
null
null
null
MLinAction/numpy_intro.py
akshaynagpal/data_science
a525ff87f737afa9a2abee27c506663f19396999
[ "MIT" ]
null
null
null
>>> from numpy import * >>> random.rand(4,4) array([[ 0.79509808, 0.19335871, 0.98598061, 0.8024657 ], [ 0.59136923, 0.34615494, 0.68378882, 0.6309914 ], [ 0.53365134, 0.37850601, 0.10067898, 0.06932015], [ 0.66356218, 0.37288525, 0.41526366, 0.29023837]]) >>> randMat = mat(random.rand(4,4)) #converting array to matrix >>> randMat matrix([[ 0.60113398, 0.5006341 , 0.79068104, 0.53310908], [ 0.78389641, 0.08556004, 0.33583135, 0.9013885 ], [ 0.64956891, 0.7810938 , 0.700817 , 0.25559546], [ 0.66090946, 0.92180052, 0.62672922, 0.52688238]]) >>> randMat.I #inverse of a matrix matrix([[-2.71795221, 1.75783871, 4.33461581, -2.35999296], [-0.82219657, -0.61536594, -0.81764464, 2.28132605], [ 2.94525717, -0.93947136, -0.38526834, -1.18592281], [ 1.34440414, -0.01088185, -3.54846644, 2.27767461]]) >>> invRandMat = randMat.I >>> randMat*invRandMat #matrix multiplication matrix([[ 1.00000000e+00, 6.24649059e-18, -3.77877211e-17, 5.22968978e-16], [ 6.47772436e-17, 1.00000000e+00, -5.89643265e-16, 2.11029227e-16], [ 2.14578387e-16, -4.03832563e-17, 1.00000000e+00, 1.80473748e-16], [ 5.34523414e-16, -8.45867418e-17, -2.18358209e-16, 1.00000000e+00]]) >>> eye(4) #eye(4) creates an identity matrix of size 4
43.625
63
0.598854
190
1,396
4.4
0.5
0.047847
0.057416
0.028708
0
0
0
0
0
0
0
0.559338
0.221347
1,396
32
64
43.625
0.209752
0.07808
0
0
0
0
0
0
0
0
0
0
0
0
null
null
0
0.035714
null
null
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
3
7f30a98d7c162514ed6d4f6c4d426cd8f264d66c
1,153
py
Python
tests/test_tolerance_probe.py
chaosiq/chaosiq-cloud
4f2fed81e238f8c8c8081da7563d520cb30a1301
[ "Apache-2.0" ]
4
2020-04-16T02:44:27.000Z
2020-11-20T22:15:57.000Z
tests/test_tolerance_probe.py
chaosiq/chaosiq-cloud
4f2fed81e238f8c8c8081da7563d520cb30a1301
[ "Apache-2.0" ]
44
2019-09-26T10:05:07.000Z
2021-10-20T09:53:41.000Z
tests/test_tolerance_probe.py
chaosiq/chaosiq-cloud
4f2fed81e238f8c8c8081da7563d520cb30a1301
[ "Apache-2.0" ]
null
null
null
from chaoscloud.probes.http import read_http_status_code, time_http_call from chaoslib.exceptions import ActivityFailed import pytest import requests import requests_mock def test_read_http_status_code_ok(): with requests_mock.Mocker() as m: m.get("http://example.com/hello") assert read_http_status_code("http://example.com/hello") == 200 def test_read_http_status_code_ko_on_connection_timeout(): with requests_mock.Mocker() as m: m.get( "http://example.com/hello", exc=requests.exceptions.ConnectTimeout) with pytest.raises(ActivityFailed): read_http_status_code("http://example.com/hello") def test_time_http_call_ok(): with requests_mock.Mocker() as m: m.get("http://example.com/hello") assert time_http_call("http://example.com/hello") < 100.0 def test_time_http_call_ko_on_connection_timeout(): with requests_mock.Mocker() as m: m.get( "http://example.com/hello", exc=requests.exceptions.ConnectTimeout) with pytest.raises(ActivityFailed): time_http_call("http://example.com/hello")
29.564103
72
0.694709
155
1,153
4.883871
0.245161
0.116248
0.147952
0.200793
0.797886
0.747688
0.681638
0.599736
0.501982
0.501982
0
0.007535
0.194276
1,153
38
73
30.342105
0.80732
0
0
0.518519
0
0
0.166522
0
0
0
0
0
0.074074
1
0.148148
true
0
0.185185
0
0.333333
0
0
0
0
null
0
0
1
0
1
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
3
7f394cb5ace3553248067c7cd06c174a60444a0b
318
py
Python
openpype/tools/launcher/constants.py
philipluk/OpenPype
103de741de5f71063a9572f0338e879b6361fb31
[ "MIT" ]
87
2021-05-07T08:40:46.000Z
2022-03-19T00:36:25.000Z
openpype/tools/launcher/constants.py
philipluk/OpenPype
103de741de5f71063a9572f0338e879b6361fb31
[ "MIT" ]
1,019
2021-04-26T06:22:56.000Z
2022-03-31T16:30:43.000Z
openpype/tools/launcher/constants.py
BigRoy/OpenPype
dd0e3657b4e66740f55feddb2693acfd14e2c9ef
[ "MIT" ]
33
2021-04-29T12:35:54.000Z
2022-03-25T14:48:42.000Z
from Qt import QtCore ACTION_ROLE = QtCore.Qt.UserRole GROUP_ROLE = QtCore.Qt.UserRole + 1 VARIANT_GROUP_ROLE = QtCore.Qt.UserRole + 2 ACTION_ID_ROLE = QtCore.Qt.UserRole + 3 ANIMATION_START_ROLE = QtCore.Qt.UserRole + 4 ANIMATION_STATE_ROLE = QtCore.Qt.UserRole + 5 # Animation length in seconds ANIMATION_LEN = 7
24.461538
45
0.786164
50
318
4.78
0.46
0.251046
0.301255
0.502092
0.209205
0
0
0
0
0
0
0.021818
0.13522
318
12
46
26.5
0.847273
0.084906
0
0
0
0
0
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
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
3
7f54873ba2bb9b705c660db41ec303d85e8ab9d8
583
py
Python
inbm-lib/inbm_common_lib/platform_info.py
ahameedx/intel-inb-manageability
aca445fa4cef0b608e6e88e74476547e10c06073
[ "Apache-2.0" ]
5
2021-12-13T21:19:31.000Z
2022-01-18T18:29:43.000Z
inbm-lib/inbm_common_lib/platform_info.py
ahameedx/intel-inb-manageability
aca445fa4cef0b608e6e88e74476547e10c06073
[ "Apache-2.0" ]
45
2021-12-30T17:21:09.000Z
2022-03-29T22:47:32.000Z
inbm-lib/inbm_common_lib/platform_info.py
ahameedx/intel-inb-manageability
aca445fa4cef0b608e6e88e74476547e10c06073
[ "Apache-2.0" ]
4
2022-01-26T17:42:54.000Z
2022-03-30T04:48:04.000Z
""" Data structure for Platform Information Copyright (C) 2017-2022 Intel Corporation SPDX-License-Identifier: Apache-2.0 """ from datetime import datetime from dataclasses import dataclass, field from typing import Union from inbm_common_lib.constants import UNKNOWN @dataclass(init=True) class PlatformInformation: bios_release_date: Union[datetime, str] = field(default=UNKNOWN) bios_vendor: str = field(default=UNKNOWN) bios_version: str = field(default=UNKNOWN) platform_mfg: str = field(default="") platform_product: str = field(default="")
27.761905
68
0.753002
73
583
5.90411
0.589041
0.092807
0.174014
0.153132
0.12065
0
0
0
0
0
0
0.020325
0.156089
583
20
69
29.15
0.855691
0.202401
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.363636
0
0.909091
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
0
1
0
1
0
1
0
0
3
7f5e4869bb2906d6da780746c14a0d9c94fbf4a6
539
py
Python
django_magnificent_messages/views.py
NoNameItem/django-magnificent-messages
4fed1012b5dab589a48787ebeec5539f2a414486
[ "MIT" ]
null
null
null
django_magnificent_messages/views.py
NoNameItem/django-magnificent-messages
4fed1012b5dab589a48787ebeec5539f2a414486
[ "MIT" ]
null
null
null
django_magnificent_messages/views.py
NoNameItem/django-magnificent-messages
4fed1012b5dab589a48787ebeec5539f2a414486
[ "MIT" ]
null
null
null
# """ # django_magnificent_messages views # """ # from django.views.generic import ( # CreateView, # DeleteView, # DetailView, # UpdateView, # ListView # ) # # from .models import Message # # # class MessageCreateView(CreateView): # # model = Message # # # class MessageDeleteView(DeleteView): # # model = Message # # # class MessageDetailView(DetailView): # # model = Message # # # class MessageUpdateView(UpdateView): # # model = Message # # # class MessageListView(ListView): # # model = Message
14.184211
38
0.643785
43
539
8.023256
0.488372
0.173913
0.197101
0
0
0
0
0
0
0
0
0
0.222635
539
37
39
14.567568
0.823389
0.860853
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
0
0
0
null
0
1
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
0
0
0
0
0
3
7f72f3128bb15da3f7f6c31b8a02db34b87ed8c6
14,642
py
Python
modules/nltk_contrib/refexpr/drawers.py
h4ck3rm1k3/NLP-project
aeba6302f60d27a8b9e65ad28d2d74e1276c7cd6
[ "MIT" ]
123
2015-01-06T10:46:18.000Z
2022-02-01T10:05:16.000Z
nltk_contrib/refexpr/drawers.py
silky/nltk_contrib
c152bde901f05915e90b07a615b232adb123bed8
[ "Apache-2.0" ]
12
2015-01-13T06:27:18.000Z
2020-07-30T23:00:41.000Z
nltk_contrib/refexpr/drawers.py
silky/nltk_contrib
c152bde901f05915e90b07a615b232adb123bed8
[ "Apache-2.0" ]
114
2015-01-13T04:47:49.000Z
2021-11-13T08:16:02.000Z
from random import shuffle from full_brevity import * from relational import * from incremental import * from util import generate_phrase, generate_phrase_rel if __name__ == '__main__': # This data is based on the drawer pictures from Vienthen and Dale (2006) # Drawers are numbered (oddly) from left to right on even rows and right to left on odd rows (top to bottom) facts = [ # Row 1 [Type, "drawer", "d1"], ["color", "blue", "d1"], ["row", "1", "d1"], ["col", "1", "d1"], ["corner", "true", "d1"], [Rel, "above", "d1", "d8"], [Rel, "left", "d1", "d2"], [Rel, "above", "d1", "d9"], [Rel, "left", "d1", "d3"], [Rel, "above", "d1", "d16"], [Rel, "left", "d1", "d4"], [Type, "drawer", "d2"], ["color", "orange", "d2"], ["row", "1", "d2"], ["col", "2", "d2"], ["corner", "false", "d2"], [Rel, "above", "d2", "d7"], [Rel, "left", "d2", "d3"], [Rel, "right", "d2", "d1"], [Rel, "above", "d2", "d10"], [Rel, "left", "d2", "d4"], [Rel, "above", "d2", "d15"], [Type, "drawer", "d3"], ["color", "pink", "d3"], ["row", "1", "d3"], ["col", "3", "d3"], ["corner", "false", "d3"], [Rel, "above", "d3", "d6"], [Rel, "left", "d3", "d4"], [Rel, "right", "d3", "d2"], [Rel, "above", "d3", "d11"], [Rel, "right", "d3", "d1"], [Rel, "above", "d3", "d14"], [Type, "drawer", "d4"], ["color", "yellow", "d4"], ["row", "1", "d4"], ["col", "4", "d4"], ["corner", "true", "d4"], [Rel, "above", "d4", "d5"], [Rel, "right", "d4", "d3"], [Rel, "above", "d4", "d12"], [Rel, "right", "d4", "d2"], [Rel, "above", "d4", "d13"], [Rel, "right", "d4", "d1"], # Row 2 [Type, "drawer", "d5"], ["color", "pink", "d5"], ["row", "2", "d5"], ["col", "4", "d5"], ["corner", "false", "d5"], [Rel, "above", "d5", "d12"], [Rel, "below", "d5", "d4"], [Rel, "above", "d5", "d13"], [Rel, "right", "d5", "d6"], [Rel, "right", "d5", "d7"], [Rel, "right", "d5", "d8"], [Type, "drawer", "d6"], ["color", "yellow", "d6"], ["row", "2", "d6"], ["col", "3", "d6"], ["corner", "false", "d6"], [Rel, "above", "d6", "d11"], [Rel, "left", "d6", "d5"], [Rel, "right", "d6", "d7"], [Rel, "below", "d6", "d3"], [Rel, "above", "d6", "d14"], [Rel, "right", "d6", "d8"], [Type, "drawer", "d7"], ["color", "blue", "d7"], ["row", "2", "d7"], ["col", "2", "d7"], ["corner", "false", "d7"], [Rel, "above", "d7", "d10"], [Rel, "left", "d7", "d6"], [Rel, "right", "d7", "d8"], [Rel, "below", "d7", "d2"], [Rel, "above", "d7", "d15"], [Rel, "left", "d7", "d5"], [Type, "drawer", "d8"], ["color", "blue", "d8"], ["row", "2", "d8"], ["col", "1", "d8"], ["corner", "false", "d8"], [Rel, "above", "d8", "d9"], [Rel, "left", "d8", "d7"], [Rel, "below", "d8", "d1"], [Rel, "above", "d8", "d16"], [Rel, "left", "d8", "d6"], [Rel, "left", "d8", "d5"], # Row 3 [Type, "drawer", "d9"], ["color", "orange", "d9"], ["row", "3", "d9"], ["col", "1", "d9"], ["corner", "false", "d9"], [Rel, "above", "d9", "d16"], [Rel, "left", "d9", "d10"], [Rel, "below", "d9", "d8"], [Rel, "left", "d9", "d11"], [Rel, "left", "d9", "d12"], [Rel, "below", "d9", "d1"], [Type, "drawer", "d10"], ["color", "blue", "d10"], ["row", "3", "d10"], ["col", "2", "d10"], ["corner", "false", "d10"], [Rel, "above", "d10", "d15"], [Rel, "left", "d10", "d11"], [Rel, "right", "d10", "d9"], [Rel, "below", "d10", "d7"], [Rel, "left", "d10", "d12"], [Rel, "below", "d10", "d2"], [Type, "drawer", "d11"], ["color", "yellow", "d11"], ["row", "3", "d11"], ["col", "3", "d11"], ["corner", "false", "d11"], [Rel, "above", "d11", "d14"], [Rel, "left", "d11", "d12"], [Rel, "right", "d11", "d10"], [Rel, "below", "d11", "d6"], [Rel, "right", "d11", "d9"], [Rel, "below", "d11", "d3"], [Type, "drawer", "d12"], ["color", "orange", "d12"], ["row", "3", "d12"], ["col", "4", "d12"], ["corner", "false", "d12"], [Rel, "above", "d12", "d13"], [Rel, "right", "d12", "d11"], [Rel, "below", "d12", "d5"], [Rel, "right", "d12", "d10"], [Rel, "right", "d12", "d9"], [Rel, "below", "d12", "d4"], # Row 4 [Type, "drawer", "d13"], ["color", "pink", "d13"], ["row", "4", "d13"], ["col", "4", "d13"], ["corner", "true", "d13"], [Rel, "below", "d13", "d12"], [Rel, "right", "d13", "d14"], [Rel, "below", "d13", "d5"], [Rel, "right", "d13", "d15"], [Rel, "below", "d13", "d4"], [Rel, "right", "d13", "d16"], [Type, "drawer", "d14"], ["color", "orange", "d14"], ["row", "4", "d14"], ["col", "3", "d14"], ["corner", "false", "d14"], [Rel, "below", "d14", "d11"], [Rel, "left", "d14", "d13"], [Rel, "right", "d14", "d15"], [Rel, "below", "d14", "d6"], [Rel, "right", "d14", "d16"], [Rel, "below", "d14", "d3"], [Type, "drawer", "d15"], ["color", "pink", "d15"], ["row", "4", "d15"], ["col", "2", "d15"], ["corner", "false", "d15"], [Rel, "below", "d15", "d10"], [Rel, "left", "d15", "d14"], [Rel, "right", "d15", "d16"], [Rel, "below", "d15", "d7"], [Rel, "below", "d15", "d2"], [Rel, "left", "d15", "d13"], [Type, "drawer", "d16"], ["color", "yellow", "d16"], ["row", "4", "d16"], ["col", "1", "d16"], ["corner", "true", "d16"], [Rel, "below", "d16", "d9"], [Rel, "left", "d16", "d15"], [Rel, "below", "d16", "d1"], [Rel, "left", "d16", "d14"], [Rel, "below", "d16", "d8"], [Rel, "left", "d16", "d13"] ] #These are the data collected from subjects in Viethen and Dale's work. (2006) human_facts = { 1: [ [["color", "blue", "d1"], ["row", "1", "d1"], ["col", "1", "d1"], ["corner", "true", "d1"]], [["row", "1", "d1"], ["col", "1", "d1"], ["corner", "true", "d1"]], [["row", "1", "d2"], ["col", "2", "d2"]] ], 2: [ [["color", "orange", "d2"], ["col", "2", "d2"]], [["color", "orange", "d2"], ["row", "1", "d2"]], [["color", "orange", "d2"], [Rel, "above", "d2", "d7"], ["color", "blue", "d7"]], [["col", "2", "d2"], ["row", "1", "d2"]], [["color", "orange", "d2"], ["col", "2", "d2"]], [["row", "1", "d2"], ["col", "2", "d2"]], ], 3: [ [["color", "pink", "d3"], ["row", "1", "d3"]], [["color", "pink", "d3"], ["row", "1", "d3"]], [["color", "pink", "d3"], ["row", "1", "d3"], ["col", "3", "d3"]], [["row", "1", "d3"], ["col", "3", "d3"]], [["color", "pink", "d3"], ["row", "1", "d3"]], [["color", "pink", "d3"], ["row", "1", "d3"]], [["color", "pink", "d3"], ["row", "1", "d3"]], [["row", "1", "d3"], ["col", "3", "d3"]], ], 4: [ [["row", "1", "d4"], ["col", "4", "d4"], ["corner", "true", "d4"]], [["color", "yellow", "d4"], ["row", "1", "d4"], ["col", "4", "d4"], ["corner", "true", "d4"]], [["col", "4", "d4"], ["row", "1", "d4"]], [["row", "1", "d4"], ["col", "3", "d4"]], [["row", "1", "d4"], ["col", "3", "d4"]], [["row", "1", "d4"], ["col", "4", "d4"], ["corner", "true", "d4"]], [["row", "1", "d4"], ["col", "3", "d4"]], [["row", "1", "d4"], ["col", "3", "d4"]], ], 5: [ [["color", "yellow", "d4"], [Rel, "above", "d4", "d5"], ["color", "pink", "d5"]], [["color", "pink", "d5"], ["col", "4", "d5"], ["row", "2", "d5"]], [["color", "pink", "d5"], ["row", "2", "d5"], ["col", "4", "d5"]], [["color", "pink", "d5"], ["col", "4", "d5"], [Rel, "below", "d5", "d4"], ["color", "yellow", "d4"]], [["color", "pink", "d5"], ["row", "2", "d5"]], ], 6: [ [["col", "3", "d6"], ["row", "2", "d6"]], [["row", "2", "d6"], ["col", "3", "d6"]], [["row", "2", "d6"], ["col", "3", "d6"]], [["color", "yellow", "d6"], [Rel, "above", "d6", "d11"], ["color", "yellow", "d11"]], [["color", "yellow", "d6"], ["row", "2", "d6"]], [["color", "yellow", "d6"], ["row", "2", "d6"]], [[Rel, "right", "d6", "d7"], [Rel, "right" "d7", "d8"], ["color", "blue", "d7"], ["color", "blue", "d8"]], [["color", "yellow", "d6"], [Rel, "above", "d6", "d11"], ["color", "yellow", "d11"]], [["color", "yellow", "d6"], ["col", "3", "d6"], ["row", "2", "d6"]], [["col", "3", "d6"], ["row", "2", "d6"]], [["col", "3", "d6"], ["row", "2", "d6"]], ], 7: [ [["color", "blue", "d7"], ["col", "2", "d7"], ["row", "2", "d7"]], [["color", "blue", "d7"], ["col", "2", "d7"], ["row", "2", "d7"]], [["color", "blue", "d7"], [Rel, "below", "d7", "d2"], ["col", "2", "d7"], ["col", "2", "d2"]], [["col", "2", "d7"], ["row", "2", "d7"]], [["color", "blue", "d7"], [Rel, "below", "d7", "d2"], ["color", "orange", "d2"]], [["col", "2", "d7"], ["row", "2", "d7"]], [["row", "2", "d7"], ["col", "2", "d7"]], [["col", "2", "d7"], ["row", "2", "d7"]], [["row", "2", "d7"], ["col", "2", "d7"]], [["col", "2", "d7"], ["row", "2", "d7"]], ], 8: [ [["row", "2", "d8"], ["col", "1", "d8"]], [["col", "1", "d8"], ["row", "2", "d8"]], [["row", "2", "d8"], ["col", "1", "d8"]], [["color", "blue", "d8"], ["row", "2", "d8"], ["col", "1", "d8"]], [["row", "2", "d8"], ["col", "1", "d8"]], [["row", "2", "d8"], ["col", "1", "d8"]], [["row", "2", "d8"], ["col", "1", "d8"]], ], 9: [ [["color", "orange", "d9"], ["col", "1", "d9"], ["row", "3", "d9"]], [["color", "orange", "d9"], ["col", "1", "d9"], ["row", "3", "d9"]], [["color", "orange", "d9"], ["col", "1", "d9"], ["row", "3", "d9"]], [["row", "3", "d9"], ["col", "1", "d9"]], [["color", "orange", "d9"], ["col", "1", "d9"]], [["color", "orange", "d9"], ["col", "1", "d9"]], [["row", "3", "d9"], ["col", "1", "d9"]], [["color", "orange", "d9"], ["col", "1", "d9"]], ], 10: [ [["color", "blue", "d10"], ["row", "3", "d10"], ["col", "2", "d10"]], [["color", "blue", "d10"], ["row", "3", "d10"]], [["color", "blue", "d10"], [Rel, "above", "d10", "d15"], ["color", "pink", "d15"]], [["color", "blue", "d10"], [Rel, "above", "d10", "d15"], ["color", "pink", "d15"]], [["col", "2", "d10"], ["row", "3", "d10"]], ], 11: [ [["col", "3", "d11"], ["row", "3", "d11"]], [["row", "3", "d11"], ["col", "3", "d11"]], [["color", "yellow", "d11"], [Rel, "next", "d11", "d12"], ["color", "orange", "d12"]], [["color", "yellow", "d11"], [Rel, "next", "d11", "d12"], ["color", "orange", "d12"]], [["color", "yellow", "d11"], ["row", "3", "d11"], ["col", "3", "d11"]], [["row", "3", "d11"], ["col", "3", "d11"]], [["color", "yellow", "d11"], ["row", "3", "d11"]], [["color", "yellow", "d11"], ["row", "3", "d11"]], ], 12: [ [["color", "orange", "d12"], ["col", "4", "d12"]], [["row", "3", "d12"], ["col", "4", "d12"]], [["color", "orange", "d12"], [Rel, "below", "d12", "d5"], ["color", "pink", "d5"]], [["row", "3", "d12"], ["col", "4", "d12"]], ], 13: [ [["row", "4", "d13"], ["col", "4", "d13"]], [["color", "pink", "d13"], ["row", "4", "d13"], ["col", "4", "d13"]], [["row", "4", "d13"], ["col", "4", "d13"]], [["row", "4", "d13"], ["col", "4", "d13"]], ], 14: [ [["color", "orange", "d14"], ["row", "4", "d14"], ["col", "3", "d14"]], [["color", "orange", "d14"], ["row", "4", "d14"], ["col", "3", "d14"]], [["color", "orange", "d14"], ["row", "4", "d14"]], [["color", "orange", "d14"], ["row", "4", "d14"]], [["color", "orange", "d14"], ["row", "4", "d14"]], [["color", "orange", "d14"], [Rel, "below", "d14", "d11"], [Rel, "below", "d11", "d6"], ["color", "yellow", "d11"], ["color", "yellow", "d6"]], [["color", "orange", "d14"], ["row", "4", "d14"]], [["color", "orange", "d14"], [Rel, "below", "d14", "d11"], [Rel, "below", "d11", "d6"], ["color", "yellow", "d11"], ["color", "yellow", "d6"]], [["color", "orange", "d14"], ["row", "4", "d14"]], ], 15: [ [["col", "2", "d15"], ["row", "4", "d15"]], [["color", "pink", "d15"], ["row", "4", "d15"], ["col", "2", "d15"]], [["color", "pink", "d15"], ["row", "4", "d15"], ["col", "2", "d15"]], [["color", "pink", "d15"], ["col", "2", "d15"]], [["color", "pink", "d15"], ["row", "4", "d15"], ["col", "2", "d15"]], [["col", "2", "d15"], ["row", "4", "d15"]], [["color", "pink", "d15"], ["row", "4", "d15"], ["col", "2", "d15"]], [["color", "pink", "d15"], ["row", "4", "d15"], ["col", "2", "d15"]], [["color", "pink", "d15"], ["col", "2", "d15"]], [["color", "pink", "d15"], ["row", "4", "d15"], ["col", "2", "d15"]], ], 16: [ [["row", "4", "d16"], ["col", "1", "d16"]], [["row", "4", "d16"], ["col", "1", "d16"]], [["row", "4", "d16"], ["col", "1", "d16"]], [["row", "4", "d16"], ["col", "1", "d16"]], [["row", "4", "d16"], ["col", "1", "d16"]], [["row", "4", "d16"], ["col", "1", "d16"]], [["row", "4", "d16"], ["col", "1", "d16"]], [["row", "4", "d16"], ["col", "1", "d16"]], [["row", "4", "d16"], ["col", "1", "d16"]], [["row", "4", "d16"], ["col", "1", "d16"]], [["row", "4", "d16"], ["col", "1", "d16"]], [["row", "4", "d16"], ["col", "1", "d16"]], ], } shuffle(facts, lambda: 0.0) fb = FullBrevity(filter(lambda f: f[0] != Rel, facts)) rel = Relational(facts) #The ordered priority for using attributes, important for incremental algorithm ranked_attrs = ["color", "row", "col", "corner"] #Taxonomy used in incremental algorithm to pick out a more common name when appropriate # For instance dog instead of Chihuahua when there is a referent dog amongst other animals (which are not dogs) taxonomy = Taxonomy({}) incr = Incremental(facts, ranked_attrs, taxonomy) #defines how to turn these rules into English phrases handlers = { "col": lambda(desc): "column %s" % desc, "row": lambda(desc): "row %s" % desc, "corner": lambda(desc): "corner", "above": lambda(lr): "above" if lr else "below", "below": lambda(lr): "below" if lr else "above", "right": lambda(lr): "to the right of" if lr else "to the left of", "left": lambda(lr): "to the left of" if lr else "to the right of" } #Generate phrases with each algorithm and print to screen for i in range(1, 17): obj_id = "d%s" % i print "%#02d,\"Full Brevity\",\"%s\"" % (i, generate_phrase(fb.describe(obj_id), ranked_attrs, handlers)) print "%#02d,\"Relational\",\"%s\"" % (i, generate_phrase_rel(rel.describe(obj_id), ranked_attrs, obj_id, handlers)) print "%#02d,\"Incremental\",\"%s\"" % (i, generate_phrase(incr.describe(obj_id), ranked_attrs, handlers))
49.134228
149
0.399945
1,810
14,642
3.220442
0.086188
0.024704
0.015612
0.022302
0.505747
0.47847
0.435409
0.378109
0.373306
0.354092
0
0.094336
0.210149
14,642
297
150
49.299663
0.409684
0.045144
0
0.423387
1
0
0.305864
0
0
0
0
0
0
0
null
null
0
0.020161
null
null
0.012097
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
3
7f93a50246cd503a03d34740a95f369338f2ab79
223
py
Python
setup.py
wilswer/NumPy2048
af568afea151809c95a344115da4b72fb7736050
[ "MIT" ]
null
null
null
setup.py
wilswer/NumPy2048
af568afea151809c95a344115da4b72fb7736050
[ "MIT" ]
null
null
null
setup.py
wilswer/NumPy2048
af568afea151809c95a344115da4b72fb7736050
[ "MIT" ]
null
null
null
from setuptools import setup if __name__ == "__main__": setup( # find_packages("src"), # package_dir={"": "src"}, # package_data={ # "NumPy2048": ["assets/*.txt"] # }, )
20.272727
43
0.484305
19
223
5.105263
0.842105
0.206186
0
0
0
0
0
0
0
0
0
0.027027
0.336323
223
10
44
22.3
0.628378
0.439462
0
0
0
0
0.067227
0
0
0
0
0
0
1
0
true
0
0.25
0
0.25
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
3
7f986ac05901fa9ae21da24fca58fd455d3ee02f
563
py
Python
varvar/__init__.py
drorspei/varvar
1f7daf6d82cdfdce396f9eb81b54a5f470411641
[ "MIT" ]
null
null
null
varvar/__init__.py
drorspei/varvar
1f7daf6d82cdfdce396f9eb81b54a5f470411641
[ "MIT" ]
null
null
null
varvar/__init__.py
drorspei/varvar
1f7daf6d82cdfdce396f9eb81b54a5f470411641
[ "MIT" ]
null
null
null
import threading def htrain(*args, **kwargs): from varvar.htrees import multiplicative_variance_trees as _htrain return _htrain(*args, **kwargs) def qtrain(*args, **kwargs): from varvar.qtrees import multiplicative_variance_trees as _qtrain return _qtrain(*args, **kwargs) def predict(*args, **kwargs): from varvar.predict import predict as _predict return _predict(*args, **kwargs) def import_(): import varvar.qtrees import varvar.htrees import varvar.predict _thread = threading.Thread(target=import_) _thread.start()
24.478261
70
0.737123
69
563
5.811594
0.289855
0.149626
0.104738
0.149626
0.174564
0
0
0
0
0
0
0
0.16341
563
22
71
25.590909
0.85138
0
0
0
0
0
0
0
0
0
0
0
0
1
0.25
false
0
0.5625
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
0
0
1
0
1
0
0
3
7fa20d2232769f221cadc93e9eabf4a79001bf16
425
py
Python
skm_tea/utils/env.py
StanfordMIMI/skm-tea
5678bfcebad4fdc30de62b319d96ec1775e1671c
[ "MIT" ]
26
2021-08-28T06:57:50.000Z
2022-02-17T06:33:41.000Z
skm_tea/utils/env.py
StanfordMIMI/skm-tea
5678bfcebad4fdc30de62b319d96ec1775e1671c
[ "MIT" ]
6
2021-10-20T16:04:12.000Z
2022-03-15T20:16:52.000Z
skm_tea/utils/env.py
StanfordMIMI/skm-tea
5678bfcebad4fdc30de62b319d96ec1775e1671c
[ "MIT" ]
4
2021-11-15T08:32:41.000Z
2022-02-23T18:54:30.000Z
import os from iopath.common.file_io import PathManager, PathManagerFactory from meddlr.utils.cluster import Cluster from meddlr.utils.env import is_repro, supports_cupy # noqa: F401 def get_path_manager(key="skm_tea") -> PathManager: return PathManagerFactory.get(key) def cache_dir() -> str: return get_path_manager().get_local_path( os.path.join(Cluster.working_cluster().cache_dir, "skm-tea") )
26.5625
68
0.757647
60
425
5.15
0.55
0.064725
0.097087
0
0
0
0
0
0
0
0
0.008219
0.141176
425
15
69
28.333333
0.838356
0.023529
0
0
0
0
0.033898
0
0
0
0
0
0
1
0.2
false
0
0.4
0.2
0.8
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
1
1
0
0
3
f6821a7b65a496fa677d418792fb4f6bffa6d00d
86
py
Python
abc/abc215/b/main.py
tonko2/AtCoder
5d617072517881d226d7c8af09cb88684d41af7e
[ "Xnet", "X11", "CECILL-B" ]
2
2022-01-22T07:56:58.000Z
2022-01-24T00:29:37.000Z
abc/abc215/b/main.py
tonko2/AtCoder
5d617072517881d226d7c8af09cb88684d41af7e
[ "Xnet", "X11", "CECILL-B" ]
null
null
null
abc/abc215/b/main.py
tonko2/AtCoder
5d617072517881d226d7c8af09cb88684d41af7e
[ "Xnet", "X11", "CECILL-B" ]
null
null
null
N = int(input()) X = 1 K = 0 while X <= N: X *= 2 K += 1 print(max(0, K - 1))
10.75
20
0.406977
19
86
1.842105
0.578947
0.114286
0
0
0
0
0
0
0
0
0
0.109091
0.360465
86
8
20
10.75
0.527273
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0
0
0
0.142857
1
0
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
f6f755ecf24bd1ea2d158e007e78b69e4e985b62
260
py
Python
src/the_tale/the_tale/finances/xsolla/conf.py
devapromix/the-tale
2a10efd3270734f8cf482b4cfbc5353ef8f0494c
[ "BSD-3-Clause" ]
1
2020-04-02T11:51:20.000Z
2020-04-02T11:51:20.000Z
src/the_tale/the_tale/finances/xsolla/conf.py
devapromix/the-tale
2a10efd3270734f8cf482b4cfbc5353ef8f0494c
[ "BSD-3-Clause" ]
null
null
null
src/the_tale/the_tale/finances/xsolla/conf.py
devapromix/the-tale
2a10efd3270734f8cf482b4cfbc5353ef8f0494c
[ "BSD-3-Clause" ]
null
null
null
import smart_imports smart_imports.all() settings = dext_app_settings.app_settings('XSOLLA', SECRET_KEY='secret_key', ALLOWED_IPS=('127.0.0.1', 'testserver', 'localhost'))
26
95
0.515385
25
260
5.04
0.68
0.190476
0
0
0
0
0
0
0
0
0
0.037037
0.376923
260
9
96
28.888889
0.740741
0
0
0
0
0
0.169884
0
0
0
0
0
0
1
0
false
0
0.4
0
0.4
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
0
0
0
3
63de38766914cb2b1648358782ebe34d491a3235
109
py
Python
sdcflows/__init__.py
effigies/sdcflows
c56e2fd87974b96b02f43aab5b0cf3733fcf0d3c
[ "Apache-2.0" ]
null
null
null
sdcflows/__init__.py
effigies/sdcflows
c56e2fd87974b96b02f43aab5b0cf3733fcf0d3c
[ "Apache-2.0" ]
null
null
null
sdcflows/__init__.py
effigies/sdcflows
c56e2fd87974b96b02f43aab5b0cf3733fcf0d3c
[ "Apache-2.0" ]
null
null
null
from .__about__ import ( # noqa __version__, __copyright__, __credits__, __packagename__, )
15.571429
32
0.669725
8
109
6.625
1
0
0
0
0
0
0
0
0
0
0
0
0.256881
109
6
33
18.166667
0.654321
0.036697
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.166667
0
0.166667
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
0
0
0
3
120bead45f003f215d2db30b5398db143ed39a91
256
py
Python
oarepo_model_builder_multilingual/invenio/invenio_schema_i18n.py
oarepo/oarepo-model-builder-multilingual
884da6667dfd6f4bb2c255b4f42d6d4de999d2e8
[ "MIT" ]
null
null
null
oarepo_model_builder_multilingual/invenio/invenio_schema_i18n.py
oarepo/oarepo-model-builder-multilingual
884da6667dfd6f4bb2c255b4f42d6d4de999d2e8
[ "MIT" ]
2
2022-02-06T20:03:11.000Z
2022-03-07T11:01:39.000Z
oarepo_model_builder_multilingual/invenio/invenio_schema_i18n.py
oarepo/oarepo-model-builder-multilingual
884da6667dfd6f4bb2c255b4f42d6d4de999d2e8
[ "MIT" ]
null
null
null
from oarepo_model_builder.invenio.invenio_base import InvenioBaseClassPythonBuilder class InvenioSchemaI18nStrBuilder(InvenioBaseClassPythonBuilder): TYPE = 'invenio_schema_i18n' class_config = 'i18n-schema-class' template = 'subschema-i18n'
32
83
0.820313
24
256
8.5
0.666667
0
0
0
0
0
0
0
0
0
0
0.035242
0.113281
256
7
84
36.571429
0.863436
0
0
0
0
0
0.195313
0
0
0
0
0
0
1
0
false
0
0.2
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
0
0
1
0
0
3
1211a03ca95508bda5f97a95da859aca9352dab9
2,659
py
Python
models/GOKU.py
jc-audet/GOKU
5627052a96bc95d9e893fe589bb51af447ff4f01
[ "MIT" ]
11
2020-04-27T12:55:40.000Z
2022-03-15T08:51:45.000Z
models/GOKU.py
jc-audet/GOKU
5627052a96bc95d9e893fe589bb51af447ff4f01
[ "MIT" ]
1
2020-12-13T07:34:47.000Z
2020-12-13T12:01:49.000Z
models/GOKU.py
jc-audet/GOKU
5627052a96bc95d9e893fe589bb51af447ff4f01
[ "MIT" ]
2
2020-06-29T19:20:38.000Z
2021-05-03T17:49:53.000Z
import models.GOKU_pendulum_friction as GOKU_pendulum_friction import models.GOKU_pendulum as GOKU_pendulum import models.GOKU_double_pendulum as GOKU_double_pendulum import models.GOKU_cvs as GOKU_cvs import torch.nn as nn import torch class GOKU(nn.Module): def __init__(self, input_dim, latent_dim, rnn_input_dim, rnn_output_dim, ode_method, rnn_dropout, rnn_layers, encoder, decoder): super(GOKU, self).__init__() self.encoder = encoder(input_dim, latent_dim, rnn_input_dim, rnn_output_dim, rnn_dropout, rnn_layers) self.decoder = decoder(input_dim, latent_dim, ode_method) def forward(self, mini_batch, t, variational=True): latent_z_0_loc, latent_z_0_log_var, latent_params_loc, latent_params_log_var = self.encoder(mini_batch) if variational: latent_z_0 = torch.distributions.normal.Normal(latent_z_0_loc, torch.exp(latent_z_0_log_var / 2.0)).rsample() latent_params = torch.distributions.normal.Normal(latent_params_loc, torch.exp(latent_params_log_var / 2.0)).rsample() else: latent_z_0 = latent_z_0_loc latent_params = latent_params_loc predicted_batch, predicted_z, predicted_params = self.decoder(latent_z_0, latent_params, t) return predicted_batch, predicted_z, predicted_params, latent_z_0, latent_z_0_loc, latent_z_0_log_var, latent_params, latent_params_loc, latent_params_log_var def create_goku_pendulum(input_dim=[28, 28], latent_dim=16, rnn_input_dim=32, rnn_output_dim=16, ode_method='rk4', rnn_dropout=0.0, rnn_layers=2): return GOKU(input_dim, latent_dim, rnn_input_dim, rnn_output_dim, ode_method, rnn_dropout, rnn_layers, GOKU_pendulum.Encoder, GOKU_pendulum.Decoder) def create_goku_pendulum_friction(input_dim=[28, 28], latent_dim=16, rnn_input_dim=32, rnn_output_dim=16, ode_method='rk4', rnn_dropout=0.0, rnn_layers=2): return GOKU(input_dim, latent_dim, rnn_input_dim, rnn_output_dim, ode_method, rnn_dropout, rnn_layers, GOKU_pendulum_friction.Encoder, GOKU_pendulum_friction.Decoder) def create_goku_cvs(input_dim=3, latent_dim=64, rnn_input_dim=64, rnn_output_dim=64, ode_method='rk4', rnn_dropout=0.0, rnn_layers=2): return GOKU(input_dim, latent_dim, rnn_input_dim, rnn_output_dim, ode_method, rnn_dropout, rnn_layers, GOKU_cvs.Encoder, GOKU_cvs.Decoder) def create_goku_double_pendulum(input_dim=[32, 32], latent_dim=16, rnn_input_dim=32, rnn_output_dim=16, ode_method='rk4', rnn_dropout=0.0, rnn_layers=2): return GOKU(input_dim, latent_dim, rnn_input_dim, rnn_output_dim, ode_method, rnn_dropout, rnn_layers, GOKU_double_pendulum.Encoder, GOKU_double_pendulum.Decoder)
59.088889
170
0.78789
435
2,659
4.367816
0.126437
0.088421
0.046316
0.062632
0.576842
0.507895
0.466842
0.438421
0.421053
0.421053
0
0.029135
0.122226
2,659
44
171
60.431818
0.784919
0
0
0
0
0
0.004513
0
0
0
0
0
0
1
0.206897
false
0
0.206897
0.137931
0.62069
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
0
0
0
1
1
0
0
3
12303394d3628cb402e970a7f7307a3e950884e5
632
py
Python
tests/bits/test_p5_4.py
faranik/training
a1b8d4c71797381920095d6d3cd9b129d7baa432
[ "MIT" ]
null
null
null
tests/bits/test_p5_4.py
faranik/training
a1b8d4c71797381920095d6d3cd9b129d7baa432
[ "MIT" ]
null
null
null
tests/bits/test_p5_4.py
faranik/training
a1b8d4c71797381920095d6d3cd9b129d7baa432
[ "MIT" ]
null
null
null
import unittest from bits.p5_4 import get_largest class TestGetLargest(unittest.TestCase): def test_get_largest_1(self): """ Input: 1 (binary: 001) Output: 2 (binary: 010) :return: void """ self.assertEqual(2, get_largest(1)) def test_get_largest_9(self): """ Input: 6 (binary: 0110) Output: 9 (binary: 1001) :return: void """ self.assertEqual(9, get_largest(6)) def test_get_largest_0(self): """ Input: 0 Output: 0 :return: void """ self.assertEqual(0, get_largest(0))
21.066667
43
0.544304
75
632
4.4
0.386667
0.212121
0.090909
0.154545
0
0
0
0
0
0
0
0.074163
0.338608
632
29
44
21.793103
0.715311
0.248418
0
0
0
0
0
0
0
0
0
0
0.333333
1
0.333333
false
0
0.222222
0
0.666667
0
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
3
1232f287fb6b8c1399a5c2463a59346e12ad5b04
129
py
Python
app/__init__.py
mendrugory/monkey-note-bot
b5a75fa73940d0c0f33ddf39fa2e04147155eaed
[ "MIT" ]
1
2019-07-16T14:20:10.000Z
2019-07-16T14:20:10.000Z
app/__init__.py
mendrugory/monkey-note-bot
b5a75fa73940d0c0f33ddf39fa2e04147155eaed
[ "MIT" ]
null
null
null
app/__init__.py
mendrugory/monkey-note-bot
b5a75fa73940d0c0f33ddf39fa2e04147155eaed
[ "MIT" ]
null
null
null
from flask import Flask application = Flask(__name__) from app import views if __name__ == '__main__': application.run()
12.9
29
0.728682
16
129
5.125
0.625
0
0
0
0
0
0
0
0
0
0
0
0.186047
129
9
30
14.333333
0.780952
0
0
0
0
0
0.062016
0
0
0
0
0
0
1
0
false
0
0.4
0
0.4
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
0
0
0
3
126425daf26654e718dbc5ea214d3c23ab9b3140
98
py
Python
Pythontutorials/20_input_demo.py
Asurada2015/Python-Data-Analysis-Learning-Notes
5697c8de3e5fd6562e77195b198b2d8ff836008e
[ "MIT" ]
2
2018-02-07T02:20:08.000Z
2019-07-07T06:21:17.000Z
Pythontutorials/20_input_demo.py
yangwusi/python
b00064134ff9ed4e1545ce3f3c4d2a58e2a9461d
[ "MIT" ]
null
null
null
Pythontutorials/20_input_demo.py
yangwusi/python
b00064134ff9ed4e1545ce3f3c4d2a58e2a9461d
[ "MIT" ]
3
2019-11-26T00:59:12.000Z
2021-09-09T14:40:43.000Z
"""利用input输入数据""" a_input = input("Please give a String:") # 会将输入的值作为一个String来进行保存 print(a_input)
32.666667
65
0.744898
12
98
5.916667
0.666667
0.169014
0
0
0
0
0
0
0
0
0
0
0.102041
98
3
66
32.666667
0.806818
0.346939
0
0
0
0
0.355932
0
0
0
0
0
0
1
0
false
0
0
0
0
0.5
1
0
0
null
0
0
0
0
0
0
0
0
0
0
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
3
89c32a9a9661a39282ede3de541483c7ef4b16d3
44
py
Python
placeholderfile/__init__.py
theroyakash/placeholderfile
13b0bb72d6f67add714360dbe2b84257a51d602b
[ "Apache-2.0" ]
1
2020-10-13T09:49:47.000Z
2020-10-13T09:49:47.000Z
placeholderfile/__init__.py
theroyakash/placeholderfile
13b0bb72d6f67add714360dbe2b84257a51d602b
[ "Apache-2.0" ]
null
null
null
placeholderfile/__init__.py
theroyakash/placeholderfile
13b0bb72d6f67add714360dbe2b84257a51d602b
[ "Apache-2.0" ]
null
null
null
# Mention Version Number __version__ = '1.2'
22
24
0.75
6
44
4.833333
0.833333
0
0
0
0
0
0
0
0
0
0
0.052632
0.136364
44
2
25
22
0.710526
0.5
0
0
0
0
0.142857
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
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
89d4cd445abe867ad43eb72ec5159f2d4fc8d3aa
2,982
py
Python
scripts/house_history_gender.py
akosednar/congress-legislators
f36c1db486b5cecaa6e57bb0d6ac440997d3b58e
[ "CC0-1.0" ]
1
2019-06-09T23:46:31.000Z
2019-06-09T23:46:31.000Z
scripts/house_history_gender.py
Reform-to/congress-legislators
9be55fd53cc389fb4c7f70c24c754b8eab976f10
[ "CC0-1.0" ]
null
null
null
scripts/house_history_gender.py
Reform-to/congress-legislators
9be55fd53cc389fb4c7f70c24c754b8eab976f10
[ "CC0-1.0" ]
null
null
null
import re, urllib.request, urllib.parse from utils import yaml_load, yaml_dump def run(): # Use the House History Website's Women in Congress search results to get a list of IDs. # Because this requires a POST, our utils.download() function won't work. querystring = b"Command=Next&Term=Search&TermType=Last&ShowNonMember=true&ShowNonMember=false&Office=&Leadership=&State=&Party=&ContinentalCongress=false&BlackAmericansInCongress=false&WomenInCongress=true&WomenInCongress=false&CongressNumber=65&CongressNumber=66&CongressNumber=67&CongressNumber=68&CongressNumber=69&CongressNumber=70&CongressNumber=71&CongressNumber=72&CongressNumber=73&CongressNumber=74&CongressNumber=75&CongressNumber=76&CongressNumber=77&CongressNumber=78&CongressNumber=79&CongressNumber=80&CongressNumber=81&CongressNumber=82&CongressNumber=83&CongressNumber=84&CongressNumber=85&CongressNumber=86&CongressNumber=87&CongressNumber=88&CongressNumber=89&CongressNumber=90&CongressNumber=91&CongressNumber=92&CongressNumber=93&CongressNumber=94&CongressNumber=95&CongressNumber=96&CongressNumber=97&CongressNumber=98&CongressNumber=99&CongressNumber=100&CongressNumber=101&CongressNumber=102&CongressNumber=103&CongressNumber=104&CongressNumber=105&CongressNumber=106&CongressNumber=107&CongressNumber=108&CongressNumber=109&CongressNumber=110&CongressNumber=111&CongressNumber=112&CongressNumber=113&CurrentPage=__PAGE__&SortOrder=LastName&ResultType=Grid&PreviousSearch=Search%2CLast%2C%2C%2C%2C%2CFalse%2CFalse%2CTrue%2C65%2C66%2C67%2C68%2C69%2C70%2C71%2C72%2C73%2C74%2C75%2C76%2C77%2C78%2C79%2C80%2C81%2C82%2C83%2C84%2C85%2C86%2C87%2C88%2C89%2C90%2C91%2C92%2C93%2C94%2C95%2C96%2C97%2C98%2C99%2C100%2C101%2C102%2C103%2C104%2C105%2C106%2C107%2C108%2C109%2C110%2C111%2C112%2C113%2CLastName&X-Requested-With=XMLHttpRequest" women_house_history_ids = set() for pagenum in range(0, 25+1): body = urllib.request.urlopen( "http://history.house.gov/People/Search?Length=6", querystring.replace(b"__PAGE__", str(pagenum).encode("ascii")) ).read().decode("utf8") for match in re.findall(r"/People/Detail/(\d+)\?ret=True", body): women_house_history_ids.add(int(match)) # Now check and update the gender of all legislators. missing_ids = set() for fn in ("../legislators-current.yaml", "../legislators-historical.yaml"): legislators = yaml_load(fn) for p in legislators: house_history_id = p.get("id", {}).get("house_history") if not house_history_id: missing_ids.add(p.get("id", {}).get("bioguide")) continue p.setdefault("bio", {})["gender"] = "F" if house_history_id in women_house_history_ids else "M" if house_history_id in women_house_history_ids: women_house_history_ids.remove(house_history_id) yaml_dump(legislators, fn) print("%d women in Congress were not found in our files." % len(women_house_history_ids)) print("%d legislators are missing house_history IDs:" % len(missing_ids)) #print(missing_ids) if __name__ == '__main__': run()
72.731707
1,547
0.798793
413
2,982
5.636804
0.559322
0.072165
0.045103
0.051546
0.032646
0.032646
0.032646
0.032646
0.032646
0
0
0.103821
0.069752
2,982
41
1,548
72.731707
0.7354
0.076459
0
0
0
0.035714
0.661091
0.587636
0
0
0
0
0
1
0.035714
false
0
0.071429
0
0.107143
0.071429
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
1
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
89e413040f512a576053ba6523c14d20d54352bd
399
py
Python
basil/RL/FunctionalRegister.py
thirono/basil
99052482d9334dd1f5598eb2d2fb4d5399a32291
[ "BSD-3-Clause" ]
38
2015-02-15T20:56:44.000Z
2022-02-09T11:06:43.000Z
basil/RL/FunctionalRegister.py
thirono/basil
99052482d9334dd1f5598eb2d2fb4d5399a32291
[ "BSD-3-Clause" ]
152
2015-02-28T14:15:24.000Z
2022-03-10T08:54:24.000Z
basil/RL/FunctionalRegister.py
thirono/basil
99052482d9334dd1f5598eb2d2fb4d5399a32291
[ "BSD-3-Clause" ]
35
2015-02-19T17:30:26.000Z
2022-02-09T10:41:28.000Z
# # ------------------------------------------------------------ # Copyright (c) All rights reserved # SiLab, Institute of Physics, University of Bonn # ------------------------------------------------------------ # from basil.RL.RegisterLayer import RegisterLayer class FunctionalRegister(RegisterLayer): def __init__(self, driver, conf): RegisterLayer.__init__(self, driver, conf)
26.6
62
0.513784
31
399
6.354839
0.741935
0.081218
0.142132
0.182741
0
0
0
0
0
0
0
0
0.122807
399
14
63
28.5
0.562857
0.508772
0
0
0
0
0
0
0
0
0
0
0
1
0.25
false
0
0.25
0
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
0
1
0
0
3
89e91201558912138b786e930a0058206aa5bbf4
225
py
Python
LanguageBasics/strings/strings_exampels.py
Vamsi-TM/jubilant-train
a3ca0216e161ead4f59d923a36587098790beb5d
[ "MIT" ]
null
null
null
LanguageBasics/strings/strings_exampels.py
Vamsi-TM/jubilant-train
a3ca0216e161ead4f59d923a36587098790beb5d
[ "MIT" ]
null
null
null
LanguageBasics/strings/strings_exampels.py
Vamsi-TM/jubilant-train
a3ca0216e161ead4f59d923a36587098790beb5d
[ "MIT" ]
null
null
null
# This is all about using strings stg_1 = "this is the first message without a tab" print(stg_1) stg_2 = "\t this is the second message with a tab" print(stg_2) stg_3 = "this is another message with a newline\n" print(stg_3)
28.125
50
0.742222
46
225
3.5
0.5
0.149068
0.111801
0.149068
0
0
0
0
0
0
0
0.032432
0.177778
225
7
51
32.142857
0.837838
0.137778
0
0
0
0
0.619792
0
0
0
0
0
0
1
0
false
0
0
0
0
0.5
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
1
0
null
0
0
0
0
0
0
0
0
0
0
0
1
0
3
89f23adffd06a27aa6daba0bc18886efa088afc4
318
py
Python
example/private/__init__.py
tml/pyxer
4e3677b3f2c7f23ebf039a9ba9733f68a8460189
[ "MIT" ]
2
2016-01-25T06:01:14.000Z
2016-02-07T20:30:25.000Z
example/private/__init__.py
tml/pyxer
4e3677b3f2c7f23ebf039a9ba9733f68a8460189
[ "MIT" ]
2
2018-03-21T06:27:50.000Z
2018-03-22T12:57:58.000Z
example/private/__init__.py
tml/pyxer
4e3677b3f2c7f23ebf039a9ba9733f68a8460189
[ "MIT" ]
null
null
null
# -*- coding: UTF-8 -*- ############################################# ## (C)opyright by Dirk Holtwick, 2008 ## ## All rights reserved ## ############################################# from pyxer.base import * import logging log = logging.getLogger("website") here = os.path.dirname(__file__)
26.5
45
0.430818
27
318
4.925926
0.925926
0
0
0
0
0
0
0
0
0
0
0.019231
0.18239
318
11
46
28.909091
0.492308
0.257862
0
0
0
0
0.06087
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
3
89f3c15611b39dbeb201badd2bba50e2c2f28724
159
py
Python
pybaseball/enums/fangraphs/fangraphs_stats_category.py
reddigari/pybaseball
2d878cf3505ce0a5e657694ae967d6275dc3c211
[ "MIT" ]
650
2017-06-29T20:05:19.000Z
2022-03-31T03:27:25.000Z
pybaseball/enums/fangraphs/fangraphs_stats_category.py
reddigari/pybaseball
2d878cf3505ce0a5e657694ae967d6275dc3c211
[ "MIT" ]
216
2017-10-21T05:05:08.000Z
2022-03-31T04:04:53.000Z
pybaseball/enums/fangraphs/fangraphs_stats_category.py
reddigari/pybaseball
2d878cf3505ce0a5e657694ae967d6275dc3c211
[ "MIT" ]
214
2017-07-18T21:40:01.000Z
2022-03-29T03:19:55.000Z
from enum import Enum, unique @unique class FangraphsStatsCategory(Enum): NONE = None BATTING = 'bat' FIELDING = 'fld' PITCHING = 'pit'
15.9
35
0.63522
17
159
5.941176
0.764706
0
0
0
0
0
0
0
0
0
0
0
0.27044
159
9
36
17.666667
0.87069
0
0
0
0
0
0.056604
0
0
0
0
0
0
1
0
false
0
0.142857
0
0.857143
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
0
1
0
0
3
d61819ed37adb52966cccf58676797bfadf886c5
139
py
Python
fastcord/command/command.py
dskprt/botnolib
dd17aff956df0a54838980257249a7dfb725ab23
[ "MIT" ]
3
2020-03-17T13:08:42.000Z
2021-07-07T10:58:04.000Z
fastcord/command/command.py
dskprt/botnolib
dd17aff956df0a54838980257249a7dfb725ab23
[ "MIT" ]
1
2020-04-07T12:46:09.000Z
2020-04-07T12:46:09.000Z
fastcord/command/command.py
dskprt/botnolib
dd17aff956df0a54838980257249a7dfb725ab23
[ "MIT" ]
1
2020-04-12T17:37:32.000Z
2020-04-12T17:37:32.000Z
class Command: def __init__(self, name, desc="", args=[]): self.name = name self.desc = desc self.args = args
19.857143
47
0.539568
17
139
4.176471
0.470588
0.225352
0
0
0
0
0
0
0
0
0
0
0.323741
139
6
48
23.166667
0.755319
0
0
0
0
0
0
0
0
0
0
0
0
1
0.2
false
0
0
0
0.4
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
0
0
0
3
d625e20dc003494b3fc5fb6c8af90f6838b2aec8
468
py
Python
app.py
fsdev124/flask_dep
069f8cd9f344cd7374de7a0cb0dffa86ec4c2d5b
[ "MIT" ]
1
2021-10-04T06:48:25.000Z
2021-10-04T06:48:25.000Z
app.py
fsdev124/flask_dep
069f8cd9f344cd7374de7a0cb0dffa86ec4c2d5b
[ "MIT" ]
null
null
null
app.py
fsdev124/flask_dep
069f8cd9f344cd7374de7a0cb0dffa86ec4c2d5b
[ "MIT" ]
null
null
null
from dep_app import create_app from flask import render_template app = create_app() @app.errorhandler(500) @app.errorhandler(Exception) def internal_server_error(e): return render_template('500.html'), 500 @app.errorhandler(404) @app.errorhandler(405) def page_not_found(e): return render_template('404.html'), 404 @app.errorhandler(403) def page_forbidden(e): return render_template('403.html'), 500 if __name__ == '__main__': app.run(debug=True)
22.285714
43
0.754274
68
468
4.897059
0.455882
0.225225
0.117117
0.189189
0
0
0
0
0
0
0
0.072816
0.119658
468
21
44
22.285714
0.735437
0
0
0
0
0
0.06823
0
0
0
0
0
0
1
0.1875
false
0
0.125
0.1875
0.5
0
0
0
0
null
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
1
0
0
0
3
d62e11ed09d24cb19f6516ce300cc3bc71f836b4
1,135
py
Python
utils/tests/test_expl_expt.py
kmakeev/RLs
c47e9b504db157731c26d7c881719a4fb54cc355
[ "Apache-2.0" ]
5
2020-05-20T07:10:17.000Z
2022-02-11T03:15:25.000Z
utils/tests/test_expl_expt.py
kmakeev/RLs
c47e9b504db157731c26d7c881719a4fb54cc355
[ "Apache-2.0" ]
7
2020-09-26T00:43:02.000Z
2022-02-10T01:26:53.000Z
utils/tests/test_expl_expt.py
kmakeev/RLs
c47e9b504db157731c26d7c881719a4fb54cc355
[ "Apache-2.0" ]
1
2021-07-11T17:11:04.000Z
2021-07-11T17:11:04.000Z
import sys sys.path.append('../..') from utils.expl_expt import ExplorationExploitationClass def test_exploration_exploitation_class(): my_expl = ExplorationExploitationClass(eps_init=1, eps_mid=0.2, eps_final=0.01, eps_eval=0, init2mid_annealing_episode=50, start_episode=0, max_episode=100) assert my_expl.get_esp(0) == 1 assert my_expl.get_esp(0, evaluation=True) == 0 assert my_expl.get_esp(80, evaluation=True) == 0 assert my_expl.get_esp(2) < 1 assert my_expl.get_esp(50) == 0.2 assert my_expl.get_esp(51) < 0.2 assert my_expl.get_esp(100) >= 0.01 my_expl = ExplorationExploitationClass(eps_init=0.2, eps_mid=0.1, eps_final=0, eps_eval=0, init2mid_annealing_episode=1000, start_episode=0, max_episode=10000) assert my_expl.get_esp(0) == 0.2 assert my_expl.get_esp(0, evaluation=True) == 0 assert my_expl.get_esp(500, evaluation=True) == 0 assert my_expl.get_esp(500) < 0.2 assert my_expl.get_esp(1000) == 0.1 assert my_expl.get_esp(2000) < 0.1 assert my_expl.get_esp(9000) > 0
45.4
111
0.674009
183
1,135
3.907104
0.234973
0.134266
0.234965
0.293706
0.738462
0.559441
0.391608
0.246154
0.2
0.145455
0
0.094866
0.210573
1,135
24
112
47.291667
0.703125
0
0
0.090909
0
0
0.004405
0
0
0
0
0
0.636364
1
0.045455
false
0
0.090909
0
0.136364
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
0
0
0
0
0
0
0
3
d63d3e0a81d8b5abcc8a26c4a188c3871c1535d8
149
py
Python
ALPHABET.py
abphilip-codes/Codechef_Practice
21fd52e03df8a0f72a08b0e2a0b48dbd508aac95
[ "MIT" ]
2
2021-07-26T03:32:24.000Z
2021-07-31T02:32:14.000Z
ALPHABET.py
abphilip-codes/Codechef_Practice
21fd52e03df8a0f72a08b0e2a0b48dbd508aac95
[ "MIT" ]
null
null
null
ALPHABET.py
abphilip-codes/Codechef_Practice
21fd52e03df8a0f72a08b0e2a0b48dbd508aac95
[ "MIT" ]
1
2021-07-14T17:45:33.000Z
2021-07-14T17:45:33.000Z
# https://www.codechef.com/problems/ALPHABET s=input() for T in range(int(input())): print("Yes") if(set(input()).issubset(set(s))) else print("No")
37.25
93
0.677852
25
149
4.04
0.8
0
0
0
0
0
0
0
0
0
0
0
0.073826
149
4
93
37.25
0.731884
0.281879
0
0
0
0
0.04717
0
0
0
0
0
0
1
0
false
0
0
0
0
0.5
1
0
0
null
0
0
0
0
0
0
0
0
0
0
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
3
d6587df26229729a71fbd7b5a4f8ad0c35abc4df
5,349
py
Python
python/heterocl/tvm/contrib/nnpack.py
hj424/heterocl
e51b8f7f65ae6ad55c0c2426ab7192c3d8f6702b
[ "Apache-2.0" ]
236
2019-05-19T01:48:11.000Z
2022-03-31T09:03:54.000Z
python/heterocl/tvm/contrib/nnpack.py
hj424/heterocl
e51b8f7f65ae6ad55c0c2426ab7192c3d8f6702b
[ "Apache-2.0" ]
248
2019-05-17T19:18:36.000Z
2022-03-30T21:25:47.000Z
python/heterocl/tvm/contrib/nnpack.py
hj424/heterocl
e51b8f7f65ae6ad55c0c2426ab7192c3d8f6702b
[ "Apache-2.0" ]
85
2019-05-17T20:09:27.000Z
2022-02-28T20:19:00.000Z
"""External function interface to NNPACK libraroes.""" from __future__ import absolute_import as _abs from .. import api as _api from .. import intrin as _intrin from .._ffi.function import _init_api def config(nthreads): """Configure the nnpack library. Parameters ---------- nthreads : int The threads number of nnpack thread pool, must be a nonnegative. """ _Config(nthreads) def fully_connected_inference(lhs, rhs, nthreads=1): """Create an extern op that compute fully connected of 1D tensor lhs and 2D tensor rhs with nnpack. Parameters ---------- lhs : Tensor lhs 1D array input[input_channels] of FP32 elements rhs : Tensor lhs 2D matrix kernel[output_channels][input_channels] of FP32 elements Returns ------- C : Tensor lhs 1D array out[output_channels] of FP32 elements. """ m = rhs.shape[0] return _api.extern( (m, ), [lhs, rhs], lambda ins, outs: _intrin.call_packed( "tvm.contrib.nnpack.fully_connected_inference", ins[0], ins[1], outs[0], nthreads), name="C") def fully_connected_output(lhs, rhs, nthreads=1): """Create an extern op that compute fully connected of 2D tensor lhs and 2D tensor rhs with nnpack. Parameters ---------- lhs : Tensor lhs 2D matrix input[batch_size][input_channels] of FP32 elements rhs : Tensor lhs 2D matrix kernel[output_channels][input_channels] of FP32 elements Returns ------- C : Tensor lhs 2D array out[batch_size][output_channels] of FP32 elements. """ n = lhs.shape[0] m = rhs.shape[0] return _api.extern( (n, m), [lhs, rhs], lambda ins, outs: _intrin.call_packed( "tvm.contrib.nnpack.fully_connected_output", ins[0], ins[1], outs[0], nthreads), name="C") def convolution_inference(data, kernel, bias, padding, stride, nthreads=1): """Create an extern op to do inference convolution of 3D tensor data and 4D tensor kernel and 1D tensor bias with nnpack. Parameters ---------- data : Tensor data 3D tensor input[input_channels][input_height][input_width] of FP32 elements. kernel : Tensor kernel 4D tensor kernel[output_channels][input_channels][kernel_height] [kernel_width] of FP32 elements. bias : Tensor bias 1D array bias[output_channels][input_channels][kernel_height] [kernel_width] of FP32 elements. padding : list padding A 4-dim list of [pad_top, pad_bottom, pad_left, pad_right], which indicates the padding around the feature map. stride : list stride A 2-dim list of [stride_height, stride_width], which indicates the stride. Returns ------- output : Tensor output 3D tensor output[output_channels][output_height][output_width] of FP32 elements. """ assert isinstance(padding, list) and len(padding) == 4 assert isinstance(stride, list) and len(stride) == 2 _, input_height, input_width = data.shape output_channels, _, kernel_height, kernel_width = kernel.shape output_height = (input_height + padding[0] + padding[1] - kernel_height) / stride[0] + 1 output_width = (input_width + padding[0] + padding[1] - kernel_width) / stride[1] + 1 return _api.extern( (output_channels, output_height, output_width), [data, kernel, bias], lambda ins, outs: _intrin.call_packed( "tvm.contrib.nnpack.convolution_inference", ins[0], ins[1], ins[2], outs[0], padding[0], padding[1], padding[2], padding[3], stride[0], stride[1], nthreads), name="C") def convolution_output(data, kernel, bias, padding, nthreads=1): """Create an extern op to compute convolution of 4D tensor data and 4D tensor kernel and 1D tensor bias with nnpack. Parameters ---------- data : Tensor data 4D tensor input[batch_size][input_channels][input_height] [input_width] of FP32 elements. kernel : Tensor kernel 4D tensor kernel[output_channels][input_channels][kernel_height] [kernel_width] of FP32 elements. bias : Tensor bias 1D array bias[output_channels][input_channels][kernel_height] [kernel_width] of FP32 elements. padding : list padding A 4-dim list of [pad_top, pad_bottom, pad_left, pad_right], which indicates the padding around the feature map. Returns ------- output : Tensor output 4D tensor output[batch_size][output_channels][output_height] [output_width] of FP32 elements. """ assert isinstance(padding, list) and len(padding) == 4 batch, _, input_height, input_width = data.shape output_channels, _, kernel_height, kernel_width = kernel.shape output_height = (input_height + padding[0] + padding[1] - kernel_height) + 1 output_width = (input_width + padding[0] + padding[1] - kernel_width) + 1 return _api.extern( (batch, output_channels, output_height, output_width), [data, kernel, bias], lambda ins, outs: _intrin.call_packed( "tvm.contrib.nnpack.convolution_output", ins[0], ins[1], ins[2], outs[0], padding[0], padding[1], padding[2], padding[3], nthreads), name="C") _init_api("tvm.contrib.nnpack")
36.141892
92
0.656384
706
5,349
4.803116
0.147309
0.024771
0.0578
0.044825
0.757299
0.712474
0.712474
0.681805
0.681805
0.681805
0
0.025165
0.23481
5,349
147
93
36.387755
0.803323
0.485137
0
0.347826
0
0
0.076002
0.066915
0
0
0
0
0.065217
1
0.108696
false
0
0.086957
0
0.282609
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
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
d65a16c7f70fadf7abca0b560d54fa8e1ce92780
141
py
Python
HackerRank/Python/zipped.py
nayanapardhekar/Python
55ea0cc1dd69192b25cb71358cd03cc2ce13be0a
[ "MIT" ]
37
2019-04-03T07:19:57.000Z
2022-01-09T06:18:41.000Z
HackerRank/Python/zipped.py
nayanapardhekar/Python
55ea0cc1dd69192b25cb71358cd03cc2ce13be0a
[ "MIT" ]
16
2020-08-11T08:09:42.000Z
2021-10-30T17:40:48.000Z
HackerRank/Python/zipped.py
nayanapardhekar/Python
55ea0cc1dd69192b25cb71358cd03cc2ce13be0a
[ "MIT" ]
130
2019-10-02T14:40:20.000Z
2022-01-26T17:38:26.000Z
n1,n2=map(int,input().split()) a=[] for i in range(n2): a.append(list(map(float,input().split()))) for i in zip(*a): print(sum(i)/n2)
23.5
46
0.595745
28
141
3
0.607143
0.238095
0.142857
0
0
0
0
0
0
0
0
0.032787
0.134752
141
6
47
23.5
0.655738
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0
0
0
0.166667
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
0
0
3
c3862fda4eb67afcfb2db56a8890a3f5387fcaff
269
py
Python
homeassistant/components/unifiprotect/models.py
andersop91/core
0e0ef0aa17073609eae7c974cf4c73306b7c414b
[ "Apache-2.0" ]
546
2019-12-28T13:37:24.000Z
2022-03-29T18:48:54.000Z
homeassistant/components/unifiprotect/models.py
andersop91/core
0e0ef0aa17073609eae7c974cf4c73306b7c414b
[ "Apache-2.0" ]
358
2020-01-01T11:17:24.000Z
2022-02-03T17:34:00.000Z
homeassistant/components/unifiprotect/models.py
andersop91/core
0e0ef0aa17073609eae7c974cf4c73306b7c414b
[ "Apache-2.0" ]
51
2020-01-12T21:35:06.000Z
2022-02-01T06:26:27.000Z
"""The unifiprotect integration models.""" from __future__ import annotations from dataclasses import dataclass @dataclass class ProtectRequiredKeysMixin: """Mixin for required keys.""" ufp_required_field: str | None = None ufp_value: str | None = None
20.692308
42
0.743494
30
269
6.433333
0.7
0.072539
0.11399
0
0
0
0
0
0
0
0
0
0.174721
269
12
43
22.416667
0.869369
0.226766
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.333333
0
0.833333
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
0
1
0
1
0
1
0
0
3
c3ce7d3c7bcbe4ae7b27d424f835d5edac6cc320
7,883
py
Python
blockfrost/api/cardano/addresses.py
Parietal/blockfrost-python
9db5113e96ad40137128bce78917837f532e2a9d
[ "Apache-2.0" ]
1
2022-01-17T14:26:05.000Z
2022-01-17T14:26:05.000Z
blockfrost/api/cardano/addresses.py
Parietal/blockfrost-python
9db5113e96ad40137128bce78917837f532e2a9d
[ "Apache-2.0" ]
null
null
null
blockfrost/api/cardano/addresses.py
Parietal/blockfrost-python
9db5113e96ad40137128bce78917837f532e2a9d
[ "Apache-2.0" ]
null
null
null
import requests from dataclasses import dataclass from blockfrost.utils import object_request_wrapper, object_list_request_wrapper @dataclass class AddressResponse: @dataclass class Amount: unit: str quantity: str address: str amount: [Amount] stake_address: str type: str script: bool def __init__(self, address: str, amount: [Amount], stake_address: str, type: str, script: bool) -> None: self.address = address self.amount = [self.Amount(**o) for o in amount] self.stake_address = stake_address self.type = type self.script = script @object_request_wrapper(AddressResponse) def address(self, address: str, **kwargs): """ Obtain information about a specific address. https://docs.blockfrost.io/#tag/Cardano-Addresses/paths/~1addresses~1{address}/get :param address: Bech32 address. :type address: str :param return_type: Optional. "object", "json" or "pandas". Default: "object". :type return_type: str :returns AddressResponse object. :rtype AddressResponse :raises ApiError: If API fails :raises Exception: If the API response is somehow malformed. """ return requests.get( url=f"{self.url}/addresses/{address}", headers=self.default_headers ) @dataclass class AddressesTotalResponse: @dataclass class Sum: unit: str quantity: str address: str received_sum: [Sum] sent_sum: [Sum] tx_count: int def __init__(self, address: str, received_sum: [Sum], sent_sum: [Sum], tx_count: int) -> None: self.address = address self.received_sum = [self.Sum(**o) for o in received_sum] self.sent_sum = [self.Sum(**o) for o in sent_sum] self.tx_count = tx_count @object_request_wrapper(AddressesTotalResponse) def address_total(self, address: str, **kwargs): """ Obtain details about an address. https://docs.blockfrost.io/#tag/Cardano-Addresses/paths/~1addresses~1{address}~1total/get :param address: Bech32 address. :type address: str :param return_type: Optional. "object", "json" or "pandas". Default: "object". :type return_type: str :returns AddressesTotalResponse object. :rtype AddressesTotalResponse :raises ApiError: If API fails :raises Exception: If the API response is somehow malformed. """ return requests.get( url=f"{self.url}/addresses/{address}/total", headers=self.default_headers ) @dataclass class AddressesUTXOSResponse: @dataclass class Amount: unit: str quantity: str tx_hash: str output_index: int amount: [Amount] block: str data_hash: str def __init__(self, tx_hash: str, output_index: int, amount: [Amount], block: str, data_hash: str) -> None: self.tx_hash = tx_hash self.output_index = output_index self.amount = [self.Amount(**o) for o in amount] self.block = block self.data_hash = data_hash @object_list_request_wrapper(AddressesUTXOSResponse) def address_utxos(self, address: str, **kwargs): """ UTXOs of the address. https://docs.blockfrost.io/#tag/Cardano-Addresses/paths/~1addresses~1{address}~1utxos/get :param address: Bech32 address. :type address: str :param return_type: Optional. "object", "json" or "pandas". Default: "object". :type return_type: str :param gather_pages: Optional. Default: 100. Will collect all pages into one return :type gather_pages: bool :param count: Optional. Default: 1. The number of results displayed on one page. :type count: int :param page: Optional. The page number for listing the results. :type page: int :param order: Optional. "asc" or "desc". Default: "asc". :type order: str :returns A list of AddressesUTXOSResponse objects. :rtype [AddressesUTXOSResponse] :raises ApiError: If API fails :raises Exception: If the API response is somehow malformed. """ return requests.get( url=f"{self.url}/addresses/{address}/utxos", params=self.query_parameters(kwargs), headers=self.default_headers ) @dataclass class AddressesUTXOSAssetResponse: @dataclass class Amount: unit: str quantity: str tx_hash: str output_index: int amount: [Amount] block: str data_hash: str def __init__(self, tx_hash: str, output_index: int, amount: [Amount], block: str, data_hash: str) -> None: self.tx_hash = tx_hash self.output_index = output_index self.amount = [self.Amount(**o) for o in amount] self.block = block self.data_hash = data_hash @object_list_request_wrapper(AddressesUTXOSAssetResponse) def address_utxos_asset(self, address: str, asset: str, **kwargs): """ UTXOs of the address. https://docs.blockfrost.io/#tag/Cardano-Addresses/paths/~1addresses~1{address}~1utxos~1{asset}/get :param address: Bech32 address. :type address: str :param asset: Concatenation of the policy_id and hex-encoded asset_name. :type asset: str :param return_type: Optional. "object", "json" or "pandas". Default: "object". :type return_type: str :param gather_pages: Optional. Default: 100. Will collect all pages into one return :type gather_pages: bool :param count: Optional. Default: 1. The number of results displayed on one page. :type count: int :param page: Optional. The page number for listing the results. :type page: int :param order: Optional. "asc" or "desc". Default: "asc". :type order: str :returns A list of AddressesUTXOSAssetResponse objects. :rtype [AddressesUTXOSAssetResponse] :raises ApiError: If API fails :raises Exception: If the API response is somehow malformed. """ return requests.get( url=f"{self.url}/addresses/{address}/utxos/{asset}", params=self.query_parameters(kwargs), headers=self.default_headers ) @dataclass class AddressesTransactionResponse: tx_hash: str tx_index: int block_height: int @object_list_request_wrapper(AddressesTransactionResponse) def address_transactions(self, address: str, from_block: str = None, to_block: str = None, **kwargs): """ Transactions on the address. https://docs.blockfrost.io/#tag/Cardano-Addresses/paths/~1addresses~1{address}~1transactions/get :param address: Bech32 address. :type address: str :param from: The block number and optionally also index from which (inclusive) to start search for results, concatenated using colon. Has to be lower than or equal to to parameter. :type from: str :param to: The block number and optionally also index where (inclusive) to end the search for results, concatenated using colon. Has to be higher than or equal to from parameter. :type to: str :param return_type: Optional. "object", "json" or "pandas". Default: "object". :type return_type: str :param gather_pages: Optional. Default: 100. Will collect all pages into one return :type gather_pages: bool :param count: Optional. Default: 1. The number of results displayed on one page. :type count: int :param page: Optional. The page number for listing the results. :type page: int :param order: Optional. "asc" or "desc". Default: "asc". :type order: str :returns A list of AddressesUTXOSResponse objects. :rtype [AddressesUTXOSResponse] :raises ApiError: If API fails :raises Exception: If the API response is somehow malformed. """ return requests.get( url=f"{self.url}/addresses/{address}/transactions", params={ 'from': from_block, 'to': to_block, **self.query_parameters(kwargs) }, headers=self.default_headers )
32.709544
184
0.678929
997
7,883
5.255767
0.142427
0.030534
0.018702
0.006679
0.766603
0.743321
0.725
0.697519
0.687977
0.652863
0
0.006029
0.221489
7,883
240
185
32.845833
0.847808
0.481035
0
0.544643
0
0
0.05249
0.050875
0
0
0
0
0
1
0.080357
false
0
0.026786
0
0.428571
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
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3
c3d0004a7dace442dc0e3e044cc5767011d81ba6
2,032
py
Python
python/meillionen/settings.py
openmodelingfoundation/meillionen
69a534699ab2ee09d720262c7a78b86e802ee9ba
[ "MIT-0" ]
1
2020-09-18T11:57:31.000Z
2020-09-18T11:57:31.000Z
python/meillionen/settings.py
openmodelingfoundation/meillionen
69a534699ab2ee09d720262c7a78b86e802ee9ba
[ "MIT-0" ]
67
2020-07-23T05:39:54.000Z
2022-03-18T20:23:39.000Z
python/meillionen/settings.py
openmodelingfoundation/meillionen
69a534699ab2ee09d720262c7a78b86e802ee9ba
[ "MIT-0" ]
1
2021-05-26T05:20:53.000Z
2021-05-26T05:20:53.000Z
import os.path import pyarrow as pa import pyarrow.dataset as pad from typing import Any, Dict from pydantic import BaseModel class Settings(BaseModel): """ Settings for a module. Currently used only to turn partial resource payloads into resource payloads. In the future it may have information about logging and how to access particular common resources (such as databases). """ base_path: str def trial(self, name: str): """ Used to build 'trial' settings objects which extend the base path of the settings object. """ return self.__class__(base_path=os.path.join(self.base_path, name)) class Partitioning: """ Describes additional data to be used to build up partial resource payload objects. Commonly used when broadcasting a model over a grid with different resources available at each grid point. Also useful for sensitivity analysis. """ def __init__(self, schema: pa.Schema): self.schema = schema @property def names(self): return self.schema.names def to_arrow(self): """ Convert the partition into a `pyarrow` partition so that final results can be loaded as partitioned parquet files (which are supported by pyarrow, spark, datafusion and other libraries) """ return pad.partitioning(self.schema) def complete(self, **kwargs): """ Build a partition object with the data filled in for each missing partition key """ return Partition(self, kwargs=kwargs) class Partition: def __init__(self, partitioning: Partitioning, kwargs: Dict[str, Any]): # FIXME: check to make sure that kwargs match partition key names and types self.partitioning = partitioning self.kwargs = kwargs def to_path(self): """ Build a partial file path with the partition information """ return os.path.join(*(str(self.kwargs[name]) for name in self.partitioning.names))
30.787879
97
0.675197
264
2,032
5.132576
0.443182
0.023616
0.016236
0
0
0
0
0
0
0
0
0
0.255413
2,032
66
98
30.787879
0.895572
0.461122
0
0
0
0
0
0
0
0
0
0.015152
0
1
0.28
false
0
0.2
0.04
0.84
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
1
0
0
1
0
0
0
0
1
0
0
3
c3dd395319d0770d6ef5eb540d70cad9da6095b4
66
py
Python
bot/plugins/urban_dictionary/__init__.py
best-coloc-ever/globibot
a4c4dd8bb3b71bff09bd2e1c4c5ce58ab1bad176
[ "MIT" ]
14
2016-02-03T16:47:01.000Z
2019-12-09T14:24:25.000Z
bot/plugins/urban_dictionary/__init__.py
best-coloc-ever/globibot
a4c4dd8bb3b71bff09bd2e1c4c5ce58ab1bad176
[ "MIT" ]
11
2016-08-19T22:00:25.000Z
2022-01-13T00:39:48.000Z
bot/plugins/urban_dictionary/__init__.py
best-coloc-ever/globibot
a4c4dd8bb3b71bff09bd2e1c4c5ce58ab1bad176
[ "MIT" ]
6
2016-08-19T21:30:58.000Z
2019-09-27T05:24:08.000Z
from .plugin import UrbanDictionary plugin_cls = UrbanDictionary
16.5
35
0.848485
7
66
7.857143
0.714286
0
0
0
0
0
0
0
0
0
0
0
0.121212
66
3
36
22
0.948276
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
0
1
0
0
null
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
3
7f17239d2f9a319f26086b5cf45aee97b091cebb
213
py
Python
AIProject/enum/cardinals.py
Mighstye/uqac_IAProject
4b3f84ede95c87f145b9fc091fefe97dd43f9ac7
[ "MIT" ]
null
null
null
AIProject/enum/cardinals.py
Mighstye/uqac_IAProject
4b3f84ede95c87f145b9fc091fefe97dd43f9ac7
[ "MIT" ]
null
null
null
AIProject/enum/cardinals.py
Mighstye/uqac_IAProject
4b3f84ede95c87f145b9fc091fefe97dd43f9ac7
[ "MIT" ]
null
null
null
from enum import Enum # Enum for cardinals, make it possible to have objects for cardinal direction/orientation class Cardinals(Enum): NORTH = 'north' SOUTH = 'south' WEST = 'west' EAST = 'east'
21.3
89
0.685446
28
213
5.214286
0.678571
0
0
0
0
0
0
0
0
0
0
0
0.230047
213
9
90
23.666667
0.890244
0.408451
0
0
0
0
0.145161
0
0
0
0
0
0
1
0
false
0
0.166667
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
0
0
1
0
0
3
7f21af5d9c9b71ebe1b11526b45484b97c3cfeaf
55
py
Python
atcoder/abc/b034.py
tomato-300yen/coding
db6f440a96d8c83f486005c650461a69f27e3926
[ "MIT" ]
null
null
null
atcoder/abc/b034.py
tomato-300yen/coding
db6f440a96d8c83f486005c650461a69f27e3926
[ "MIT" ]
null
null
null
atcoder/abc/b034.py
tomato-300yen/coding
db6f440a96d8c83f486005c650461a69f27e3926
[ "MIT" ]
null
null
null
n = int(input()) print(n + 1 if n % 2 == 1 else n - 1)
18.333333
37
0.490909
13
55
2.076923
0.615385
0.148148
0
0
0
0
0
0
0
0
0
0.102564
0.290909
55
2
38
27.5
0.589744
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0
0
0
0.5
1
0
0
null
0
0
0
0
0
0
0
0
0
0
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
3
612ed1b2f72ef0cc0cce2dbc11ed46da9846fbdb
8,380
py
Python
src/tests/test_rsmq.py
ChuckHend/PyRSMQ
bcb40d084c0789cedb4624273bcb1070e7a08b17
[ "Apache-2.0" ]
30
2019-02-11T10:00:56.000Z
2022-03-24T22:36:49.000Z
src/tests/test_rsmq.py
ChuckHend/PyRSMQ
bcb40d084c0789cedb4624273bcb1070e7a08b17
[ "Apache-2.0" ]
14
2020-02-14T14:07:08.000Z
2022-02-04T23:55:29.000Z
src/tests/test_rsmq.py
ChuckHend/PyRSMQ
bcb40d084c0789cedb4624273bcb1070e7a08b17
[ "Apache-2.0" ]
6
2019-03-12T08:13:54.000Z
2022-02-05T15:06:31.000Z
''' Baseline Unit Test ''' import difflib import os.path import pprint import unittest from unittest.util import safe_repr import fakeredis from rsmq.rsmq import RedisSMQ BASE_DIR = os.path.dirname(os.path.dirname(__file__)) class TestUnitTests(unittest.TestCase): ''' Unit Test RedisSMQ''' def setUp(self): ''' Setup ''' def assertQueueAttributes(self, expected, actual, msg=None): ''' assert queue attributes are set ''' self.assertIsInstance( expected, dict, 'First argument is not a dictionary') self.assertIsInstance( actual, dict, 'Second argument is not a dictionary') actual_short = {key: actual[key] for key in expected.keys()} if not expected.items() <= actual.items(): diff = ('\n' + '\n'.join(difflib.ndiff( pprint.pformat(expected).splitlines(), pprint.pformat(actual_short).splitlines()))) standardMsg = '%s !<= %s' % ( safe_repr(expected), safe_repr(actual_short)) standardMsg = self._truncateMessage(standardMsg, diff) msg = self._formatMessage(msg, standardMsg) raise AssertionError(msg) def test_unittest(self): ''' Check Unit Test Framework ''' unittest_loaded = True self.assertTrue(unittest_loaded) def test_qname_good_validation(self): ''' Test Good QName validation ''' client = fakeredis.FakeStrictRedis(decode_responses=True) client.flushall() queue = RedisSMQ(client=client, exceptions=False) GOOD_QUEUE_NAMES = ['simple', 'with_underscore', 'with-dash', '-start', 'with\x01\x02\x03binary'] for qname in GOOD_QUEUE_NAMES: self.assertTrue(queue.getQueueAttributes().qname(qname).ready()) def test_qname_bad_validation(self): ''' Test bad QName validation ''' client = fakeredis.FakeStrictRedis(decode_responses=True) client.flushall() queue = RedisSMQ(client=client, exceptions=False) BAD_QUEUE_NAMES = ['', None, 'something:else', ':', 'something:', ':else'] for qname in BAD_QUEUE_NAMES: self.assertFalse(queue.getQueueAttributes().qname(qname).ready()) def test_create_queue_default(self): ''' Test Creating of the Queue ''' client = fakeredis.FakeStrictRedis(decode_responses=True) client.flushall() queue = RedisSMQ(client=client) queue_name = 'test-queue' queue_key = 'rsmq:%s:Q' % queue_name queue.createQueue().qname(queue_name).execute() keys = client.keys('*') self.assertListEqual(sorted([queue_key, 'rsmq:QUEUES']), sorted(keys)) queues = client.smembers('rsmq:QUEUES') self.assertSetEqual(set([queue_name]), queues) queue_details = client.hgetall(queue_key) self.assertTrue( {'vt': '30', 'delay': '0', 'maxsize': '65565'}.items() <= queue_details.items()) def test_create_queue_custom(self): ''' Test Creating of the Queue ''' client = fakeredis.FakeStrictRedis(decode_responses=True) client.flushall() queue = RedisSMQ(client=client) queue_name = 'test-queue-2' queue_key = 'rsmq:%s:Q' % queue_name queue.createQueue(qname=queue_name, vt=15).delay(10).execute() keys = client.keys('*') self.assertListEqual(sorted([queue_key, 'rsmq:QUEUES']), sorted(keys)) queues = client.smembers('rsmq:QUEUES') self.assertSetEqual(set([queue_name]), queues) queue_details = client.hgetall(queue_key) self.assertTrue( {'vt': '15', 'delay': '10', 'maxsize': '65565'}.items() <= queue_details.items()) def test_delete_queue(self): ''' Test Deleting of the Queue ''' client = fakeredis.FakeStrictRedis(decode_responses=True) client.flushall() queue = RedisSMQ(client=client) queue_name = 'test-queue-delete' queue_key = 'rsmq:%s:Q' % queue_name queue.createQueue().qname(queue_name).execute() keys = client.keys('*') self.assertListEqual(sorted([queue_key, 'rsmq:QUEUES']), sorted(keys)) queues = client.smembers('rsmq:QUEUES') self.assertSetEqual(set([queue_name]), queues) queue_details = client.hgetall(queue_key) self.assertTrue( {'vt': '30', 'delay': '0', 'maxsize': '65565'}.items() <= queue_details.items()) result = queue.deleteQueue(qname=queue_name).execute() self.assertEqual(result, True) queue_details = client.hgetall(queue_key) self.assertEqual(queue_details, {}) def test_queue_attributes(self): ''' Test Getting/Setting of the Queue Attribues''' client = fakeredis.FakeStrictRedis(decode_responses=True) client.flushall() queue_name = 'test-queue-attr' queue = RedisSMQ(client=client, qname=queue_name) queue_key = 'rsmq:%s:Q' % queue_name queue.createQueue(vt=15, delay=10).execute() keys = client.keys('*') self.assertListEqual(sorted([queue_key, 'rsmq:QUEUES']), sorted(keys)) queues = client.smembers('rsmq:QUEUES') self.assertSetEqual(set([queue_name]), queues) queue_details = client.hgetall(queue_key) self.assertQueueAttributes( {'vt': '15', 'delay': '10', 'maxsize': '65565'}, queue_details) attributes = queue.getQueueAttributes(qname=queue_name).execute() self.assertQueueAttributes({'vt': 15, 'delay': 10, 'maxsize': 65565, 'totalrecv': 0, 'totalsent': 0, 'msgs': 0, 'hiddenmsgs': 0}, attributes) attributes_1 = queue.setQueueAttributes( vt=30, maxsize=1024, delay=1).execute() attributes = queue.getQueueAttributes(qname=queue_name).execute() self.assertDictEqual(attributes, attributes_1) self.assertQueueAttributes({'vt': 30, 'delay': 1, 'maxsize': 1024, 'totalrecv': 0, 'totalsent': 0, 'msgs': 0, 'hiddenmsgs': 0}, attributes) def test_invalid_queue_attributes(self): ''' Test Getting/Setting of the Queue Attribues''' client = fakeredis.FakeStrictRedis(decode_responses=True) client.flushall() queue_name = 'test-queue-attr' queue = RedisSMQ(client=client, qname=queue_name) queue_key = 'rsmq:%s:Q' % queue_name queue.createQueue(vt=15, delay=10).execute() keys = client.keys('*') self.assertListEqual(sorted([queue_key, 'rsmq:QUEUES']), sorted(keys)) queues = client.smembers('rsmq:QUEUES') self.assertSetEqual(set([queue_name]), queues) queue_details = client.hgetall(queue_key) self.assertQueueAttributes( {'vt': '15', 'delay': '10', 'maxsize': '65565'}, queue_details) attributes = queue.getQueueAttributes(qname=queue_name).execute() self.assertQueueAttributes({'vt': 15, 'delay': 10, 'maxsize': 65565, 'totalrecv': 0, 'totalsent': 0, 'msgs': 0, 'hiddenmsgs': 0}, attributes) attributes_1 = queue.setQueueAttributes( vt=-3, maxsize=-2, delay=-1).execute() attributes = queue.getQueueAttributes(qname=queue_name).execute() self.assertDictEqual(attributes, attributes_1) self.assertQueueAttributes({'vt': 15, 'delay': 10, 'maxsize': 65565, 'totalrecv': 0, 'totalsent': 0, 'msgs': 0, 'hiddenmsgs': 0}, attributes) if __name__ == '__main__': unittest.main()
43.195876
93
0.565871
814
8,380
5.683047
0.17199
0.048638
0.02594
0.021401
0.728275
0.712495
0.710549
0.683096
0.672719
0.662776
0
0.02175
0.308711
8,380
193
94
43.419689
0.7768
0.039499
0
0.64557
0
0
0.088276
0.002759
0
0
0
0
0.189873
1
0.063291
false
0
0.044304
0
0.113924
0.018987
0
0
0
null
0
0
0
0
1
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
3