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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
275018bdfc9f8b8b7cd120a44b68ef97215e1468 | 668 | py | Python | stats/urls.py | RossBrunton/RThing | 9c9b352b93eab4ff1f841cbca9ea3c1a0d6f6929 | [
"MIT"
] | null | null | null | stats/urls.py | RossBrunton/RThing | 9c9b352b93eab4ff1f841cbca9ea3c1a0d6f6929 | [
"MIT"
] | null | null | null | stats/urls.py | RossBrunton/RThing | 9c9b352b93eab4ff1f841cbca9ea3c1a0d6f6929 | [
"MIT"
] | null | null | null | """Urls for the stats app, this should be the namespace "stats" """
from django.conf.urls import patterns, include, url
import stats.views as views
urlpatterns = patterns('',
url(r"^(?P<course>[a-z0-9-]+)/(?P<lesson>[a-z0-9-]+)$", views.lesson, name="lesson"),
url(r"^~answers/(?P<task>[0-9]+)$", views.wrong, name="wrong"),
url(r"^(?P<course>[a-z0-9-]+)/(?P<lesson>[a-z0-9-]+)/user/(?P<name>[0-9a-zA-Z_@.+-]+)$", views.user, name="user"),
url(r"^csv/(?P<course>[a-z0-9-]+)/(?P<lesson>[a-z0-9-]+)$", views.csv_lesson, name="csv_lesson"),
url(r"^csv/(?P<course>[a-z0-9-]+)/(?P<lesson>[a-z0-9-]+)/users$",views.csv_users, name="csv_users"),
)
| 47.714286 | 118 | 0.588323 | 115 | 668 | 3.373913 | 0.321739 | 0.061856 | 0.082474 | 0.103093 | 0.309278 | 0.309278 | 0.309278 | 0.309278 | 0.309278 | 0.309278 | 0 | 0.033278 | 0.100299 | 668 | 13 | 119 | 51.384615 | 0.612313 | 0.08982 | 0 | 0 | 0 | 0.444444 | 0.492512 | 0.43594 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.222222 | 0 | 0.222222 | 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 | 1 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
276c2140a9abe8c6f550f13ad1f6bf391961400f | 667 | py | Python | predict.py | BSH-Werkstatt/datatrain-ml | 174acb81b43b975b1a9ae2487cfff073984a4693 | [
"MIT"
] | null | null | null | predict.py | BSH-Werkstatt/datatrain-ml | 174acb81b43b975b1a9ae2487cfff073984a4693 | [
"MIT"
] | null | null | null | predict.py | BSH-Werkstatt/datatrain-ml | 174acb81b43b975b1a9ae2487cfff073984a4693 | [
"MIT"
] | null | null | null | from keras.preprocessing.image import load_img
from keras.preprocessing.image import img_to_array
from mrcnn.visualize import display_instances
from mrcnn.config import Config
from mrcnn.model import MaskRCNN
import model_setup as m
rcnn, class_names = m.define_model()
#filename = input('Select picture to predict: ')
filename = 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQQp5rYjpSKfkVva_JRE6EgIaObdbjdxDmiPPxaUa2B814373yl'
#while filename != '':
prediction, image = m.predict_img(filename, rcnn)
m.visualize(prediction, image, class_names)
#print(prediction)
# filename = input('\nSelect picture to predict: ')
#cv2.imwrite('predicted.jpg', image) | 35.105263 | 117 | 0.7991 | 87 | 667 | 6.011494 | 0.528736 | 0.051625 | 0.08413 | 0.10325 | 0.126195 | 0 | 0 | 0 | 0 | 0 | 0 | 0.019967 | 0.098951 | 667 | 19 | 118 | 35.105263 | 0.85025 | 0.254873 | 0 | 0 | 0 | 0 | 0.210953 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.6 | 0 | 0.6 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
2782c092350d62779f11de75c2bfb438c1ea6d8a | 2,603 | py | Python | app/models/models.py | ngocjr7/scoss_webapp | cb86b9dda509f2fc0d4d5c03566fcd7f13186c83 | [
"MIT"
] | 3 | 2021-05-10T04:10:58.000Z | 2022-01-06T13:36:45.000Z | app/models/models.py | ngocjr7/scoss_webapp | cb86b9dda509f2fc0d4d5c03566fcd7f13186c83 | [
"MIT"
] | 4 | 2020-10-16T09:12:34.000Z | 2021-04-03T07:48:39.000Z | app/models/models.py | ngocjr7/scoss_webapp | cb86b9dda509f2fc0d4d5c03566fcd7f13186c83 | [
"MIT"
] | 1 | 2021-05-07T16:22:39.000Z | 2021-05-07T16:22:39.000Z | from __future__ import absolute_import
from flask_mongoengine import MongoEngine
import datetime
from flask_jwt_extended import verify_jwt_in_request, get_jwt
from flask import jsonify
from functools import wraps
db = MongoEngine()
class Status():
init = 1
failed = 2
waiting = 3
running = 4
checked = 5
class MessageStatus():
error = 'danger'
success = 'success'
warning = 'warning'
class User(db.Document):
user_id = db.StringField(required=True, unique=True)
username = db.StringField(required=True, unique=True)
password = db.StringField()
email = db.StringField()
public_token = db.StringField()
role = db.IntField() # 0- admin, 1-user
class Contest(db.Document):
contest_id = db.StringField(required=True, unique=True)
contest_name = db.StringField()
metrics = db.ListField()
user_id = db.StringField(required=True)
contest_status = db.IntField(required=True)
created_at = db.DateTimeField(required=True, default=datetime.datetime.utcnow)
class Problem(db.Document):
problem_id = db.StringField(required=True, unique=True)
problem_name = db.StringField(required=True)
problem_status = db.IntField(required=True)
sources = db.ListField()
metrics = db.ListField()
contest_id = db.StringField()
user_id = db.StringField()
log = db.StringField()
class Result(db.Document):
result_id = db.StringField(required=True, unique=True)
problem_id = db.StringField(required=True)
problem_name = db.StringField(required=True)
source1 = db.StringField(required=True)
source2 = db.StringField(required=True)
scores = db.DictField()
smoss_alignment = db.StringField()
class Project(db.Document):
project_id = db.StringField(required=True, unique=True)
project_name = db.StringField(required=True)
public_token = db.StringField(required=True)
project_status = db.IntField(required=True)
sources = db.ListField()
metrics = db.ListField()
log = db.StringField()
class Counter(db.Document):
name = db.StringField()
count_user = db.IntField()
count_problem = db.IntField()
count_contest = db.IntField()
class TokenBlocklist(db.Document):
jti = db.StringField()
created_at = db.DateTimeField()
def admin_required(fn):
@wraps(fn)
def wrapper(*args, **kwargs):
verify_jwt_in_request()
claims = get_jwt()
if int(claims['sub']['role']) != 0:
return jsonify(error='request admin role permission'), 403
else:
return fn(*args, **kwargs)
return wrapper
| 30.267442 | 82 | 0.694967 | 319 | 2,603 | 5.54232 | 0.272727 | 0.183824 | 0.16629 | 0.197964 | 0.316742 | 0.280543 | 0.223982 | 0.122172 | 0.072398 | 0.072398 | 0 | 0.006182 | 0.192086 | 2,603 | 85 | 83 | 30.623529 | 0.834522 | 0.006147 | 0 | 0.121622 | 0 | 0 | 0.021663 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.027027 | false | 0.013514 | 0.081081 | 0 | 0.918919 | 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 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
278ce42422cf8aec9727801104ac75b9222a8c7c | 1,015 | py | Python | matrix_keypad-1.0.4-fixed/matrix_keypad/matrix_keypad_demo2.py | spotrh/rpihacks | d46b8206821c7a27b40ff56077418bb6fff60e56 | [
"CC-BY-3.0",
"Unlicense",
"MIT"
] | 18 | 2015-01-05T15:02:23.000Z | 2021-06-16T19:24:42.000Z | matrix_keypad-1.0.4-fixed/build/lib/matrix_keypad/matrix_keypad_demo2.py | spotrh/rpihacks | d46b8206821c7a27b40ff56077418bb6fff60e56 | [
"CC-BY-3.0",
"Unlicense",
"MIT"
] | 1 | 2015-04-01T12:02:57.000Z | 2015-04-01T12:02:57.000Z | matrix_keypad-1.0.4-fixed/matrix_keypad/matrix_keypad_demo2.py | spotrh/rpihacks | d46b8206821c7a27b40ff56077418bb6fff60e56 | [
"CC-BY-3.0",
"Unlicense",
"MIT"
] | 12 | 2015-01-08T13:02:29.000Z | 2020-06-14T09:19:11.000Z | #!/usr/bin/python
#Select which IO version by commenting the unused version
from matrixKeypad_MCP230xx import keypad
#from matrixKeypad_RPi_GPIO import keypad
from time import sleep
from sys import exit
# Initialize the keypad class. Using the **optional** variable to change it to a 4x4 keypad
kp = keypad(columnCount = 4)
# Setup variables
attempt = "0000"
passcode = "1912"
count = 0
# Loop while waiting for a keypress
while True:
# Loop to get a pressed digit
digit = None
while digit == None:
digit = kp.getKey()
# Print the result
print "Digit Entered: %s"%digit
attempt = (attempt[1:] + str(digit))
print "Attempt value: %s"%attempt
# Check for passcode match
if (attempt == passcode):
print "Your code was correct, goodbye."
exit()
else:
counter += 1
print "Entered digit count: %s"%counter
if (counter >= 4):
print "Incorrect code!"
sleep(3)
print "Try Again"
sleep(1)
counter = 0
time.sleep(0.5) | 23.068182 | 92 | 0.659113 | 140 | 1,015 | 4.757143 | 0.542857 | 0.048048 | 0.048048 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.030105 | 0.247291 | 1,015 | 44 | 93 | 23.068182 | 0.841623 | 0.318227 | 0 | 0 | 0 | 0 | 0.205928 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0.074074 | 0.111111 | null | null | 0.222222 | 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 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
278f434a85e96522136c0e44f4352e9f5e791bc8 | 2,817 | py | Python | hashdir.py | NCAR/HPCinstall | e70e984305bfc6c54725601bb14ce5f499e65bc9 | [
"BSD-3-Clause"
] | 5 | 2017-09-15T22:25:15.000Z | 2019-04-08T22:44:00.000Z | hashdir.py | NCAR/HPCinstall | e70e984305bfc6c54725601bb14ce5f499e65bc9 | [
"BSD-3-Clause"
] | 15 | 2017-03-08T21:42:19.000Z | 2019-04-22T20:04:26.000Z | hashdir.py | NCAR/HPCinstall | e70e984305bfc6c54725601bb14ce5f499e65bc9 | [
"BSD-3-Clause"
] | 4 | 2017-05-02T15:36:25.000Z | 2022-03-29T19:39:57.000Z | #!/usr/bin/env python
import hashlib, os, argparse
def flatten_argument(a):
"""Flatten the multiple lists generated by append and nargs in argparse"""
if a:
b = [elem for elements in a for elem in elements]
else:
b = a
return b
def hashdir(directory, verbose=False, to_be_excluded=["BUILD_DIR"]):
SHAhash = hashlib.md5()
for root, dirs, files in os.walk(directory):
for tbe in to_be_excluded:
if tbe in dirs:
dirs.remove(tbe)
dirs.sort() # guarantee an order for further steps
for names in sorted(files): # guarantee an order for current step
filepath = os.path.abspath(os.path.expanduser(os.path.join(root, names)))
if verbose:
print 'Hashing', filepath,
try:
f1 = open(filepath, 'rb')
while 1:
# Read file in as little chunks
buf = f1.read(4096)
if not buf : break
SHAhash.update(hashlib.md5(buf).hexdigest()) # file content
finally:
f1.close()
SHAhash.update(hashlib.md5(filepath).hexdigest()) # filename
md = os.lstat(filepath) # metadata
SHAhash.update(hashlib.md5(str(md.st_mode)).hexdigest()) # permissions
SHAhash.update(hashlib.md5(str(md.st_uid)).hexdigest()) # user
SHAhash.update(hashlib.md5(str(md.st_gid)).hexdigest()) # group
if verbose:
print "\tperm =", oct(md.st_mode),
print "UID =", md.st_uid, "GID =", md.st_gid,
print "size (bytes) =", md.st_size
return SHAhash.hexdigest()
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument("-d", "--directory", action='append', nargs='*', help="directory(-ies) to hash", required=True)
parser.add_argument("-v", "--verbose", action='store_true', default=False, help="provide details of each file")
parser.add_argument("-e", "--exclude", action='append', nargs='*', help="subdirectory(-ies) to exclude, in addition to BUILD_DIR", default=[])
parser.add_argument("-i", "--include-build-dir", action="store_true", default=False, help="Do not exclude BUILD_DIR")
args = parser.parse_args()
dirs = flatten_argument(args.directory)
to_be_excluded = flatten_argument(args.exclude)
if not args.include_build_dir:
to_be_excluded.append("BUILD_DIR")
for mydir in dirs:
if os.path.isdir(mydir):
print hashdir(mydir, args.verbose, to_be_excluded), os.path.abspath(os.path.expanduser(mydir))
else:
print "No such directory:", os.path.abspath(mydir)
| 46.180328 | 146 | 0.58431 | 345 | 2,817 | 4.652174 | 0.376812 | 0.026168 | 0.037383 | 0.071651 | 0.130841 | 0.130841 | 0.056075 | 0 | 0 | 0 | 0 | 0.007011 | 0.29109 | 2,817 | 60 | 147 | 46.95 | 0.796695 | 0.062833 | 0 | 0.076923 | 1 | 0 | 0.119327 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.019231 | null | null | 0.115385 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
279726d104d9a2d6eb11c72f3ad358a854625e9e | 850 | py | Python | accounts/admin.py | Muson117/SharedAccountLibrary | 37bd3d88ed924d1a8825709dbc0d0e9123750bda | [
"MIT"
] | null | null | null | accounts/admin.py | Muson117/SharedAccountLibrary | 37bd3d88ed924d1a8825709dbc0d0e9123750bda | [
"MIT"
] | null | null | null | accounts/admin.py | Muson117/SharedAccountLibrary | 37bd3d88ed924d1a8825709dbc0d0e9123750bda | [
"MIT"
] | null | null | null | ''' models registered to Django admin interface '''
from django.contrib import admin
# Register your models here.
from .models import Employee, Account
#admin.site.register(Employee)
#admin.site.register(Account)
@admin.register(Employee)
class EmployeeAdmin(admin.ModelAdmin):
''' what to display in admin '''
list_display = ('employee_FirstName', 'employee_LastName')
@admin.register(Account)
class AccountAdmin(admin.ModelAdmin):
''' what to display in admin '''
list_display = ('account_name', 'status', 'account_taken_by', 'account_taken_at')
list_filter = ['status', 'account_taken_at']
exclude = ('account_pass')
'''
fieldsets = (
(None, {
'fields': ('account_name','account_pass')
}),
('Availability', {
'fields': ('status', 'id')
}),
)
'''
| 26.5625 | 85 | 0.64 | 89 | 850 | 5.94382 | 0.426966 | 0.073724 | 0.064272 | 0.079395 | 0.173913 | 0.173913 | 0.173913 | 0.173913 | 0.173913 | 0 | 0 | 0 | 0.210588 | 850 | 31 | 86 | 27.419355 | 0.788376 | 0.212941 | 0 | 0 | 0 | 0 | 0.263274 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.1 | 0.2 | 0 | 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 | 1 | 0 | 0 | 1 | 0 | 0 | 2 |
279845d9f3a3f93c2966ff7450786079383483b6 | 340 | py | Python | stashcli/errors.py | purinda/stash-cli | 4740d1cf39098e77197ce27222d70b932a669439 | [
"MIT"
] | 7 | 2015-10-20T16:47:09.000Z | 2021-11-04T01:52:22.000Z | stashcli/errors.py | purinda/stash-cli | 4740d1cf39098e77197ce27222d70b932a669439 | [
"MIT"
] | 1 | 2015-10-23T00:07:44.000Z | 2016-01-16T08:06:08.000Z | stashcli/errors.py | purinda/stash-cli | 4740d1cf39098e77197ce27222d70b932a669439 | [
"MIT"
] | 5 | 2015-10-22T13:59:54.000Z | 2020-11-20T10:48:02.000Z | # -*- coding: utf-8 -*-
"""
stashcli.errors
~~~~~~~~~~~~~~~~
stashcli exception definitions
"""
class DuplicatePullRequest(Exception):
def __init__(self, msg):
super(DuplicatePullRequest, self).__init__(msg)
class EmptyPullRequest(Exception):
def __init__(self, msg):
super(EmptyPullRequest, self).__init__(msg)
| 20 | 55 | 0.670588 | 32 | 340 | 6.625 | 0.46875 | 0.113208 | 0.150943 | 0.188679 | 0.264151 | 0.264151 | 0 | 0 | 0 | 0 | 0 | 0.003497 | 0.158824 | 340 | 16 | 56 | 21.25 | 0.737762 | 0.252941 | 0 | 0.333333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0 | 0 | 0.666667 | 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 | 0 | 0 | 0 | 2 |
279b991894326fa269580ffa2bfdb08b2839795a | 2,044 | py | Python | python-client/trustedanalytics/core/aggregation.py | rmaldrix/DOC | 2c3be80d515fbf46516e16a81b7eaafe1ed2c6d9 | [
"Apache-2.0"
] | null | null | null | python-client/trustedanalytics/core/aggregation.py | rmaldrix/DOC | 2c3be80d515fbf46516e16a81b7eaafe1ed2c6d9 | [
"Apache-2.0"
] | null | null | null | python-client/trustedanalytics/core/aggregation.py | rmaldrix/DOC | 2c3be80d515fbf46516e16a81b7eaafe1ed2c6d9 | [
"Apache-2.0"
] | null | null | null | #
# Copyright (c) 2015 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
"""
trustedanalytics frame aggregation functions
"""
import json
from trustedanalytics.core.atktypes import valid_data_types
class AggregationFunctions(object):
"""
Defines supported aggregation functions, maps them to keyword strings
"""
avg = 'AVG'
count = 'COUNT'
count_distinct = 'COUNT_DISTINCT'
max = 'MAX'
min = 'MIN'
sum = 'SUM'
var = 'VAR'
stdev = 'STDEV'
def histogram(self, cutoffs, include_lowest=True, strict_binning=False):
return repr(GroupByHistogram(cutoffs, include_lowest, strict_binning))
def __repr__(self):
return ", ".join([k for k in AggregationFunctions.__dict__.keys()
if isinstance(k, basestring) and not k.startswith("__")])
def __contains__(self, item):
return item in AggregationFunctions.__dict__.values()
agg = AggregationFunctions()
class GroupByHistogram:
"""
Class for histogram aggregation function that uses cutoffs to compute histograms
"""
def __init__(self, cutoffs, include_lowest=True, strict_binning=False):
for c in cutoffs:
if not isinstance(c, (int, long, float, complex)):
raise ValueError("Bad value %s in cutoffs, expected a number")
self.cutoffs = cutoffs
self.include_lowest = include_lowest
self.strict_binning = strict_binning
def __repr__(self):
return 'HISTOGRAM=' + json.dumps(self.__dict__)
| 31.446154 | 84 | 0.693738 | 252 | 2,044 | 5.452381 | 0.539683 | 0.043668 | 0.043668 | 0.02329 | 0.110626 | 0.110626 | 0.066958 | 0.066958 | 0 | 0 | 0 | 0.005009 | 0.218689 | 2,044 | 64 | 85 | 31.9375 | 0.855354 | 0.370352 | 0 | 0.068966 | 0 | 0 | 0.076923 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.172414 | false | 0 | 0.068966 | 0.137931 | 0.724138 | 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 | 0 | 1 | 1 | 0 | 0 | 2 |
27be054e558e0f28ef970abd43b69fba9564eb7e | 339 | py | Python | src/interpolate.py | bestvibes/multi-agent-cooperation | d1233865123fde388ba84a917221265c1cfea550 | [
"MIT"
] | 3 | 2019-11-02T05:14:49.000Z | 2019-11-12T12:48:53.000Z | src/interpolate.py | bestvibes/multi-agent-cooperation | d1233865123fde388ba84a917221265c1cfea550 | [
"MIT"
] | null | null | null | src/interpolate.py | bestvibes/multi-agent-cooperation | d1233865123fde388ba84a917221265c1cfea550 | [
"MIT"
] | 1 | 2019-10-02T17:22:39.000Z | 2019-10-02T17:22:39.000Z | from scipy.interpolate import make_interp_spline, BSpline
import numpy as np
def interpolate_parametric(t, x, y):
t_new = np.linspace(0, len(t)-1, 300)
x_spl = make_interp_spline(t, x, k=3)
x_smooth = x_spl(t_new)
y_spl = make_interp_spline(t, y, k=3)
y_smooth = y_spl(t_new)
return (t_new, x_smooth, y_smooth)
| 24.214286 | 57 | 0.693215 | 64 | 339 | 3.375 | 0.421875 | 0.074074 | 0.222222 | 0.175926 | 0.185185 | 0 | 0 | 0 | 0 | 0 | 0 | 0.025641 | 0.19469 | 339 | 13 | 58 | 26.076923 | 0.765568 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | false | 0 | 0.222222 | 0 | 0.444444 | 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 | 0 | 0 | 0 | 2 |
27ec30415252756298c76a81198260f25cbb31c9 | 843 | py | Python | src/genie/libs/parser/iosxr/tests/ShowIpInterfaceBrief/cli/equal/golden_output4_expected.py | balmasea/genieparser | d1e71a96dfb081e0a8591707b9d4872decd5d9d3 | [
"Apache-2.0"
] | 204 | 2018-06-27T00:55:27.000Z | 2022-03-06T21:12:18.000Z | src/genie/libs/parser/iosxr/tests/ShowIpInterfaceBrief/cli/equal/golden_output4_expected.py | balmasea/genieparser | d1e71a96dfb081e0a8591707b9d4872decd5d9d3 | [
"Apache-2.0"
] | 468 | 2018-06-19T00:33:18.000Z | 2022-03-31T23:23:35.000Z | src/genie/libs/parser/iosxr/tests/ShowIpInterfaceBrief/cli/equal/golden_output4_expected.py | balmasea/genieparser | d1e71a96dfb081e0a8591707b9d4872decd5d9d3 | [
"Apache-2.0"
] | 309 | 2019-01-16T20:21:07.000Z | 2022-03-30T12:56:41.000Z | expected_output = {
"interface": {
"Loopback0": {
"interface_status": "Up",
"ip_address": "200.0.7.1",
"protocol_status": "Up"
},
"MgmtEth0/RSP0/CPU0/0": {
"interface_status": "Up",
"ip_address": "5.25.27.1",
"protocol_status": "Up"
},
"MgmtEth0/RSP0/CPU0/1": {
"interface_status": "Shutdown",
"ip_address": "unassigned",
"protocol_status": "Down"
},
"MgmtEth0/RSP1/CPU0/0": {
"interface_status": "Up",
"ip_address": "5.25.27.2",
"protocol_status": "Up"
},
"MgmtEth0/RSP1/CPU0/1": {
"interface_status": "Shutdown",
"ip_address": "unassigned",
"protocol_status": "Down"
}
}
}
| 28.1 | 43 | 0.450771 | 74 | 843 | 4.918919 | 0.324324 | 0.131868 | 0.14011 | 0.156593 | 0.785714 | 0.714286 | 0.714286 | 0.554945 | 0.554945 | 0.554945 | 0 | 0.066922 | 0.379597 | 843 | 29 | 44 | 29.068966 | 0.629063 | 0 | 0 | 0.413793 | 0 | 0 | 0.457888 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
27f0ecdef85e83bcef5014d628d9b8ea23bc1107 | 1,161 | py | Python | plugins/Tester/shapeSuffix.py | sol-ansano-kim/mediTest | 5434a1dd882a5d0270695f345e4a4bfbf3e7ac12 | [
"MIT"
] | 59 | 2017-08-27T08:51:07.000Z | 2022-03-05T13:50:27.000Z | plugins/Tester/shapeSuffix.py | sol-ansano-kim/mediTest | 5434a1dd882a5d0270695f345e4a4bfbf3e7ac12 | [
"MIT"
] | 5 | 2017-09-04T06:08:42.000Z | 2020-06-04T02:27:25.000Z | plugins/Tester/shapeSuffix.py | sol-ansano-kim/mediTest | 5434a1dd882a5d0270695f345e4a4bfbf3e7ac12 | [
"MIT"
] | 17 | 2017-10-10T10:21:34.000Z | 2022-03-19T06:30:13.000Z | import medic
from maya import OpenMaya
class ShapeSuffix(medic.PyTester):
def __init__(self):
super(ShapeSuffix, self).__init__()
def Name(self):
return "ShapeSuffix"
def Description(self):
return "Shape isn't named after the Transform"
def Match(self, node):
return node.object().hasFn(OpenMaya.MFn.kShape)
def test(self, node):
if node.dag().isInstanced() or node.dag().isFromReferencedFile() or node.dag().isIntermediateObject():
return None
parent = node.parents()[0]
if ShapeSuffix.NameCompare(node.dg().name(), parent.dg().name()):
return None
return medic.PyReport(node)
def fix(self, report, params):
node = report.node()
newName = ShapeSuffix.FixName(node.parents()[0].dg().name())
node.dg().setName(newName)
return True
def IsFixable(self):
return True
@staticmethod
def FixName(trans):
return "{}Shape".format(trans)
@staticmethod
def NameCompare(shape, trans):
return ("{}Shape".format(trans) == shape)
def Create():
return ShapeSuffix()
| 23.693878 | 110 | 0.615848 | 130 | 1,161 | 5.438462 | 0.415385 | 0.042433 | 0.02546 | 0.062235 | 0.076379 | 0 | 0 | 0 | 0 | 0 | 0 | 0.002312 | 0.254953 | 1,161 | 48 | 111 | 24.1875 | 0.815029 | 0 | 0 | 0.181818 | 0 | 0 | 0.053402 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.30303 | false | 0 | 0.060606 | 0.212121 | 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 | 0 | 0 | 0 | 2 |
27f3266c8026e41ba52506383f5a666a99cd6e63 | 4,043 | py | Python | js_showcase/models.py | compoundpartners/js-scrollstory | caa7cf274315cf3e7bd005535dbf570f4b9d74f9 | [
"BSD-3-Clause"
] | null | null | null | js_showcase/models.py | compoundpartners/js-scrollstory | caa7cf274315cf3e7bd005535dbf570f4b9d74f9 | [
"BSD-3-Clause"
] | null | null | null | js_showcase/models.py | compoundpartners/js-scrollstory | caa7cf274315cf3e7bd005535dbf570f4b9d74f9 | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from functools import partial
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext as _
from django.utils.text import slugify
from cms.models.pluginmodel import CMSPlugin
from js_color_picker.fields import RGBColorField
from filer.fields.image import FilerImageField
from djangocms_text_ckeditor.fields import HTMLField
from djangocms_attributes_field import fields
from .constants import DEVICE_SIZES
class AttributesField(fields.AttributesField):
def __init__(self, *args, **kwargs):
if 'verbose_name' not in kwargs:
kwargs['verbose_name'] = _('Attributes')
if 'blank' not in kwargs:
kwargs['blank'] = True
super(AttributesField, self).__init__(*args, **kwargs)
@python_2_unicode_compatible
class ShowcaseContainer(CMSPlugin):
title = models.CharField(_('title'), max_length=255, blank=True, null=True)
layout = models.CharField(_('layout'), max_length=60, default='', blank=True)
attributes = AttributesField()
def __str__(self):
return self.title or str(self.pk)
def get_id(self):
return slugify(self.title or 'show case %s' % self.pk)
@python_2_unicode_compatible
class ShowcaseArticle(CMSPlugin):
title = models.CharField(_('title'), max_length=255)
layout = models.CharField(_('layout'), max_length=60, default='', blank=True)
attributes = AttributesField()
def __str__(self):
return self.title
def get_id(self):
return slugify(self.title)
@python_2_unicode_compatible
class ShowcaseSection(CMSPlugin):
title = models.CharField(_('Anchor title'), max_length=255, blank=True, null=True)
background_color = RGBColorField(_('Background Color'), blank=True, null=True)
background_image = FilerImageField(verbose_name=_('Background Image'), blank=True, null=True, on_delete=models.SET_NULL, related_name='+')
background_video_url = models.CharField(_('Background Video URL'), max_length=255, blank=True, null=True)
layout = models.CharField(_('layout'), max_length=60, default='', blank=True)
attributes = AttributesField()
def __str__(self):
return self.title or str(self.pk)
def get_id(self):
return slugify(self.title or 'section %s' % self.pk)
@python_2_unicode_compatible
class ShowcaseSlideshow(CMSPlugin):
title = models.CharField(_('Anchor title'), max_length=255, blank=True, null=True)
layout = models.CharField(_('layout'), max_length=60, default='', blank=True)
attributes = AttributesField()
def __str__(self):
return self.title or str(self.pk)
def get_id(self):
return slugify(self.title or 'slideshow %s' % self.pk)
@python_2_unicode_compatible
class ShowcaseSlide(CMSPlugin):
percentage = models.CharField(_('Percentage appears'), max_length=255, blank=True, null=True)
landscape_image = FilerImageField(verbose_name=_('Landscape Image'), blank=True, null=True, on_delete=models.SET_NULL, related_name='+')
portrait_image = FilerImageField(verbose_name=_('Portrait Image'), blank=True, null=True, on_delete=models.SET_NULL, related_name='+')
fade_in = models.BooleanField(_('Fade In'), default=False)
fade_out = models.BooleanField(_('Fade Out'), default=False)
layout = models.CharField(_('layout'), max_length=60, default='', blank=True)
attributes = AttributesField()
def __str__(self):
return str(self.pk)
def get_id(self):
return slugify('slide %s' % self.pk)
BooleanFieldPartial = partial(
models.BooleanField,
default=False,
)
for size in DEVICE_SIZES:
ShowcaseSlideshow.add_to_class(
'{}_hide'.format(size),
BooleanFieldPartial(),
)
ShowcaseSection.add_to_class(
'{}_hide'.format(size),
BooleanFieldPartial(),
)
| 35.464912 | 143 | 0.69676 | 480 | 4,043 | 5.614583 | 0.220833 | 0.050093 | 0.043414 | 0.056772 | 0.547681 | 0.51243 | 0.51243 | 0.469759 | 0.389239 | 0.376623 | 0 | 0.010658 | 0.187732 | 4,043 | 113 | 144 | 35.778761 | 0.809988 | 0.005194 | 0 | 0.404762 | 0 | 0 | 0.071922 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.130952 | false | 0 | 0.142857 | 0.119048 | 0.72619 | 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 | 0 | 1 | 1 | 0 | 0 | 2 |
27f9c12a1e5f1f8948a89439a7da800f809503c1 | 290 | py | Python | edna_data_fetch_config_encoder.py | nagasudhirpulla/python_edna_fetch_template | e0c832be53973dfc5eea0d460d48c014c1cb0309 | [
"MIT"
] | null | null | null | edna_data_fetch_config_encoder.py | nagasudhirpulla/python_edna_fetch_template | e0c832be53973dfc5eea0d460d48c014c1cb0309 | [
"MIT"
] | 2 | 2019-02-02T17:40:33.000Z | 2019-02-03T10:38:38.000Z | edna_data_fetch_config_encoder.py | nagasudhirpulla/python_edna_fetch_template | e0c832be53973dfc5eea0d460d48c014c1cb0309 | [
"MIT"
] | null | null | null | import json
class EdnaFetchConfigEncoder(json.JSONEncoder):
def default(self, obj):
if type(obj).__name__ == 'EdnaFetchConfig':
return obj.getDict()
# Let the base class default method raise the TypeError
return json.JSONEncoder.default(self, obj)
| 29 | 63 | 0.67931 | 33 | 290 | 5.848485 | 0.636364 | 0.15544 | 0.145078 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.234483 | 290 | 9 | 64 | 32.222222 | 0.869369 | 0.182759 | 0 | 0 | 0 | 0 | 0.06383 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.166667 | 0 | 0.833333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
27fd66cbbbbb5db670ecfb1c1f86bcd2159acbfa | 7,393 | py | Python | services/runs/project/tests/test_runs.py | daniel-de-vries/airfoil-optimizer-web-ui | cfe457cbfda373a34bcbf3b0db265116e80904b4 | [
"MIT"
] | 1 | 2021-07-31T06:45:45.000Z | 2021-07-31T06:45:45.000Z | services/runs/project/tests/test_runs.py | daniel-de-vries/airfoil-optimizer-web-ui | cfe457cbfda373a34bcbf3b0db265116e80904b4 | [
"MIT"
] | 4 | 2021-05-08T05:43:34.000Z | 2022-02-26T17:43:31.000Z | services/runs/project/tests/test_runs.py | daniel-de-vries/airfoil-optimizer-web-ui | cfe457cbfda373a34bcbf3b0db265116e80904b4 | [
"MIT"
] | 2 | 2020-01-25T04:25:53.000Z | 2020-05-13T13:45:32.000Z | import json
import unittest
from project import db
from project.api.models import Run
from project.tests.base import BaseTestCase
def add_run(*args, **kwargs):
run = Run(*args, **kwargs)
db.session.add(run)
db.session.commit()
return run
class TestRunsService(BaseTestCase):
"""Tests for the Runs Service."""
def test_runs(self):
"""Ensure the /ping route behaves correctly."""
response = self.client.get("/runs/ping")
data = json.loads(response.data.decode())
self.assertEqual(response.status_code, 200)
self.assertIn("pong!", data["message"])
self.assertIn("success", data["status"])
def test_add_run(self):
"""Ensure a new run can be added to the database."""
with self.client:
response = self.client.post(
"/runs",
data=json.dumps(
{"cl": 1.0, "n_c": 3, "n_t": 3, "gen": 100, "report": False}
),
content_type="application/json",
)
data = json.loads(response.data.decode())
self.assertEqual(response.status_code, 201)
self.assertIn("New run was added!", data["message"])
self.assertIn("success", data["status"])
def test_add_run_invalid_json(self):
"""Ensure error is thrown if the JSON object is empty."""
with self.client:
response = self.client.post(
"/runs", data=json.dumps({}), content_type="application/json"
)
data = json.loads(response.data.decode())
self.assertEqual(response.status_code, 400)
self.assertIn("Invalid payload.", data["message"])
self.assertIn("fail", data["status"])
def test_add_run_invalid_json_keys(self):
"""
Ensure error is thrown is the JSON object does not have all required keys.
"""
with self.client:
response = self.client.post(
"/runs", data=json.dumps({"cl": 1.0}), content_type="application/json"
)
data = json.loads(response.data.decode())
self.assertEqual(response.status_code, 400)
self.assertIn("Invalid payload.", data["message"])
self.assertIn("fail", data["status"])
def test_single_run(self):
"""Ensure get single run behaves correctly."""
run = add_run(cl=1.0, n_c=3, n_t=3)
with self.client:
response = self.client.get(f"/runs/{run.id}")
data = json.loads(response.data.decode())
self.assertEqual(response.status_code, 200)
self.assertEqual(1.0, data["data"]["cl"])
self.assertEqual(3, data["data"]["n_c"])
self.assertEqual(3, data["data"]["n_t"])
self.assertIn("success", data["status"])
def test_single_run_no_id(self):
"""Ensure error is thrown is an id is not provided."""
with self.client:
response = self.client.get(f"/runs/blah")
data = json.loads(response.data.decode())
self.assertEqual(response.status_code, 404)
self.assertIn("Run does not exist", data["message"])
self.assertIn("fail", data["status"])
def test_single_run_incorrect_id(self):
"""Ensure error is thrown if the id does not exist."""
with self.client:
response = self.client.get(f"/runs/999")
data = json.loads(response.data.decode())
self.assertEqual(response.status_code, 404)
self.assertIn("Run does not exist", data["message"])
self.assertIn("fail", data["status"])
def test_all_runs(self):
"""Ensure get all runs behaves correctly."""
add_run(1.0, 3, 3)
add_run(0.5, 6, 6)
with self.client:
response = self.client.get("/runs")
data = json.loads(response.data.decode())
self.assertEqual(response.status_code, 200)
self.assertEqual(len(data["data"]["runs"]), 2)
self.assertEqual(1.0, data["data"]["runs"][0]["cl"])
self.assertEqual(3, data["data"]["runs"][0]["n_c"])
self.assertEqual(3, data["data"]["runs"][0]["n_t"])
self.assertEqual(0.5, data["data"]["runs"][1]["cl"])
self.assertEqual(6, data["data"]["runs"][1]["n_c"])
self.assertEqual(6, data["data"]["runs"][1]["n_t"])
self.assertIn("success", data["status"])
def test_accept_run(self):
"""Ensure accept run behaves correctly."""
add_run(1.0, 3, 3)
with self.client:
response = self.client.get("/runs/accept")
data = json.loads(response.data.decode())
self.assertEqual(response.status_code, 200)
self.assertEqual(1.0, data["data"]["cl"])
self.assertEqual(3, data["data"]["n_c"])
self.assertEqual(3, data["data"]["n_t"])
self.assertEqual(1, data["data"]["status"])
self.assertIn("success", data["status"])
def test_accept_run_no_runs_in_queue(self):
"""
Ensure accept run haves correctly if there are no runs in the queue.
"""
with self.client:
response = self.client.get("/runs/accept")
self.assertEqual(response.status_code, 204)
self.assertFalse(response.data)
def test_complete_run(self):
"""Ensure complete run behaves correctly."""
run = add_run(1.0, 3, 3)
run.status = 1
db.session.commit()
with self.client:
response = self.client.post(
"/runs/complete",
data=json.dumps({"id": 1, "success": True}),
content_type="application/json",
)
data = json.loads(response.data.decode())
self.assertEqual(response.status_code, 200)
self.assertIn("Run marked as complete", data["message"])
self.assertIn("success", data["status"])
def test_complete_run_failed(self):
"""Ensure complete run failed behaves correctly."""
run = add_run(1.0, 3, 3)
run.status = 1
db.session.commit()
with self.client:
response = self.client.post(
"/runs/complete",
data=json.dumps({"id": 1, "success": False}),
content_type="application/json",
)
data = json.loads(response.data.decode())
self.assertEqual(response.status_code, 200)
self.assertIn("Run marked as failed", data["message"])
self.assertIn("success", data["status"])
def test_complete_run_not_accepted(self):
"""
Ensure error is thrown is a run which has not been accepted is completed.
"""
add_run(1.0, 3, 3)
with self.client:
response = self.client.post(
"/runs/complete",
data=json.dumps({"id": 1, "success": True}),
content_type="application/json",
)
data = json.loads(response.data.decode())
self.assertEqual(response.status_code, 400)
self.assertIn(
"Cannot complete run which has not been accepted", data["message"]
)
self.assertIn("fail", data["status"])
if __name__ == "__main__":
unittest.main()
| 38.305699 | 86 | 0.562965 | 884 | 7,393 | 4.608597 | 0.140271 | 0.099411 | 0.057437 | 0.092538 | 0.781541 | 0.767305 | 0.718704 | 0.695631 | 0.639666 | 0.56161 | 0 | 0.020611 | 0.291221 | 7,393 | 192 | 87 | 38.505208 | 0.75687 | 0.09279 | 0 | 0.571429 | 0 | 0 | 0.119265 | 0 | 0 | 0 | 0 | 0 | 0.333333 | 1 | 0.095238 | false | 0 | 0.034014 | 0 | 0.142857 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
27fdf7b4d8da4556d3df883e9426395eaae96592 | 1,113 | py | Python | opps/models.py | hkhanna/jovian | aa4d92807726178091ce9f731f2789d22fe776de | [
"MIT"
] | null | null | null | opps/models.py | hkhanna/jovian | aa4d92807726178091ce9f731f2789d22fe776de | [
"MIT"
] | null | null | null | opps/models.py | hkhanna/jovian | aa4d92807726178091ce9f731f2789d22fe776de | [
"MIT"
] | null | null | null | from django.db import models
class User(models.Model):
id = models.PositiveIntegerField(primary_key=True)
first_name = models.CharField(max_length=255, null=False, blank=True)
last_name = models.CharField(max_length=255, null=False, blank=True)
email = models.EmailField(max_length=255, null=False, blank=True)
def __str__(self):
return f"{self.first_name} {self.last_name}".strip()
class InterestedIn(models.Model):
user = models.ForeignKey(
User, on_delete=models.CASCADE, related_name="interested_in"
)
title = models.CharField(max_length=255, null=False, blank=False)
class Organization(models.Model):
id = models.PositiveIntegerField(primary_key=True)
name = models.CharField(max_length=255, null=False, blank=True)
email = models.EmailField(max_length=255, null=False, blank=True)
def __str__(self):
return self.name
class Role(models.Model):
organization = models.ForeignKey(
Organization, on_delete=models.CASCADE, related_name="roles"
)
name = models.CharField(max_length=255, null=False, blank=False)
| 31.8 | 73 | 0.72327 | 146 | 1,113 | 5.335616 | 0.294521 | 0.080873 | 0.107831 | 0.143774 | 0.702182 | 0.702182 | 0.620026 | 0.620026 | 0.483954 | 0.360719 | 0 | 0.02246 | 0.159928 | 1,113 | 34 | 74 | 32.735294 | 0.810695 | 0 | 0 | 0.25 | 0 | 0 | 0.046721 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.083333 | false | 0 | 0.041667 | 0.083333 | 0.833333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 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 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
fd74e0b7fc3cfc4ea85407b9597b67f5e96e7261 | 498 | py | Python | torchlib/metric/__init__.py | vermouth1992/torchlib | 63b2bedb40f670b2d9fbfc0daeab4a8d44623095 | [
"MIT"
] | 3 | 2019-07-23T21:32:36.000Z | 2022-02-04T23:13:30.000Z | torchlib/metric/__init__.py | vermouth1992/torchlib | 63b2bedb40f670b2d9fbfc0daeab4a8d44623095 | [
"MIT"
] | null | null | null | torchlib/metric/__init__.py | vermouth1992/torchlib | 63b2bedb40f670b2d9fbfc0daeab4a8d44623095 | [
"MIT"
] | 1 | 2019-07-23T21:32:23.000Z | 2019-07-23T21:32:23.000Z | from typing import Callable
import numpy as np
from .common import accuracy_score, binary_accuracy_score
from .mmd import mmd_loss, maximum_mean_discrepancy
metric_name_to_func = {
'accuracy': accuracy_score,
'binary_accuracy': binary_accuracy_score
}
def contains_metric(metric_name: str) -> bool:
return metric_name in metric_name_to_func
def get_metric_func(metric_name: str) -> Callable[[np.ndarray, np.ndarray], float]:
return metric_name_to_func.get(metric_name, None)
| 24.9 | 83 | 0.787149 | 73 | 498 | 5.013699 | 0.410959 | 0.191257 | 0.098361 | 0.131148 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.136546 | 498 | 19 | 84 | 26.210526 | 0.851163 | 0 | 0 | 0 | 0 | 0 | 0.046185 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.333333 | 0.166667 | 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 | 0 | 1 | 1 | 0 | 0 | 0 | 2 |
fd76b54f1d56fc6ceb870966e6e9f87029b5fb81 | 129 | py | Python | persyst_processor/run.py | Pennsieve/timeseries-processor | 85766afa76182503fd66cec8382c22e757743f01 | [
"Apache-2.0"
] | null | null | null | persyst_processor/run.py | Pennsieve/timeseries-processor | 85766afa76182503fd66cec8382c22e757743f01 | [
"Apache-2.0"
] | null | null | null | persyst_processor/run.py | Pennsieve/timeseries-processor | 85766afa76182503fd66cec8382c22e757743f01 | [
"Apache-2.0"
] | null | null | null |
from persyst_processor import PersystProcessor
if __name__ == '__main__':
task = PersystProcessor(cli=True)
task.run()
| 18.428571 | 46 | 0.736434 | 14 | 129 | 6.142857 | 0.857143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.170543 | 129 | 6 | 47 | 21.5 | 0.803738 | 0 | 0 | 0 | 0 | 0 | 0.0625 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 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 | 0 | 0 | 0 | 2 |
fd791633eaabbee9e8f10e85ebbaebd89153f8dc | 1,229 | py | Python | Protheus_WebApp/Modules/SIGATSS/TSSMANAGERMONITORTESTCASE.py | 98llm/tir-script-samples | 0bff8393b79356aa562e9e6512c11ee6e039b177 | [
"MIT"
] | 17 | 2018-09-24T17:27:08.000Z | 2021-09-16T19:09:46.000Z | Protheus_WebApp/Modules/SIGATSS/TSSMANAGERMONITORTESTCASE.py | 98llm/tir-script-samples | 0bff8393b79356aa562e9e6512c11ee6e039b177 | [
"MIT"
] | 4 | 2018-09-24T17:30:32.000Z | 2022-01-03T11:39:30.000Z | Protheus_WebApp/Modules/SIGATSS/TSSMANAGERMONITORTESTCASE.py | 98llm/tir-script-samples | 0bff8393b79356aa562e9e6512c11ee6e039b177 | [
"MIT"
] | 18 | 2019-06-07T17:41:34.000Z | 2022-01-31T18:17:31.000Z | import unittest
from tir import Webapp
class TSSMANAGERMONITOR(unittest.TestCase):
@classmethod
def setUpClass(inst):
# Endereco do webapp e o nome do Browser
inst.oHelper = Webapp()
# Utilizando usuário de teste
inst.oHelper.SetTIRConfig("User", "teste")
inst.oHelper.SetTIRConfig("Password", "1234")
# Parametros de inicializacao
inst.oHelper.SetupTSS("TSSMONITOR", "SPED")
def test_TSSMANAGERMONITOR01_CT001(self):
self.oHelper.SetButton("Eventos")
self.oHelper.SetButton("NF-e")
self.oHelper.SetButton("Cancelar")
self.oHelper.SetButton("Fiscal")
self.oHelper.SetButton("NFS-e")
self.oHelper.SetButton("Cancelar")
self.oHelper.SetButton("NF-e")
self.oHelper.SetButton("Cancelar")
self.oHelper.SetButton("CT-e")
self.oHelper.SetButton("Cancelar")
self.oHelper.SetButton("Documentos")
self.oHelper.SetButton("EDI")
self.oHelper.SetButton("Sair")
self.oHelper.SetButton("Sim")
self.oHelper.AssertTrue()
@classmethod
def tearDownClass(inst):
inst.oHelper.TearDown()
if __name__ == '__main__':
unittest.main() | 26.717391 | 53 | 0.644426 | 127 | 1,229 | 6.15748 | 0.417323 | 0.210997 | 0.358056 | 0.107417 | 0.28133 | 0.28133 | 0.28133 | 0.28133 | 0.181586 | 0.181586 | 0 | 0.009524 | 0.231082 | 1,229 | 46 | 54 | 26.717391 | 0.817989 | 0.076485 | 0 | 0.266667 | 0 | 0 | 0.110424 | 0 | 0 | 0 | 0 | 0 | 0.033333 | 1 | 0.1 | false | 0.033333 | 0.066667 | 0 | 0.2 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
fd7d8e64fd8a3fd59e68694a8c7dc04054d33da2 | 1,124 | py | Python | tests/_event/test_timer_event.py | ynsnf/apysc | b10ffaf76ec6beb187477d0a744fca00e3efc3fb | [
"MIT"
] | 16 | 2021-04-16T02:01:29.000Z | 2022-01-01T08:53:49.000Z | tests/_event/test_timer_event.py | ynsnf/apysc | b10ffaf76ec6beb187477d0a744fca00e3efc3fb | [
"MIT"
] | 613 | 2021-03-24T03:37:38.000Z | 2022-03-26T10:58:37.000Z | tests/_event/test_timer_event.py | simon-ritchie/apyscript | c319f8ab2f1f5f7fad8d2a8b4fc06e7195476279 | [
"MIT"
] | 2 | 2021-06-20T07:32:58.000Z | 2021-12-26T08:22:11.000Z | from random import randint
from typing import Any
from typing import Dict
from retrying import retry
import apysc as ap
from apysc._expression import var_names
class TestTimerEvent:
def on_timer(self, e: ap.Event, options: Dict[str, Any]) -> None:
"""
The handler would be called from a timer.
Parameters
----------
e : Event
Event instance.
options : dict
Optional arguments dictionary.
"""
@retry(stop_max_attempt_number=15, wait_fixed=randint(10, 3000))
def test___init__(self) -> None:
timer: ap.Timer = ap.Timer(handler=self.on_timer, delay=33)
event: ap.TimerEvent = ap.TimerEvent(this=timer)
assert event.variable_name.startswith(f'{var_names.TIMER_EVENT}_')
assert event._this == timer
@retry(stop_max_attempt_number=15, wait_fixed=randint(10, 3000))
def test_this(self) -> None:
timer: ap.Timer = ap.Timer(handler=self.on_timer, delay=33)
event: ap.TimerEvent = ap.TimerEvent(this=timer)
assert event.this == timer
| 30.378378 | 75 | 0.632562 | 144 | 1,124 | 4.770833 | 0.395833 | 0.040757 | 0.069869 | 0.055313 | 0.45706 | 0.45706 | 0.45706 | 0.45706 | 0.45706 | 0.45706 | 0 | 0.024272 | 0.266904 | 1,124 | 36 | 76 | 31.222222 | 0.809466 | 0.128114 | 0 | 0.315789 | 0 | 0 | 0.027523 | 0.027523 | 0 | 0 | 0 | 0 | 0.157895 | 1 | 0.157895 | false | 0 | 0.315789 | 0 | 0.526316 | 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 | 0 | 1 | 0 | 0 | 2 |
fd9f405c3f9096da13099c9b522813db67e00c1e | 2,333 | py | Python | miniworld/model/spatial/Singleton.py | miniworld-project/miniworld_core | c591bad232b78eae99e8f55cb1b907c1e228484b | [
"MIT"
] | 5 | 2019-05-11T14:57:15.000Z | 2021-07-05T00:35:25.000Z | miniworld/model/spatial/Singleton.py | miniworld-project/miniworld_core | c591bad232b78eae99e8f55cb1b907c1e228484b | [
"MIT"
] | 27 | 2017-03-17T07:11:02.000Z | 2019-05-26T23:36:56.000Z | miniworld/model/spatial/Singleton.py | miniworld-project/miniworld_core | c591bad232b78eae99e8f55cb1b907c1e228484b | [
"MIT"
] | 6 | 2017-05-03T12:11:33.000Z | 2020-04-03T11:44:27.000Z | # encoding: utf-8
from miniworld.model.singletons.Resetable import Resetable
import sqlite3
import os
from random import randint
from miniworld.model.spatial.Point import Point
from miniworld.model.spatial.Location import Location
__author__ = "Patrick Lampe"
__email__ = "uni at lampep.de"
# TODO: also singleton for other backend stuff? move to other place?
class Singleton(Resetable):
def __init__(self):
# TODO: DOC created later ...
PATH_MARBURG_OSM_MAP = "osm_marburg.db"
self.reset()
self.conn = sqlite3.connect(os.path.abspath(PATH_MARBURG_OSM_MAP))
cursor = self.conn.cursor()
for row in cursor.execute("SELECT original_id FROM nodes"):
self.dict_of_all_points[row[0]] = self.__get_point_for_original_id(row[0])
# set from outside
self.roads = None
#########################################
# Resettable Interface
#########################################
def reset(self):
self.roads = None
self.file_path = ""
self.dict_of_all_points = {}
self.seconds_per_simulation_step = 1.0
self.list_of_simulated_steps = []
#########################################
# Other stuff
#########################################
def get_connection_to_database(self):
return self.conn
def set_seconds_per_simultion_step(self, seconds):
self.seconds_per_simulation_step = seconds
def add_next_simulated_step(self, current_simulation_step):
self.list_of_simulated_steps.append(current_simulation_step)
def get_roads(self):
return self.roads
def set_file_path(self, file_path):
self.file_path = file_path
self.add_file_path_to_list(file_path)
def get_node_for_id(self, id):
return self.dict_of_all_points[id]
def get_random_point(self):
count = len(self.dict_of_all_points.items())
index = randint(0, count - 1)
return list(self.dict_of_all_points.items())[index][1]
def __get_point_for_original_id(self, original_id):
cur = self.conn.cursor()
cur.execute("SELECT lat, lon FROM nodes WHERE original_id=:index", {"index": original_id})
lat, lon = cur.fetchone()
location = Location(lat, lon)
return Point(original_id, location)
| 30.697368 | 98 | 0.633519 | 296 | 2,333 | 4.675676 | 0.327703 | 0.050578 | 0.036127 | 0.046965 | 0.211705 | 0.041908 | 0.041908 | 0 | 0 | 0 | 0 | 0.005444 | 0.212602 | 2,333 | 75 | 99 | 31.106667 | 0.747959 | 0.068581 | 0 | 0.043478 | 0 | 0 | 0.063936 | 0 | 0 | 0 | 0 | 0.013333 | 0 | 1 | 0.217391 | false | 0 | 0.130435 | 0.065217 | 0.478261 | 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 | 0 | 0 | 0 | 2 |
fdab298ad251f99834da53068d9a72ae5277ed08 | 491 | py | Python | crm/migrations/0011_auto_20200908_1347.py | eviltnan/portfolio | a3f82ee867f87e62adc26541afc4de74aed4b186 | [
"MIT"
] | 7 | 2022-01-22T14:13:51.000Z | 2022-03-25T22:24:14.000Z | crm/migrations/0011_auto_20200908_1347.py | eviltnan/portfolio | a3f82ee867f87e62adc26541afc4de74aed4b186 | [
"MIT"
] | 3 | 2019-12-06T13:34:09.000Z | 2020-01-06T19:23:26.000Z | crm/migrations/0011_auto_20200908_1347.py | thorin-schiffer/freeturn | a3f82ee867f87e62adc26541afc4de74aed4b186 | [
"MIT"
] | 1 | 2018-12-13T20:18:36.000Z | 2018-12-13T20:18:36.000Z | # Generated by Django 2.2.16 on 2020-09-08 13:47
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('crm', '0010_cv_project_listing_title'),
]
operations = [
migrations.AlterModelOptions(
name='invoice',
options={'get_latest_by': 'modified'},
),
migrations.AlterModelOptions(
name='projectmessage',
options={'get_latest_by': 'modified'},
),
]
| 22.318182 | 50 | 0.588595 | 47 | 491 | 5.978723 | 0.702128 | 0.192171 | 0.220641 | 0.128114 | 0.185053 | 0 | 0 | 0 | 0 | 0 | 0 | 0.057471 | 0.291242 | 491 | 21 | 51 | 23.380952 | 0.75 | 0.093686 | 0 | 0.4 | 1 | 0 | 0.214447 | 0.065463 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.066667 | 0 | 0.266667 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
fdc94595b8852478410f5dc9c58683678e9c22e6 | 754 | py | Python | dijkstra/mainBellmanFord.py | FrankzAlarcon/proyecto_libreria | 0418a91e92dc1fb041a1382a3649ac6bda8ed91f | [
"MIT"
] | null | null | null | dijkstra/mainBellmanFord.py | FrankzAlarcon/proyecto_libreria | 0418a91e92dc1fb041a1382a3649ac6bda8ed91f | [
"MIT"
] | null | null | null | dijkstra/mainBellmanFord.py | FrankzAlarcon/proyecto_libreria | 0418a91e92dc1fb041a1382a3649ac6bda8ed91f | [
"MIT"
] | null | null | null | from BellmanFord import Grafo
g=Grafo(10)
g.agregarArista(1,2,3)
g.agregarArista(1,4,5)
g.agregarArista(1,3,5)
g.agregarArista(2,1,3)
g.agregarArista(2,3,9)
g.agregarArista(2,7,3)
g.agregarArista(4,1,5)
g.agregarArista(4,3,5)
g.agregarArista(4,6,15)
g.agregarArista(3,1,5)
g.agregarArista(3,2,9)
g.agregarArista(3,4,5)
g.agregarArista(3,8,3)
g.agregarArista(3,6,5)
g.agregarArista(7,2,3)
g.agregarArista(7,8,5)
g.agregarArista(7,5,3)
g.agregarArista(8,7,5)
g.agregarArista(8,3,3)
g.agregarArista(8,5,5)
g.agregarArista(8,9,6)
g.agregarArista(6,8,5)
g.agregarArista(6,3,5)
g.agregarArista(6,4,15)
g.agregarArista(6,9,8)
g.agregarArista(5,7,3)
g.agregarArista(5,9,5)
g.agregarArista(9,5,5)
g.agregarArista(9,8,6)
g.agregarArista(9,6,8)
g.bellmanFord(1)
| 20.378378 | 29 | 0.741379 | 160 | 754 | 3.49375 | 0.10625 | 0.751342 | 0.375671 | 0.085868 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.132867 | 0.051724 | 754 | 36 | 30 | 20.944444 | 0.648951 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.030303 | 0 | 0.030303 | 0 | 0 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
fdcd31f99f7cc9b74335bc326937a5850de3720c | 1,497 | py | Python | tests/selenium/System Settings/Build.py | sivaanil/laravel | 14900b071a514379f0161c5fd7bea05300dee083 | [
"MIT"
] | 1 | 2021-11-16T08:07:07.000Z | 2021-11-16T08:07:07.000Z | tests/selenium/System Settings/Build.py | sivaanil/laravel | 14900b071a514379f0161c5fd7bea05300dee083 | [
"MIT"
] | null | null | null | tests/selenium/System Settings/Build.py | sivaanil/laravel | 14900b071a514379f0161c5fd7bea05300dee083 | [
"MIT"
] | null | null | null | __author__ = 'emily.ford'
# -*- coding: utf-8 -*-
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import Select
from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import NoAlertPresentException
import sys
sys.path.append('..')
import c2_test_case
import selenium_config
import unittest, time, re, os, subprocess
class BuildWrapper(c2_test_case.C2TestCase):
def test_device_info(self):
driver = self.config.driver
ResetBrowserPath = "//div[@id='mainPanelView']/div[2]/form/div/div/div[2]/div/button[2]"
ResetWebBrowserClosePath = "//div[@id='resetGuacamoleWindowContent']/div/form/div/div/div[2]/img"
print "The General Test will now start."
time.sleep(6)
driver.find_element_by_link_text("System Settings").click()
time.sleep(5)
print "C11553 will now be tested."
#have test check system settings
print "C11554 will now be tested."
driver.find_element_by_xpath(ResetBrowserPath).click()
time.sleep(3)
driver.find_element_by_xpath(ResetWebBrowserClosePath).click()
"""
Test cases to implement:
-System Information Should Display Correctly
-Reset Browser Dialog
-Reboot Dialog
"""
if __name__ == "__main__":
BuildWrapper.config = selenium_config.default_config()
unittest.main()
| 36.512195 | 105 | 0.710755 | 182 | 1,497 | 5.675824 | 0.483516 | 0.0697 | 0.060987 | 0.055179 | 0.1394 | 0 | 0 | 0 | 0 | 0 | 0 | 0.017256 | 0.187041 | 1,497 | 40 | 106 | 37.425 | 0.831553 | 0.034736 | 0 | 0 | 0 | 0.034483 | 0.197205 | 0.104814 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.344828 | null | null | 0.103448 | 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 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
fdce8e20058398d612ad874e78cf6d8ac62182fa | 2,402 | py | Python | src/domain/movie/movie.py | masterWeber/showtimes | 90cf8009ff82887bf117f7d1aedab8c5f3893a1c | [
"MIT"
] | null | null | null | src/domain/movie/movie.py | masterWeber/showtimes | 90cf8009ff82887bf117f7d1aedab8c5f3893a1c | [
"MIT"
] | null | null | null | src/domain/movie/movie.py | masterWeber/showtimes | 90cf8009ff82887bf117f7d1aedab8c5f3893a1c | [
"MIT"
] | null | null | null | from __future__ import annotations
from typing import List
from src.domain.common.entity import Entity
from src.domain.movie.director import Director
from src.domain.movie.genre import Genre
from src.domain.movie.movie_id import MovieId
from src.domain.movie.movie_id_generator import MovieIdGenerator
class Movie(Entity):
__id: MovieId
__name: str
__description: str
__genres: List[Genre]
__director: Director
__duration: int
__year: int
__poster: str
__trailer: str
def __init__(self, id_: MovieId, name: str) -> None:
if not name.strip():
raise ValueError("The `name` cannot be empty.")
self.__id = id_
self.__name = name
@property
def id(self) -> MovieId:
return self.__id
@property
def name(self) -> str:
return self.__name
@name.setter
def name(self, name: str) -> None:
self.__name = name
@property
def description(self) -> str:
return self.__description
@description.setter
def description(self, description: str) -> None:
self.__description = description
@property
def genres(self) -> List[Genre]:
return self.__genres
@genres.setter
def genres(self, genres: List[Genre]) -> None:
self.__genres = genres
def add_genre(self, genre: Genre) -> None:
self.__genres.append(genre)
@property
def director(self) -> Director:
return self.__director
@director.setter
def director(self, director: Director) -> None:
self.__director = director
@property
def duration(self) -> int:
return self.__duration
@duration.setter
def duration(self, duration: int) -> None:
self.__duration = duration
@property
def year(self) -> int:
return self.__year
@year.setter
def year(self, year: int) -> None:
self.__year = year
@property
def poster(self) -> str:
return self.__poster
@poster.setter
def poster(self, poster: str) -> None:
self.__poster = poster
@property
def trailer(self) -> str:
return self.__trailer
@trailer.setter
def trailer(self, trailer: str) -> None:
self.__trailer = trailer
@staticmethod
def create(id_generator: MovieIdGenerator, name: str) -> Movie:
return Movie(id_generator.generate(), name)
| 23.320388 | 67 | 0.639467 | 281 | 2,402 | 5.202847 | 0.170819 | 0.067715 | 0.04446 | 0.049248 | 0.065663 | 0.0342 | 0 | 0 | 0 | 0 | 0 | 0 | 0.263114 | 2,402 | 102 | 68 | 23.54902 | 0.825989 | 0 | 0 | 0.141026 | 0 | 0 | 0.011241 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25641 | false | 0 | 0.089744 | 0.128205 | 0.602564 | 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 | 0 | 0 | 0 | 2 |
fdd3d02553a6ad324190ee3d192c66cf9355e488 | 218 | py | Python | setup.py | Murthy9999/PySecAnalyzer | f3360ead302ef89610baef2ecb169101af3177b0 | [
"Apache-2.0"
] | null | null | null | setup.py | Murthy9999/PySecAnalyzer | f3360ead302ef89610baef2ecb169101af3177b0 | [
"Apache-2.0"
] | null | null | null | setup.py | Murthy9999/PySecAnalyzer | f3360ead302ef89610baef2ecb169101af3177b0 | [
"Apache-2.0"
] | null | null | null | # Copyright 2021 VRM Software solution india Ltd.
#
# SPDX-License-Identifier: Apache-2.0
import setuptools
setuptools.setup(
python_requires='>=3.5',
setup_requires=['pbr>=2.0.0'],
pbr=True)
| 19.818182 | 52 | 0.66055 | 29 | 218 | 4.896552 | 0.758621 | 0.028169 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.063218 | 0.201835 | 218 | 10 | 53 | 21.8 | 0.752874 | 0.389908 | 0 | 0 | 0 | 0 | 0.12605 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.2 | 0 | 0.2 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
fde4f07e2cf29f55d580e864d2a3b7b96ca4cf6c | 509 | py | Python | sample_server.py | sandu-alexandru/asn_diameter_python | 69a5398ce80b1b9b97f3142672f0fcbfdfcc6444 | [
"MIT"
] | null | null | null | sample_server.py | sandu-alexandru/asn_diameter_python | 69a5398ce80b1b9b97f3142672f0fcbfdfcc6444 | [
"MIT"
] | null | null | null | sample_server.py | sandu-alexandru/asn_diameter_python | 69a5398ce80b1b9b97f3142672f0fcbfdfcc6444 | [
"MIT"
] | 1 | 2019-11-10T15:43:34.000Z | 2019-11-10T15:43:34.000Z | """
Sample Diameter Server, which can be used for testing purposes.
Generates a Diameter Server with the default(local) config,
and then starts the server, making it available
for incoming connections and requests handling.
"""
from diameter_server import *
if __name__ == "__main__":
"""
Main method for the Sample Diameter Server.
Instantiates a Diameter Server, and then starts it.
"""
# Generating a Diameter server and starting it
server = DiameterServer()
server.start()
| 25.45 | 63 | 0.72888 | 66 | 509 | 5.484848 | 0.575758 | 0.232044 | 0.124309 | 0.099448 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.202358 | 509 | 19 | 64 | 26.789474 | 0.891626 | 0.520629 | 0 | 0 | 1 | 0 | 0.066667 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 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 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
fdf07178798d0289e60f0bcbda6263ff74a7a25e | 563 | py | Python | examples/search_page.py | chatnoir-eu/chatnoir-api | aff5059d2caafc892d0ba750889dc9938fbb0493 | [
"MIT"
] | 3 | 2022-01-25T10:31:19.000Z | 2022-01-27T10:21:51.000Z | examples/search_page.py | chatnoir-eu/chatnoir-api | aff5059d2caafc892d0ba750889dc9938fbb0493 | [
"MIT"
] | 1 | 2022-01-22T17:28:47.000Z | 2022-01-24T12:57:30.000Z | examples/search_page.py | heinrichreimer/chatnoir-api | aff5059d2caafc892d0ba750889dc9938fbb0493 | [
"MIT"
] | 1 | 2022-03-31T14:59:44.000Z | 2022-03-31T14:59:44.000Z | from chatnoir_api.v1 import search_page, search_phrases_page
api_key: str = input("API key: ")
top_5_results_search = search_page(
api_key, "python library",
start=0,
size=5
)
print(top_5_results_search)
top_5_results_search_phrases = search_phrases_page(
api_key, "python library",
minimal=False,
start=0,
size=5
)
print(top_5_results_search_phrases)
top_5_results_search_phrases_minimal = search_phrases_page(
api_key, "python library",
minimal=True,
start=0,
size=5
)
print(top_5_results_search_phrases_minimal)
| 20.851852 | 60 | 0.751332 | 85 | 563 | 4.541176 | 0.270588 | 0.235751 | 0.170984 | 0.264249 | 0.795337 | 0.61399 | 0.515544 | 0.515544 | 0.292746 | 0.207254 | 0 | 0.027542 | 0.161634 | 563 | 26 | 61 | 21.653846 | 0.790254 | 0 | 0 | 0.409091 | 0 | 0 | 0.090586 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.045455 | 0 | 0.045455 | 0.136364 | 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 | 0 | 0 | 0 | 0 | 2 |
fdf56c7cdc3abe3bac947966a48ac3af2cc8408f | 1,596 | py | Python | gluon/packages/dal/pydal/parsers/oracle.py | ArtemTokar13/web2py | a2852ecda7bd2bb6cfb702952d8fd729872d50de | [
"BSD-3-Clause"
] | 408 | 2015-01-01T10:31:47.000Z | 2022-03-26T17:41:21.000Z | gluon/packages/dal/pydal/parsers/oracle.py | ArtemTokar13/web2py | a2852ecda7bd2bb6cfb702952d8fd729872d50de | [
"BSD-3-Clause"
] | 521 | 2015-01-08T14:45:54.000Z | 2022-03-24T11:15:22.000Z | gluon/packages/dal/pydal/parsers/oracle.py | ArtemTokar13/web2py | a2852ecda7bd2bb6cfb702952d8fd729872d50de | [
"BSD-3-Clause"
] | 158 | 2015-01-25T20:02:00.000Z | 2022-03-01T06:29:12.000Z | from ..adapters.oracle import Oracle
import json
from .base import BasicParser, ListsParser
from datetime import datetime, date, time, timedelta
from base64 import b64decode
from .._compat import to_native
from . import parsers, for_type
class OracleParser(BasicParser):
@for_type("integer")
def _integer(self, value):
return int(value)
@for_type("text")
def _text(self, value):
return value
@for_type("clob")
def _clob(self, value):
return value
@for_type("blob")
def _blob(self, value):
decoded = b64decode(value.read())
try:
decoded = to_native(decoded)
except:
pass
return decoded
@for_type("json")
def _json(self, value):
return json.loads(value)
@for_type("date")
def _date(self, value):
if isinstance(value, datetime):
return value.date()
(y, m, d) = map(int, str(value)[:10].strip().split("-"))
return date(y, m, d)
@for_type("list:reference")
def _list_references(self, value, field_type):
return super(OracleParser, self)._list_references.f(self, value, field_type)
class OracleListsParser(ListsParser):
@for_type("list:integer")
def _list_integers(self, value):
return super(OracleListsParser, self)._list_integers.f(self, value)
@for_type("list:string")
def _list_strings(self, value):
return super(OracleListsParser, self)._list_strings.f(self, value)
@parsers.register_for(Oracle)
class OracleCommonparser(OracleParser, OracleListsParser):
pass
| 26.163934 | 84 | 0.657895 | 194 | 1,596 | 5.237113 | 0.304124 | 0.106299 | 0.088583 | 0.03937 | 0.141732 | 0.141732 | 0.088583 | 0 | 0 | 0 | 0 | 0.006478 | 0.22619 | 1,596 | 60 | 85 | 26.6 | 0.816194 | 0 | 0 | 0.085106 | 0 | 0 | 0.040727 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.191489 | false | 0.042553 | 0.148936 | 0.148936 | 0.617021 | 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 | 0 | 1 | 1 | 0 | 0 | 2 |
e33fdbface449c146ffd19176d01f573aa7ddafa | 2,127 | py | Python | Computer science/Programming languages/Python/Python libraries/Networking/BeautifulSoup; working with HTML/topic.py | chanchanchong/PYTHON-TRACK-IN-HYPERSKILL | 462fe08ff4a2b183fd45a0235ab1ec7a788bd54c | [
"MIT"
] | null | null | null | Computer science/Programming languages/Python/Python libraries/Networking/BeautifulSoup; working with HTML/topic.py | chanchanchong/PYTHON-TRACK-IN-HYPERSKILL | 462fe08ff4a2b183fd45a0235ab1ec7a788bd54c | [
"MIT"
] | null | null | null | Computer science/Programming languages/Python/Python libraries/Networking/BeautifulSoup; working with HTML/topic.py | chanchanchong/PYTHON-TRACK-IN-HYPERSKILL | 462fe08ff4a2b183fd45a0235ab1ec7a788bd54c | [
"MIT"
] | null | null | null | # Theory: BeautifulSoup: working with HTML
# Imagine you are a student who is eager to study regional
# press news. If you collect every news piece manually, it
# will take plenty of time. Lucky for us, Python has some
# tools to offer to automate this process. beautifulsoup is
# a library that helps you analyze the HTML and the XML
# syntax, create parse trees and extract necessary
# information. It also provides web scraping, a simple
# technique of getting data for further analysis. So, by
# combining basic operations in Python, requests, and
# beautifulsoup libraries, you can get all the texts and
# save precious time. Although it is possible to work with
# XML using the library, in this topic, we will focus on
# HTML.
# 1. Installation
# To install beautifulsoup, you need a Python package
# manager pip.
# pip install beautifulsoup4
# Also, you need the requests library to send HTPP
# requests. It can also be installed using ip.
# pip install requests
# Do not forget to import these libraries before starting
# your work.
import requests
from bs4 import BeautifulSoup
# 2. Getting started with web scraping
# First, we need to create a variable that will store the
# content of the page. To do so, use requests.get() with a
# link as an attribute.
r = requests.get('https://newsineasyenglish.com/2018/05/13/air-pollution/')
# To check whether the page was downloaded successfully,
# you can use status_code. If the returned code is 200,
# there are no errors. If your code is 400 or 500, there are
# some difficulties with getting the page.
print(r.status_code)
# Then we use BeautifulSoup() class to create a parse
# tree of our page.
soup = BeautifulSoup(r.content, 'html.parser')
# There are two parameters: r.content is the data of the
# page, and html.parser is a parser included in the
# standard Python library. You can install additional parsers
# like lxml via pip and use them instead of the
# html.parser. The lxml parser is used for swift
# processing.
# The result of the procedure is a tree. You can use the
# prettify() method to turn your tree into a nicely
# formatted string. | 34.306452 | 75 | 0.760226 | 348 | 2,127 | 4.640805 | 0.505747 | 0.014861 | 0.011146 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.012062 | 0.181476 | 2,127 | 62 | 76 | 34.306452 | 0.915566 | 0.864128 | 0 | 0 | 0 | 0 | 0.267206 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 0.4 | 0.2 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
e35d1e3a5e298565f51b443cd80b739dd1482807 | 1,550 | py | Python | tools.py | jztech101/Cenni | 22977404df635d3df2b24e56d4ef1782a8757d71 | [
"EFL-2.0"
] | null | null | null | tools.py | jztech101/Cenni | 22977404df635d3df2b24e56d4ef1782a8757d71 | [
"EFL-2.0"
] | 1 | 2018-06-14T18:54:42.000Z | 2018-06-15T06:28:16.000Z | tools.py | jztech101/Cenni | 22977404df635d3df2b24e56d4ef1782a8757d71 | [
"EFL-2.0"
] | 1 | 2018-12-06T21:12:52.000Z | 2018-12-06T21:12:52.000Z | #!/usr/bin/env python3
import re
def isChan(chan, checkprefix):
if not chan:
return False
elif chan.startswith("#"):
return True
elif checkprefix and len(chan) >= 2 and not chan[0].isalnum() and chan[1] == "#":
return True
else:
return False
def replaceUnicode(string):
string = re.sub('[ᎳᏔ]','W',string)
string = re.sub('[ᴡ]','w',string)
string = re.sub('[οⲟഠо]','o',string)
string = re.sub('[һ]','h',string)
string = re.sub('[ỿу]','y',string)
string = re.sub('[ᥙ]','u',string)
string = re.sub('[ⅠⅼІΙ]','I',string)
string = re.sub('[іⅰ]','i',string)
string = re.sub('[ᖇᏒᎡ]','R',string)
string = re.sub('[ᏟϹСⲤ]','C',string)
string = re.sub('[ⅽсϲ]','c',string)
string = re.sub('[Ꮋ]','H',string)
string = re.sub('[ѕ]','s',string)
string = re.sub('[ᥱе]','e',string)
string = re.sub('[АᎪΑ]','A',string)
string = re.sub('[аɑ]','a',string)
string = re.sub('[ⅿ]','m', string)
string = re.sub('[ⅾԁ]','d',string)
string = re.sub('[ᥒ]','n',string)
string = re.sub('[ɡ]','g',string)
string = re.sub('[рⲣ]','p', string)
string = re.sub('[ᖴ]','F',string)
string = re.sub('[ᴠⅴ]','v', string)
string = re.sub('[∨⋁]','V',string)
string = re.sub('[ϳ]','j',string)
string = re.sub('[∪]','U', string)
string = re.sub('[ᛧ]',',',string)
string = re.sub('[ ]',' ',string)
return string
def removeFormatting(string):
return re.sub('[\x02\x0F\x16\x1D\x1F]|\x03(\d{,2}(,\d{,2})?)?',' ',string)
| 32.978723 | 85 | 0.530323 | 226 | 1,550 | 3.650442 | 0.349558 | 0.175758 | 0.475152 | 0.57697 | 0.305455 | 0 | 0 | 0 | 0 | 0 | 0 | 0.012136 | 0.202581 | 1,550 | 46 | 86 | 33.695652 | 0.647249 | 0.013548 | 0 | 0.095238 | 0 | 0.02381 | 0.127701 | 0.030124 | 0 | 0 | 0 | 0 | 0 | 1 | 0.071429 | false | 0 | 0.02381 | 0.02381 | 0.238095 | 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 | 0 | 0 | 0 | 2 |
e36c05bad70ff8dda961fcf040415d152aa31211 | 1,392 | py | Python | api/tests/test_models.py | gilleshenrard/ikoab_elise_restful | 51b702b2f08306841e86a75f6d864058055ed085 | [
"MIT"
] | null | null | null | api/tests/test_models.py | gilleshenrard/ikoab_elise_restful | 51b702b2f08306841e86a75f6d864058055ed085 | [
"MIT"
] | 1 | 2018-02-15T21:51:21.000Z | 2018-02-15T21:51:21.000Z | api/tests/test_models.py | gilleshenrard/ikoab_elise_restful | 51b702b2f08306841e86a75f6d864058055ed085 | [
"MIT"
] | null | null | null | from django.test import TestCase
from ..models import Person
class PersonTest(TestCase):
""" Test module for Person model """
def setUp(self):
Person.objects.create(
firstname='John', lastname='Doe', country='UK', email='test@test.com', phone='+44123456789', occupation_field='Diplomacy', occupation='Spy', birthdate='1963-05-01', description='Tall guy')
Person.objects.create(
firstname='Jane', lastname='Dean', country='US', email='test2@test.com', phone='+1123456789', occupation_field='Administration', occupation='Accountance', birthdate='1982-05-01', description='Smart girl')
def test_valid_person(self):
person_john = Person.objects.get(firstname='John')
self.assertEqual(str(person_john), "John")
person_jane = Person.objects.get(firstname='Jane')
self.assertEqual(str(person_jane), "Jane")
def test_invalid_person_firstname(self):
#See .test_views.CreateNewPersonTest.test_create_invalid_person_firstname
# with self.assertRaises(ValidationError):
# Person.objects.create(firstname='!!!')
pass
def test_invalid_person_email(self):
#see .test_views.CreateNewPersonTest.test_create_invalid_person_email
# with self.assertRaises(ValidationError):
# Person.objects.create(email='abcde')
pass | 44.903226 | 216 | 0.678161 | 154 | 1,392 | 5.974026 | 0.396104 | 0.084783 | 0.082609 | 0.091304 | 0.243478 | 0.243478 | 0.243478 | 0.126087 | 0.126087 | 0 | 0 | 0.033778 | 0.19181 | 1,392 | 31 | 217 | 44.903226 | 0.784 | 0.261494 | 0 | 0.235294 | 0 | 0 | 0.157325 | 0 | 0 | 0 | 0 | 0 | 0.117647 | 1 | 0.235294 | false | 0.117647 | 0.117647 | 0 | 0.411765 | 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 | 0 | 0 | 0 | 2 |
e37113aa7035944f65d3da3b0103e7673acebbb4 | 308 | py | Python | main.py | austfish/FNT-GH | 2aa3d40eeca4c91c8a2e23886cdc0bb317635d79 | [
"Apache-2.0"
] | 6 | 2021-01-05T05:50:33.000Z | 2022-01-22T13:55:23.000Z | main.py | austfish/FNT-GH | 2aa3d40eeca4c91c8a2e23886cdc0bb317635d79 | [
"Apache-2.0"
] | null | null | null | main.py | austfish/FNT-GH | 2aa3d40eeca4c91c8a2e23886cdc0bb317635d79 | [
"Apache-2.0"
] | null | null | null | info_modes = {'login': 'inurl:login | inurl:signin | intitle:Login | intitle:"sign in" | inurl:auth',
'signup': 'inurl:signup | inurl:register | intitle:Signup',
'phpinfo': 'ext:php intitle:phpinfo "published by the PHP Group"'}
for info in info_modes:
print(info_modes[info]) | 61.6 | 101 | 0.649351 | 40 | 308 | 4.925 | 0.5 | 0.137056 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.204545 | 308 | 5 | 102 | 61.6 | 0.804082 | 0 | 0 | 0 | 0 | 0.2 | 0.618123 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.2 | 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 | 0 | 0 | 2 |
e3868ab0a7306f04e22a59bb355d438ca88aa420 | 127 | py | Python | b_to_f_path.py | erickcinco/b2f_path | 10409f6e70bbd4dcfd68df15589ad0e4e3c97445 | [
"MIT"
] | null | null | null | b_to_f_path.py | erickcinco/b2f_path | 10409f6e70bbd4dcfd68df15589ad0e4e3c97445 | [
"MIT"
] | null | null | null | b_to_f_path.py | erickcinco/b2f_path | 10409f6e70bbd4dcfd68df15589ad0e4e3c97445 | [
"MIT"
] | null | null | null | import os
while True:
path = input("Enter windows path: ")
print("Linux path: {}".format(path.replace('\\', '/'))) | 25.4 | 59 | 0.574803 | 15 | 127 | 4.866667 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.204724 | 127 | 5 | 59 | 25.4 | 0.722772 | 0 | 0 | 0 | 0 | 0 | 0.298387 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0.25 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
8b4bf74c6a34d28957c94291676615466d631c71 | 1,236 | py | Python | Asteroid_Shooter_v2/asteroid/asteroid_controller.py | fifiman/Asteroid-Shooter-v2 | 3eae33119b272adf03e73c6e1de48ea4a1d45c4a | [
"MIT"
] | null | null | null | Asteroid_Shooter_v2/asteroid/asteroid_controller.py | fifiman/Asteroid-Shooter-v2 | 3eae33119b272adf03e73c6e1de48ea4a1d45c4a | [
"MIT"
] | 6 | 2017-04-17T21:58:59.000Z | 2017-06-02T13:56:51.000Z | Asteroid_Shooter_v2/asteroid/asteroid_controller.py | fifiman/Asteroid-Shooter-v2 | 3eae33119b272adf03e73c6e1de48ea4a1d45c4a | [
"MIT"
] | null | null | null | from asteroid import Asteroid
from homing_asteroid import HomingAsteroid
class AsteroidController(object):
"""
Class that controlls spawning, updating, and maintaining of asteroids.
Attributes:
screen (pygame.Surface): Screen to which asteroids will be drawn to.
ship (Ship): Ship which homing asteroid will follow around.
asteroids (list of Asteroid): Child asteroids of controller.
"""
def __init__(self, screen, ship):
# Asteroid controller attributes.
self.screen = screen
self.ship = ship
self.asteroids = []
def spawnBasicAsteroid(self):
self.asteroids.append(Asteroid(self.screen))
def spawnHomingAsteroid(self):
self.asteroids.append(HomingAsteroid(self.screen, self.ship))
def maintainAsteroids(self):
for asteroid in self.asteroids:
if not asteroid.isActive():
self.asteroids.remove(asteroid)
def clearAsteroids(self):
self.asteroids[:] = []
def updateAsteroids(self, timePassed):
for asteroid in self.asteroids:
asteroid.update(timePassed)
def blitAsteroids(self):
for asteroid in self.asteroids:
asteroid.blitMe()
| 29.428571 | 76 | 0.66343 | 129 | 1,236 | 6.317829 | 0.387597 | 0.127607 | 0.062577 | 0.062577 | 0.125153 | 0.125153 | 0 | 0 | 0 | 0 | 0 | 0 | 0.253236 | 1,236 | 41 | 77 | 30.146341 | 0.88299 | 0.257282 | 0 | 0.130435 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.304348 | false | 0.086957 | 0.086957 | 0 | 0.434783 | 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 | 0 | 0 | 0 | 2 |
8b51bbde640488615a4fd4f61370ca4fc2995a46 | 641 | py | Python | RunIt/app/utils/services/db_redis_connect/connect.py | antx-code/funcode | a8a9b99274e169562771b488a3a9551277ef4b99 | [
"MIT"
] | 3 | 2021-09-27T08:07:07.000Z | 2022-03-11T04:46:30.000Z | RunIt/app/utils/services/db_redis_connect/connect.py | antx-code/funcode | a8a9b99274e169562771b488a3a9551277ef4b99 | [
"MIT"
] | null | null | null | RunIt/app/utils/services/db_redis_connect/connect.py | antx-code/funcode | a8a9b99274e169562771b488a3a9551277ef4b99 | [
"MIT"
] | null | null | null | from loguru import logger
import asyncio
import uvloop
from utils.services.redis.redis_service import RedisService
from utils.services.db.async_mongodb import AsyncMongo
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
from init import config
DB_CONF = config['MONGO']
REDIS_CONF = config['REDIS']
@logger.catch(level='ERROR')
async def db_connection(db, collection, port=DB_CONF['PORT']):
mongodb = AsyncMongo(db, collection, port)
return mongodb
@logger.catch(level='ERROR')
def redis_connection(port=REDIS_CONF['PORT'], redis_db=0):
redis_service = RedisService(port=port, redis_db=redis_db)
return redis_service | 32.05 | 62 | 0.789392 | 90 | 641 | 5.444444 | 0.366667 | 0.073469 | 0.069388 | 0.085714 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.001745 | 0.106084 | 641 | 20 | 63 | 32.05 | 0.853403 | 0 | 0 | 0.117647 | 0 | 0 | 0.043614 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.058824 | false | 0 | 0.352941 | 0 | 0.529412 | 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 | 0 | 1 | 0 | 0 | 2 |
8b6a1467a503221aaf71ad06c6f2e2dcdf414156 | 262 | py | Python | tests/test_french_date.py | H4Help/datefinder | f1e72554730ca4968c3eab9ba62e7bbee6b32e05 | [
"MIT"
] | null | null | null | tests/test_french_date.py | H4Help/datefinder | f1e72554730ca4968c3eab9ba62e7bbee6b32e05 | [
"MIT"
] | null | null | null | tests/test_french_date.py | H4Help/datefinder | f1e72554730ca4968c3eab9ba62e7bbee6b32e05 | [
"MIT"
] | null | null | null | import pytest
from dateutil import tz
import datefinder
from datetime import datetime
def test_french_string():
t = "29/06/2020 à 10h00"
matches = [i for i in datefinder.find_dates(t)]
d = datetime(2020, 6, 29, 10, 0, 0, 0)
assert d in matches
| 21.833333 | 51 | 0.694656 | 44 | 262 | 4.068182 | 0.636364 | 0.022346 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.117073 | 0.217557 | 262 | 11 | 52 | 23.818182 | 0.756098 | 0 | 0 | 0 | 0 | 0 | 0.068702 | 0 | 0 | 0 | 0 | 0 | 0.111111 | 1 | 0.111111 | false | 0 | 0.444444 | 0 | 0.555556 | 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 | 0 | 1 | 0 | 0 | 2 |
8b7ee3c87a9f82d48385f197d43f164c0a746278 | 1,550 | py | Python | Python/[7 kyu] Array element parity .py | KonstantinosAng/CodeWars | 9ec9da9ed95b47b9656a5ecf77f486230fd15e3a | [
"MIT"
] | null | null | null | Python/[7 kyu] Array element parity .py | KonstantinosAng/CodeWars | 9ec9da9ed95b47b9656a5ecf77f486230fd15e3a | [
"MIT"
] | null | null | null | Python/[7 kyu] Array element parity .py | KonstantinosAng/CodeWars | 9ec9da9ed95b47b9656a5ecf77f486230fd15e3a | [
"MIT"
] | null | null | null | # see https://www.codewars.com/kata/5a092d9e46d843b9db000064/solutions/python
def solve(arr):
arr = sorted(arr)
i, j = 0, -1
while True:
if arr[i] + arr[j] != 0:
print(arr[i], arr[j], arr[i+1], arr[j-1])
if arr[i+1] + arr[j] == 0:
return arr[i]
else:
if arr[i + 1] != arr[i]:
return arr[j]
else:
return arr[i]
else:
i += 1
j -= 1
#print(solve([639, 103, 317, -306, 987, -597, -872, 117, 164, -456, 595, -217, 726, -944, -449, 449, 829, 148, 576, -17, -724, 758, 685, 377, -392, -152, 597, -679, -726, 715, 345, 351, 581, -639, 992, -282, 724, -922, -715, -740, -829, -820, -152, -595, -987, -377, 618, -685, -23, -103, 510, 416, -117, 135, 679, 356, 436, -192, 217, -164, -618, -947, -308, -424, 944, -149, 820, -436, -99, 99, -788, 947, -732, -939, 777, 495, -963, -641, -279, -577, 279, 380, 641, -380, -541, -345, -677, -581, 401, -958, 896, -755, 275, 528, -135, 192, -576, 902, 958, -530, 306, -351, 456, 149, 732, 530, 23, 282, -528, -777, -416, -401, 44, -902, 755, -816, 541, -317, 872, 936, 939, 642, 816, 424, -758, -992, 740, 788, 922, -495, -148, -356, 577, -896, -510, 308, -275, -936, 963, 17, -843, 392, 843, -642, -44, 677]) == -152)
#print(solve([1,-1,2,-2,3]) == 3)
#print(solve([-3,1,2,3,-1,-4,-2]) == -4)
#print(solve([1,-1,2,-2,3,3]) == 3)
#print(solve([-110,110,-38,-38,-62,62,-38,-38,-38]) == -38)
#print(solve([ -9,-105,-9,-9,-9,-9,105]) == -9)
| 53.448276 | 819 | 0.485161 | 265 | 1,550 | 2.837736 | 0.392453 | 0.047872 | 0.023936 | 0.031915 | 0.082447 | 0.042553 | 0.042553 | 0.042553 | 0 | 0 | 0 | 0.446661 | 0.256129 | 1,550 | 28 | 820 | 55.357143 | 0.205551 | 0.710968 | 0 | 0.3125 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.0625 | false | 0 | 0 | 0 | 0.25 | 0.0625 | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
8b855715ffe434f7a584172b4a0b6d63112eb943 | 845 | py | Python | lista_ex3.1.py/exercicio1.py | robinson-1985/mentoria_exercises | 8359cead6ee5351851b04cb45f252e3881b79117 | [
"MIT"
] | null | null | null | lista_ex3.1.py/exercicio1.py | robinson-1985/mentoria_exercises | 8359cead6ee5351851b04cb45f252e3881b79117 | [
"MIT"
] | null | null | null | lista_ex3.1.py/exercicio1.py | robinson-1985/mentoria_exercises | 8359cead6ee5351851b04cb45f252e3881b79117 | [
"MIT"
] | null | null | null | ''' 1. A nota final de um estudante é calculada a partir de três notas atribuídas,
respectivamente, a um trabalho de laboratório, a uma avaliação semestral e a um
exame final. A média das três notas mencionadas obedece aos pesos a seguir:
Nota Peso
Trabalho de laboratório 2
Avaliação semestral 3
Exame final 5
Faça um programa que receba as três notas, calcule e mostre a média ponderada e
o conceito que segue a tabela:
Média Ponderada Conceito
8--------10 A
7--------8 B
6--------7 C
5--------6 D
0--------5 E ''' | 46.944444 | 82 | 0.442604 | 92 | 845 | 4.065217 | 0.565217 | 0.072193 | 0.112299 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.035047 | 0.493491 | 845 | 18 | 83 | 46.944444 | 0.838785 | 0.986982 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 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 | 0 | 0 | 0 | 0 | 0 | 2 |
8b8e4406a13cea9fad460000551dae1fbd63851d | 283 | py | Python | TrackingTools/GeomPropagators/python/AnyDirectionAnalyticalPropagator_cfi.py | ckamtsikis/cmssw | ea19fe642bb7537cbf58451dcf73aa5fd1b66250 | [
"Apache-2.0"
] | 852 | 2015-01-11T21:03:51.000Z | 2022-03-25T21:14:00.000Z | TrackingTools/GeomPropagators/python/AnyDirectionAnalyticalPropagator_cfi.py | ckamtsikis/cmssw | ea19fe642bb7537cbf58451dcf73aa5fd1b66250 | [
"Apache-2.0"
] | 30,371 | 2015-01-02T00:14:40.000Z | 2022-03-31T23:26:05.000Z | TrackingTools/GeomPropagators/python/AnyDirectionAnalyticalPropagator_cfi.py | ckamtsikis/cmssw | ea19fe642bb7537cbf58451dcf73aa5fd1b66250 | [
"Apache-2.0"
] | 3,240 | 2015-01-02T05:53:18.000Z | 2022-03-31T17:24:21.000Z | import FWCore.ParameterSet.Config as cms
AnyDirectionAnalyticalPropagator = cms.ESProducer("AnalyticalPropagatorESProducer",
MaxDPhi = cms.double(1.6),
ComponentName = cms.string('AnyDirectionAnalyticalPropagator'),
PropagationDirection = cms.string('anyDirection')
)
| 28.3 | 83 | 0.787986 | 23 | 283 | 9.695652 | 0.73913 | 0.080717 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.007968 | 0.113074 | 283 | 9 | 84 | 31.444444 | 0.880478 | 0 | 0 | 0 | 0 | 0 | 0.263345 | 0.220641 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
8b9380fb564eabd31b9d0e5673aac7d5f6677477 | 19,106 | py | Python | intrepid/prefs_pb2.py | intrepid-geophysics/intrepid-protobuf-py | e01a11e139b0ed3bb9500a8153939d7acfa8b3b4 | [
"Apache-2.0"
] | 1 | 2020-07-08T04:41:52.000Z | 2020-07-08T04:41:52.000Z | intrepid/prefs_pb2.py | intrepid-geophysics/intrepid-protobuf-py | e01a11e139b0ed3bb9500a8153939d7acfa8b3b4 | [
"Apache-2.0"
] | null | null | null | intrepid/prefs_pb2.py | intrepid-geophysics/intrepid-protobuf-py | e01a11e139b0ed3bb9500a8153939d7acfa8b3b4 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: prefs.proto
"""Generated protocol buffer code."""
from google.protobuf.internal import enum_type_wrapper
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
import intrepid.jobs_pb2 as jobs__pb2
import intrepid.ssh_access_profile_pb2 as ssh__access__profile__pb2
DESCRIPTOR = _descriptor.FileDescriptor(
name='prefs.proto',
package='protocols',
syntax='proto2',
serialized_options=b'\n\035com.geomodeller.protocols.appB\013Preferences',
create_key=_descriptor._internal_create_key,
serialized_pb=b'\n\x0bprefs.proto\x12\tprotocols\x1a\njobs.proto\x1a\x18ssh_access_profile.proto\"\xba\x01\n\tUserScope\x12\x1d\n\x04misc\x18\x01 \x01(\x0b\x32\x0f.protocols.Misc\x12%\n\x08\x61utosave\x18\x02 \x01(\x0b\x32\x13.protocols.AutoSave\x12\'\n\tworkspace\x18\x03 \x01(\x0b\x32\x14.protocols.Workspace\x12>\n\x15\x64istributed_computing\x18\x04 \x01(\x0b\x32\x1f.protocols.DistributedComputing\"\xa8\x01\n\x04Misc\x12$\n\x15research_menu_visible\x18\x01 \x01(\x08:\x05\x66\x61lse\x12\"\n\x13shutdown_gracefully\x18\x02 \x01(\x08:\x05\x66\x61lse\x12\x15\n\rlook_and_feel\x18\x03 \x01(\t\x12#\n\x14\x65nable_BRGM_features\x18\x04 \x01(\x08:\x05\x66\x61lse\x12\x1a\n\x0c\x65nable_pulse\x18\x05 \x01(\x08:\x04true\"\x8b\x01\n\x08\x41utoSave\x12\x16\n\x07\x65nabled\x18\x01 \x01(\x08:\x05\x66\x61lse\x12+\n\x1fnumber_of_autosaves_per_project\x18\x02 \x01(\x05:\x02\x31\x30\x12 \n\x10minimum_interval\x18\x03 \x01(\x03:\x06\x33\x30\x30\x30\x30\x30\x12\x18\n\nduty_cycle\x18\x04 \x01(\x02:\x04\x30.05\"\xd7\x01\n\tWorkspace\x12\x1a\n\x12latest_project_uri\x18\x01 \x01(\t\x12\x1c\n\x14latest_workspace_uri\x18\x02 \x01(\t\x12#\n\x1blatest_filechooser_location\x18\x03 \x01(\t\x12\x1d\n\x15latest_project_closed\x18\x04 \x01(\x08\x12-\n\x0e\x63urrent_action\x18\x05 \x01(\x0e\x32\x15.protocols.ActionEnum\x12\x1d\n\x15\x63urrent_action_object\x18\x06 \x01(\t\"w\n\x14\x44istributedComputing\x12@\n\x1b\x64\x65\x66\x61ult_ssh_access_profiles\x18\x01 \x03(\x0b\x32\x1b.protocols.SSHAccessProfile\x12\x1d\n\x04jobs\x18\x02 \x01(\x0b\x32\x0f.protocols.Jobs\"d\n\x04Jobs\x12/\n\x0einversion_jobs\x18\x01 \x03(\x0b\x32\x17.protocols.InversionJob\x12+\n\x0c\x66orward_jobs\x18\x02 \x03(\x0b\x32\x15.protocols.ForwardJob*6\n\nActionEnum\x12\x08\n\x04NOOP\x10\x00\x12\x08\n\x04LOAD\x10\x01\x12\x08\n\x04SAVE\x10\x02\x12\n\n\x06\x45XPORT\x10\x03\x42,\n\x1d\x63om.geomodeller.protocols.appB\x0bPreferences'
,
dependencies=[jobs__pb2.DESCRIPTOR,ssh__access__profile__pb2.DESCRIPTOR,])
_ACTIONENUM = _descriptor.EnumDescriptor(
name='ActionEnum',
full_name='protocols.ActionEnum',
filename=None,
file=DESCRIPTOR,
create_key=_descriptor._internal_create_key,
values=[
_descriptor.EnumValueDescriptor(
name='NOOP', index=0, number=0,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
_descriptor.EnumValueDescriptor(
name='LOAD', index=1, number=1,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
_descriptor.EnumValueDescriptor(
name='SAVE', index=2, number=2,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
_descriptor.EnumValueDescriptor(
name='EXPORT', index=3, number=3,
serialized_options=None,
type=None,
create_key=_descriptor._internal_create_key),
],
containing_type=None,
serialized_options=None,
serialized_start=1007,
serialized_end=1061,
)
_sym_db.RegisterEnumDescriptor(_ACTIONENUM)
ActionEnum = enum_type_wrapper.EnumTypeWrapper(_ACTIONENUM)
NOOP = 0
LOAD = 1
SAVE = 2
EXPORT = 3
_USERSCOPE = _descriptor.Descriptor(
name='UserScope',
full_name='protocols.UserScope',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='misc', full_name='protocols.UserScope.misc', index=0,
number=1, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='autosave', full_name='protocols.UserScope.autosave', index=1,
number=2, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='workspace', full_name='protocols.UserScope.workspace', index=2,
number=3, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='distributed_computing', full_name='protocols.UserScope.distributed_computing', index=3,
number=4, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=65,
serialized_end=251,
)
_MISC = _descriptor.Descriptor(
name='Misc',
full_name='protocols.Misc',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='research_menu_visible', full_name='protocols.Misc.research_menu_visible', index=0,
number=1, type=8, cpp_type=7, label=1,
has_default_value=True, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='shutdown_gracefully', full_name='protocols.Misc.shutdown_gracefully', index=1,
number=2, type=8, cpp_type=7, label=1,
has_default_value=True, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='look_and_feel', full_name='protocols.Misc.look_and_feel', index=2,
number=3, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='enable_BRGM_features', full_name='protocols.Misc.enable_BRGM_features', index=3,
number=4, type=8, cpp_type=7, label=1,
has_default_value=True, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='enable_pulse', full_name='protocols.Misc.enable_pulse', index=4,
number=5, type=8, cpp_type=7, label=1,
has_default_value=True, default_value=True,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=254,
serialized_end=422,
)
_AUTOSAVE = _descriptor.Descriptor(
name='AutoSave',
full_name='protocols.AutoSave',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='enabled', full_name='protocols.AutoSave.enabled', index=0,
number=1, type=8, cpp_type=7, label=1,
has_default_value=True, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='number_of_autosaves_per_project', full_name='protocols.AutoSave.number_of_autosaves_per_project', index=1,
number=2, type=5, cpp_type=1, label=1,
has_default_value=True, default_value=10,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='minimum_interval', full_name='protocols.AutoSave.minimum_interval', index=2,
number=3, type=3, cpp_type=2, label=1,
has_default_value=True, default_value=300000,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='duty_cycle', full_name='protocols.AutoSave.duty_cycle', index=3,
number=4, type=2, cpp_type=6, label=1,
has_default_value=True, default_value=float(0.05),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=425,
serialized_end=564,
)
_WORKSPACE = _descriptor.Descriptor(
name='Workspace',
full_name='protocols.Workspace',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='latest_project_uri', full_name='protocols.Workspace.latest_project_uri', index=0,
number=1, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='latest_workspace_uri', full_name='protocols.Workspace.latest_workspace_uri', index=1,
number=2, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='latest_filechooser_location', full_name='protocols.Workspace.latest_filechooser_location', index=2,
number=3, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='latest_project_closed', full_name='protocols.Workspace.latest_project_closed', index=3,
number=4, type=8, cpp_type=7, label=1,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='current_action', full_name='protocols.Workspace.current_action', index=4,
number=5, type=14, cpp_type=8, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='current_action_object', full_name='protocols.Workspace.current_action_object', index=5,
number=6, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=567,
serialized_end=782,
)
_DISTRIBUTEDCOMPUTING = _descriptor.Descriptor(
name='DistributedComputing',
full_name='protocols.DistributedComputing',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='default_ssh_access_profiles', full_name='protocols.DistributedComputing.default_ssh_access_profiles', index=0,
number=1, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='jobs', full_name='protocols.DistributedComputing.jobs', index=1,
number=2, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=784,
serialized_end=903,
)
_JOBS = _descriptor.Descriptor(
name='Jobs',
full_name='protocols.Jobs',
filename=None,
file=DESCRIPTOR,
containing_type=None,
create_key=_descriptor._internal_create_key,
fields=[
_descriptor.FieldDescriptor(
name='inversion_jobs', full_name='protocols.Jobs.inversion_jobs', index=0,
number=1, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
_descriptor.FieldDescriptor(
name='forward_jobs', full_name='protocols.Jobs.forward_jobs', index=1,
number=2, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto2',
extension_ranges=[],
oneofs=[
],
serialized_start=905,
serialized_end=1005,
)
_USERSCOPE.fields_by_name['misc'].message_type = _MISC
_USERSCOPE.fields_by_name['autosave'].message_type = _AUTOSAVE
_USERSCOPE.fields_by_name['workspace'].message_type = _WORKSPACE
_USERSCOPE.fields_by_name['distributed_computing'].message_type = _DISTRIBUTEDCOMPUTING
_WORKSPACE.fields_by_name['current_action'].enum_type = _ACTIONENUM
_DISTRIBUTEDCOMPUTING.fields_by_name['default_ssh_access_profiles'].message_type = ssh__access__profile__pb2._SSHACCESSPROFILE
_DISTRIBUTEDCOMPUTING.fields_by_name['jobs'].message_type = _JOBS
_JOBS.fields_by_name['inversion_jobs'].message_type = jobs__pb2._INVERSIONJOB
_JOBS.fields_by_name['forward_jobs'].message_type = jobs__pb2._FORWARDJOB
DESCRIPTOR.message_types_by_name['UserScope'] = _USERSCOPE
DESCRIPTOR.message_types_by_name['Misc'] = _MISC
DESCRIPTOR.message_types_by_name['AutoSave'] = _AUTOSAVE
DESCRIPTOR.message_types_by_name['Workspace'] = _WORKSPACE
DESCRIPTOR.message_types_by_name['DistributedComputing'] = _DISTRIBUTEDCOMPUTING
DESCRIPTOR.message_types_by_name['Jobs'] = _JOBS
DESCRIPTOR.enum_types_by_name['ActionEnum'] = _ACTIONENUM
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
UserScope = _reflection.GeneratedProtocolMessageType('UserScope', (_message.Message,), {
'DESCRIPTOR' : _USERSCOPE,
'__module__' : 'prefs_pb2'
# @@protoc_insertion_point(class_scope:protocols.UserScope)
})
_sym_db.RegisterMessage(UserScope)
Misc = _reflection.GeneratedProtocolMessageType('Misc', (_message.Message,), {
'DESCRIPTOR' : _MISC,
'__module__' : 'prefs_pb2'
# @@protoc_insertion_point(class_scope:protocols.Misc)
})
_sym_db.RegisterMessage(Misc)
AutoSave = _reflection.GeneratedProtocolMessageType('AutoSave', (_message.Message,), {
'DESCRIPTOR' : _AUTOSAVE,
'__module__' : 'prefs_pb2'
# @@protoc_insertion_point(class_scope:protocols.AutoSave)
})
_sym_db.RegisterMessage(AutoSave)
Workspace = _reflection.GeneratedProtocolMessageType('Workspace', (_message.Message,), {
'DESCRIPTOR' : _WORKSPACE,
'__module__' : 'prefs_pb2'
# @@protoc_insertion_point(class_scope:protocols.Workspace)
})
_sym_db.RegisterMessage(Workspace)
DistributedComputing = _reflection.GeneratedProtocolMessageType('DistributedComputing', (_message.Message,), {
'DESCRIPTOR' : _DISTRIBUTEDCOMPUTING,
'__module__' : 'prefs_pb2'
# @@protoc_insertion_point(class_scope:protocols.DistributedComputing)
})
_sym_db.RegisterMessage(DistributedComputing)
Jobs = _reflection.GeneratedProtocolMessageType('Jobs', (_message.Message,), {
'DESCRIPTOR' : _JOBS,
'__module__' : 'prefs_pb2'
# @@protoc_insertion_point(class_scope:protocols.Jobs)
})
_sym_db.RegisterMessage(Jobs)
DESCRIPTOR._options = None
# @@protoc_insertion_point(module_scope)
| 42.934831 | 1,898 | 0.760285 | 2,441 | 19,106 | 5.60508 | 0.103236 | 0.046777 | 0.076378 | 0.069069 | 0.646104 | 0.572796 | 0.552916 | 0.552916 | 0.541661 | 0.510379 | 0 | 0.040195 | 0.119753 | 19,106 | 444 | 1,899 | 43.031532 | 0.773338 | 0.028891 | 0 | 0.637717 | 1 | 0.009926 | 0.147751 | 0.102438 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.01737 | 0 | 0.01737 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
8b93c8e0f68cf3ed33b3207a9988a6726dc7907f | 245 | py | Python | 2015/17/test_eggnog_containers.py | GeoffRiley/AdventOfCode | 27fe8670a1923cb3b0675784f5e855ad18c29c93 | [
"Unlicense"
] | 2 | 2020-12-12T03:18:45.000Z | 2021-12-17T00:35:33.000Z | 2015/17/test_eggnog_containers.py | GeoffRiley/AdventOfCode | 27fe8670a1923cb3b0675784f5e855ad18c29c93 | [
"Unlicense"
] | null | null | null | 2015/17/test_eggnog_containers.py | GeoffRiley/AdventOfCode | 27fe8670a1923cb3b0675784f5e855ad18c29c93 | [
"Unlicense"
] | null | null | null | import pytest
from eggnog_containers import how_many_ways
@pytest.mark.parametrize('qty, containers, ways', [
(25, [20, 15, 10, 5, 5], 4)
])
def test_how_many_ways(qty, containers, ways):
assert how_many_ways(qty, containers) == ways
| 22.272727 | 51 | 0.714286 | 37 | 245 | 4.513514 | 0.540541 | 0.125749 | 0.197605 | 0.167665 | 0.335329 | 0.335329 | 0 | 0 | 0 | 0 | 0 | 0.05314 | 0.155102 | 245 | 10 | 52 | 24.5 | 0.753623 | 0 | 0 | 0 | 0 | 0 | 0.085714 | 0 | 0 | 0 | 0 | 0 | 0.142857 | 1 | 0.142857 | false | 0 | 0.285714 | 0 | 0.428571 | 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 | 0 | 0 | 0 | 2 |
8b9bc30f5ba32af8f0480e5079024a07ed7820e8 | 342 | py | Python | r53_ptr_vpc_associator/__init__.py | rubelw/r53_ptr_vpc_associator | f1b98bf688ce1dd15011a9a059bf7375dea0b68f | [
"MIT"
] | null | null | null | r53_ptr_vpc_associator/__init__.py | rubelw/r53_ptr_vpc_associator | f1b98bf688ce1dd15011a9a059bf7375dea0b68f | [
"MIT"
] | null | null | null | r53_ptr_vpc_associator/__init__.py | rubelw/r53_ptr_vpc_associator | f1b98bf688ce1dd15011a9a059bf7375dea0b68f | [
"MIT"
] | null | null | null | """
Init
"""
from __future__ import absolute_import, division, print_function
import pkg_resources
from r53_ptr_vpc_associator.Associator import Associator #noqa
__version__ = pkg_resources.get_distribution('r53_ptr_vpc_associator').version
__all__ = [
]
__title__ = 'r53_ptr_vpc_associator'
__version__ = '0.0.9'
__author__ = 'Will Rubel'
| 22.8 | 78 | 0.807018 | 44 | 342 | 5.409091 | 0.568182 | 0.07563 | 0.113445 | 0.239496 | 0.218487 | 0 | 0 | 0 | 0 | 0 | 0 | 0.029316 | 0.102339 | 342 | 14 | 79 | 24.428571 | 0.745928 | 0.026316 | 0 | 0 | 0 | 0 | 0.181538 | 0.135385 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0.111111 | 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 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
8ba8002678b62b7cc7ac0b87251599b81ed16d46 | 152 | py | Python | emacs-the-best-python-editor/PyEval/debug-example.py | syberflea/materials | 54f44725b40edf00c1b523d7a85b34a85014d7eb | [
"MIT"
] | 3,682 | 2018-05-07T19:45:24.000Z | 2022-03-31T15:19:10.000Z | emacs-the-best-python-editor/PyEval/debug-example.py | sribarrow/materials | c17c4a4d6f8487e59eac1df8c88ca92b73d6d2a5 | [
"MIT"
] | 148 | 2018-05-15T21:18:49.000Z | 2022-03-21T11:25:39.000Z | emacs-the-best-python-editor/PyEval/debug-example.py | sribarrow/materials | c17c4a4d6f8487e59eac1df8c88ca92b73d6d2a5 | [
"MIT"
] | 5,535 | 2018-05-25T23:36:08.000Z | 2022-03-31T16:55:52.000Z | """
Example code for debugging PyEval
"""
from pyeval_expression import Expression
expr = Expression("53 * -2 + 4")
expr.parse()
print(expr.result())
| 15.2 | 40 | 0.710526 | 20 | 152 | 5.35 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.030769 | 0.144737 | 152 | 9 | 41 | 16.888889 | 0.792308 | 0.217105 | 0 | 0 | 0 | 0 | 0.099099 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0.25 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
8bbb0f1ec5b0e75a377f0e8d8c93d101c49f8ace | 783 | py | Python | path/addon_path_provider.py | thatsIch/sublime-rainmeter | 89d67adfd0ef196360785aa2aedecb693f71e965 | [
"MIT"
] | 56 | 2015-11-16T06:45:51.000Z | 2021-12-31T10:06:55.000Z | path/addon_path_provider.py | thatsIch/sublime-rainmeter | 89d67adfd0ef196360785aa2aedecb693f71e965 | [
"MIT"
] | 82 | 2016-11-06T01:18:50.000Z | 2021-12-15T04:37:50.000Z | path/addon_path_provider.py | thatsIch/sublime-rainmeter | 89d67adfd0ef196360785aa2aedecb693f71e965 | [
"MIT"
] | 8 | 2015-11-26T19:28:49.000Z | 2021-03-08T22:39:26.000Z | """
This module provides methods for determine the addon path.
Rainmeter has an built-in variable called #ADDONSPATH#.
With this you can directly route to the drive in which Rainmeter is contained.
If by some chance people use @Include on #ADDONSPATH# it is still able to resolve
the path and open the include for you.
"""
import os.path
from functools import lru_cache
from .. import logger
from .setting_path_provider import get_cached_setting_path
@lru_cache(maxsize=None)
def get_cached_addon_path():
"""Get the value of the #ADDONSPATH# variable."""
settingspath = get_cached_setting_path()
if not settingspath:
logger.error("#SETTINGSPATH# resolution required but was not found")
return
return os.path.join(settingspath, "Addons") + "\\"
| 29 | 81 | 0.749681 | 114 | 783 | 5.035088 | 0.596491 | 0.057491 | 0.055749 | 0.069686 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.174968 | 783 | 26 | 82 | 30.115385 | 0.888545 | 0.458493 | 0 | 0 | 0 | 0 | 0.145985 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.090909 | false | 0 | 0.363636 | 0 | 0.545455 | 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 | 0 | 1 | 0 | 0 | 2 |
8bbcdb011c0982d0d0e587f1a79cef504fcb90f1 | 1,565 | py | Python | backend/users/views.py | pantoja/PokeBattle | 2b5561aefd9117903ee4cdc516d424a6c6413307 | [
"MIT"
] | null | null | null | backend/users/views.py | pantoja/PokeBattle | 2b5561aefd9117903ee4cdc516d424a6c6413307 | [
"MIT"
] | 11 | 2020-04-06T13:16:36.000Z | 2022-02-10T11:49:04.000Z | backend/users/views.py | pantoja/PokeBattle | 2b5561aefd9117903ee4cdc516d424a6c6413307 | [
"MIT"
] | null | null | null | from django.contrib import messages
from django.contrib.auth import authenticate, login
from django.contrib.auth.mixins import LoginRequiredMixin
from django.contrib.auth.views import LoginView, LogoutView
from django.http import HttpResponseRedirect
from django.urls import reverse_lazy
from django.views.generic import CreateView, FormView
from users.email import send_signup_invite_email
from users.forms import InviteFriendForm, UserSignUpForm
from users.models import User
class UserLoginView(LoginView):
template_name = "users/login.html"
class UserLogoutView(LogoutView):
pass
class UserSignUpView(CreateView):
model = User
form_class = UserSignUpForm
template_name = "users/signup.html"
success_url = reverse_lazy("home")
def form_valid(self, form):
super().form_valid(form)
email = form.cleaned_data.get("email")
password = form.cleaned_data.get("password1")
user = authenticate(email=email, password=password)
login(self.request, user)
return HttpResponseRedirect(self.get_success_url())
class InviteFriendView(LoginRequiredMixin, FormView):
form_class = InviteFriendForm
template_name = "users/invite_friend.html"
def form_valid(self, form):
invitee = self.request.user.email
invited = form.cleaned_data.get("email")
url = self.request.build_absolute_uri("/")
send_signup_invite_email(invitee, invited, url)
messages.success(self.request, "Your invitation was sent!")
return HttpResponseRedirect("/invite")
| 32.604167 | 67 | 0.746965 | 184 | 1,565 | 6.217391 | 0.358696 | 0.061189 | 0.059441 | 0.05507 | 0.075175 | 0 | 0 | 0 | 0 | 0 | 0 | 0.000767 | 0.167412 | 1,565 | 47 | 68 | 33.297872 | 0.877206 | 0 | 0 | 0.055556 | 0 | 0 | 0.072204 | 0.015335 | 0 | 0 | 0 | 0 | 0 | 1 | 0.055556 | false | 0.083333 | 0.277778 | 0 | 0.694444 | 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 | 0 | 0 | 1 | 0 | 0 | 2 |
8bdb5057fdd3d7df7c2dba9f5518413480143ec1 | 1,616 | py | Python | backend/run.py | laurentaubin/GLO-2005-Beerbender | f65bee4693d0bb56dd2c5fdd6d5a177aa03c2551 | [
"MIT"
] | null | null | null | backend/run.py | laurentaubin/GLO-2005-Beerbender | f65bee4693d0bb56dd2c5fdd6d5a177aa03c2551 | [
"MIT"
] | 6 | 2020-05-01T23:11:40.000Z | 2022-02-27T04:00:18.000Z | backend/run.py | seancanning37/glo-2005-project-h20 | f65bee4693d0bb56dd2c5fdd6d5a177aa03c2551 | [
"MIT"
] | null | null | null | from flask import Flask, render_template, session
from flask_session import Session
from flask_cors import CORS
from blueprints import beers
from blueprints import home
from blueprints import signup
from blueprints import auth
from blueprints import customers
from blueprints import orders
from blueprints import brands
from blueprints import styles
from blueprints import types
from blueprints import rewards
from initialisation_script import createDatabaseScript, runAllInitScript
app = Flask(__name__,
static_folder="./dist/static",
template_folder="./dist")
CORS(app, resources={r"/*": {"origin": "*"}})
# Implementation from: https://hackersandslackers.com/flask-login-user-authentication/
# Implementation from: https://stackoverflow.com/questions/11994325/how-to-divide-flask-app-into-multiple-py-files
def registerRoutes():
app.register_blueprint(home.home)
app.register_blueprint(beers.beers)
app.register_blueprint(signup.signup_blueprint)
app.register_blueprint(auth.login_blueprint)
app.register_blueprint(customers.customers_blueprint)
app.register_blueprint(orders.orders)
app.register_blueprint(brands.brands)
app.register_blueprint(styles.styles)
app.register_blueprint(types.types)
app.register_blueprint(rewards.rewards)
return app
@app.route('/', defaults={'path': ''})
@app.route('/<path:path>')
def catch_all(path):
return render_template("index.html")
if __name__ == "__main__":
createDatabaseScript('../database/db_init/create_database.sql')
runAllInitScript()
registerRoutes().run(debug=True)
| 33.666667 | 114 | 0.77104 | 192 | 1,616 | 6.307292 | 0.359375 | 0.115607 | 0.165153 | 0.071841 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005666 | 0.126238 | 1,616 | 47 | 115 | 34.382979 | 0.851983 | 0.121906 | 0 | 0 | 0 | 0 | 0.072034 | 0.027542 | 0 | 0 | 0 | 0 | 0 | 1 | 0.052632 | false | 0 | 0.368421 | 0.026316 | 0.473684 | 0.526316 | 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 | 0 | 0 | 1 | 0 | 2 |
8be25ccb62e23e12dcf2964bb72f2bed734b6d99 | 227 | py | Python | scraper/config.py | slikts/batoto-scraper | da6b53a9e6187aa0a3f7b8da110f375db786d40d | [
"Fair"
] | 1 | 2015-02-09T23:53:07.000Z | 2015-02-09T23:53:07.000Z | scraper/config.py | slikts/batoto-scraper | da6b53a9e6187aa0a3f7b8da110f375db786d40d | [
"Fair"
] | null | null | null | scraper/config.py | slikts/batoto-scraper | da6b53a9e6187aa0a3f7b8da110f375db786d40d | [
"Fair"
] | null | null | null | import sys
import twiggy
log = twiggy.log
min_log_level = twiggy.levels.INFO
log_file = sys.stderr
try:
from local_config import *
except ImportError:
pass
twiggy.quickSetup(min_level=min_log_level, file=log_file)
| 14.1875 | 57 | 0.770925 | 35 | 227 | 4.771429 | 0.514286 | 0.107784 | 0.131737 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.15859 | 227 | 15 | 58 | 15.133333 | 0.874346 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.1 | 0.4 | 0 | 0.4 | 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 | 0 | 0 | 0 | 2 |
4754e6ecf44fbf713163277709e8cac9631ba9ea | 1,882 | py | Python | tests/checks/integration/test_os_updates.py | borgified/datadog-checks | 77331df7a53bb8c0ba7193fd44bf863f60ad8646 | [
"MIT"
] | 100 | 2016-07-23T02:50:03.000Z | 2020-09-26T09:26:06.000Z | tests/checks/integration/test_os_updates.py | skatlapa/datadog-checks | b62d44e9ad5557757e14caf2fe58aec2804696fa | [
"MIT"
] | 71 | 2016-07-27T13:24:03.000Z | 2021-01-07T23:27:09.000Z | tests/checks/integration/test_os_updates.py | skatlapa/datadog-checks | b62d44e9ad5557757e14caf2fe58aec2804696fa | [
"MIT"
] | 25 | 2016-09-27T22:58:25.000Z | 2020-05-08T07:41:26.000Z | # 3p
import mock
# project
from checks import AgentCheck
from tests.checks.common import AgentCheckTest, load_check
class TestFileUnit(AgentCheckTest):
CHECK_NAME = 'os_updates'
def __init__(self, *args, **kwargs):
AgentCheckTest.__init__(self, *args, **kwargs)
self.config = {
"init_config": {},
"instances": [{}]
}
@mock.patch('os_updates.UpdatesCheck.get_subprocess_output', return_value='2;1')
def test_basic_check(self, *args):
self.run_check(self.config)
self.assertMetric('updates.available', value=2)
self.assertMetric('updates.security', value=1)
@mock.patch('os_updates.UpdatesCheck.get_subprocess_output', return_value=None)
def test_no_error_if_no_binary(self, *args):
self.run_check(self.config)
# Shouldn't have any metrics if we can't fetch anything
self.assertMetric('updates.available', count=0)
self.assertMetric('updates.security', count=0)
@mock.patch('os_updates.UpdatesCheck.get_subprocess_output', return_value='not-splittable')
def test_no_error_if_bad_format(self, *args):
self.run_check(self.config)
self.assertMetric('updates.available', count=0)
self.assertMetric('updates.security', count=0)
@mock.patch('os_updates.UpdatesCheck.get_subprocess_output', return_value='a;b')
def test_no_error_if_not_numeric(self, *args):
self.run_check(self.config)
self.assertMetric('updates.available', count=0)
self.assertMetric('updates.security', count=0)
@mock.patch('utils.platform.Platform.is_linux', return_value=False)
def test_only_on_linux(self, *args):
self.run_check(self.config)
# Shouldn't have any metrics on non-Linux platforms
self.assertMetric('updates.available', count=0)
self.assertMetric('updates.security', count=0)
| 35.509434 | 95 | 0.698193 | 240 | 1,882 | 5.245833 | 0.295833 | 0.127085 | 0.182685 | 0.059571 | 0.653693 | 0.615568 | 0.615568 | 0.615568 | 0.615568 | 0.615568 | 0 | 0.008393 | 0.176939 | 1,882 | 52 | 96 | 36.192308 | 0.80439 | 0.060574 | 0 | 0.361111 | 0 | 0 | 0.242201 | 0.12025 | 0 | 0 | 0 | 0 | 0.277778 | 1 | 0.166667 | false | 0 | 0.083333 | 0 | 0.305556 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 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 | 2 |
475d1b84af84de3635620257464a55b6c15aa7ce | 389 | py | Python | module_04_datetime/psl_04.04_time_01.py | CodingGearsCourses/Python-3-Standard-Library-Essentials | 8b80bc8b77fa477b6ccbe2886ed9239c2defdfda | [
"Apache-2.0"
] | null | null | null | module_04_datetime/psl_04.04_time_01.py | CodingGearsCourses/Python-3-Standard-Library-Essentials | 8b80bc8b77fa477b6ccbe2886ed9239c2defdfda | [
"Apache-2.0"
] | null | null | null | module_04_datetime/psl_04.04_time_01.py | CodingGearsCourses/Python-3-Standard-Library-Essentials | 8b80bc8b77fa477b6ccbe2886ed9239c2defdfda | [
"Apache-2.0"
] | null | null | null | # --------------------------------
# CodingGears.io
# --------------------------------
# time Module
import time
import random
# TODO: Epoch Time
print(time.time())
# TODO: Using sleep
counter = random.randint(1, 5)
print("Counter Value : {}".format(counter))
print("Sleeping for {} second(s)".format(counter - 1))
for i in range(1, counter):
print(i, end=" ")
time.sleep(1)
| 17.681818 | 54 | 0.544987 | 47 | 389 | 4.510638 | 0.531915 | 0.122642 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.015152 | 0.151671 | 389 | 21 | 55 | 18.52381 | 0.627273 | 0.326478 | 0 | 0 | 0 | 0 | 0.173913 | 0 | 0 | 0 | 0 | 0.047619 | 0 | 1 | 0 | false | 0 | 0.222222 | 0 | 0.222222 | 0.444444 | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 2 |
4766a459f97a69264e2207074f7bc41b61d58c87 | 296 | py | Python | PythonAPI/service_tests/batch_service_test.py | lamarhinchen/assessment-tracker | 6f1fa6aec73b3b1298b7d0a13c16d49e8a10d326 | [
"Unlicense"
] | 3 | 2021-05-25T23:36:43.000Z | 2021-06-15T18:09:52.000Z | PythonAPI/service_tests/batch_service_test.py | lamarhinchen/assessment-tracker | 6f1fa6aec73b3b1298b7d0a13c16d49e8a10d326 | [
"Unlicense"
] | 16 | 2021-05-26T14:03:45.000Z | 2021-06-08T03:27:26.000Z | PythonAPI/service_tests/batch_service_test.py | lamarhinchen/assessment-tracker | 6f1fa6aec73b3b1298b7d0a13c16d49e8a10d326 | [
"Unlicense"
] | 4 | 2021-05-26T03:07:48.000Z | 2021-06-29T19:28:57.000Z | import unittest
from services.batch_services import BatchServices
class BatchTest(unittest.TestCase):
def test_get_batch_by_id(self):
assert BatchServices.get_batch_by_id(1)
def test_get_all_batches_by_year(self):
assert BatchServices.get_all_batches_by_year(2020)
| 19.733333 | 58 | 0.783784 | 42 | 296 | 5.119048 | 0.5 | 0.065116 | 0.093023 | 0.111628 | 0.176744 | 0 | 0 | 0 | 0 | 0 | 0 | 0.02008 | 0.158784 | 296 | 14 | 59 | 21.142857 | 0.843373 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.285714 | 1 | 0.285714 | false | 0 | 0.285714 | 0 | 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 | 0 | 1 | 0 | 0 | 2 |
476c4b921f43ef1123195680dd83843459fda34a | 3,400 | py | Python | eda.py | jvvictor/covid_test | f3ed2a600cde79f7959d8f7224d08152f81e6bdd | [
"MIT"
] | null | null | null | eda.py | jvvictor/covid_test | f3ed2a600cde79f7959d8f7224d08152f81e6bdd | [
"MIT"
] | null | null | null | eda.py | jvvictor/covid_test | f3ed2a600cde79f7959d8f7224d08152f81e6bdd | [
"MIT"
] | null | null | null |
'''
EDA - Exploratory Data Analysis
'''
from enum import unique
from re import search
import numpy as np
import pandas as pd
import os
import glob
import cv2
from sklearn.model_selection import train_test_split
class preprocess:
def __init__(self, data_path):
self.data_path = data_path
self.metadata = self.create_data_frame()
return
def create_data_frame(self):
data_frame = pd.read_csv(self.data_path, sep=",", header=0)
return data_frame
def filter(self):
for n in range(self.metadata.shape[0]):
if self.metadata['modality'][n] != "X-ray":
self.metadata = self.metadata.drop([n], axis=0)
self.metadata.reset_index(drop = True, inplace = True)
for j in range(self.metadata.shape[0]):
if search('.png', self.metadata['filename'][j]):
pass
elif search('.jpg', self.metadata['filename'][j]):
pass
elif search('.jpeg', self.metadata['filename'][j]):
pass
elif search('.JPG', self.metadata['filename'][j]):
pass
else:
self.metadata = self.metadata.drop([j], axis=0)
self.metadata.reset_index(drop = True, inplace = True)
return
def unique_id(self):
listpatient = [self.metadata['patientid'][0]]
for p in range(self.metadata.shape[0]):
if self.metadata['patientid'][p] not in listpatient:
listpatient.append(self.metadata['patientid'][p])
print("")
print("The number of patients is:", len(listpatient))
print("")
return
def unique_dis(self):
listdis = [self.metadata['finding'][0]]
for k in range(self.metadata.shape[0]):
if self.metadata['finding'][k] not in listdis:
listdis.append(self.metadata['finding'][k])
print("")
print("The diseases are:", listdis )
print("The number os diseases is:", len(listdis))
print("")
return
def show_image(self, number_images):
cv2.namedWindow("T", 0)
for l in range(number_images):
img = cv2.imread(os.path.join('../images', self.metadata['filename'][l]), 1)
cv2.imshow('T', img)
cv2.waitKey(0)
return
def transf_binary(self):
for j in range(self.metadata.shape[0]):
if self.metadata['finding'][j] != "COVID-19":
self.metadata['finding'][j] = '0'
else:
self.metadata['finding'][j] = '1'
return
def split_train_data(self):
unique_patients = self.metadata['patientid'].unique()
train , test = train_test_split(unique_patients, test_size = 0.05, random_state = 0, shuffle = True)
self.train_data = self.metadata.copy()
self.val_data = self.metadata.copy()
for i in range(self.metadata.shape[0]):
if self.metadata['patientid'][i] not in test:
self.traindata = self.train_data.drop([i], axis = 0)
else:
self.valdata = self.val_data.drop([i], axis = 0)
self.train_data.reset_index(drop = True, inplace = True)
self.val_data.reset_index(drop = True, inplace = True)
return
if __name__ == "__main__":
pass
| 25.954198 | 108 | 0.565882 | 417 | 3,400 | 4.494005 | 0.263789 | 0.204909 | 0.035219 | 0.060832 | 0.347919 | 0.303095 | 0.303095 | 0.256137 | 0.256137 | 0.216649 | 0 | 0.012226 | 0.302353 | 3,400 | 131 | 109 | 25.954198 | 0.777825 | 0.009118 | 0 | 0.280488 | 0 | 0 | 0.07619 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.097561 | false | 0.060976 | 0.097561 | 0 | 0.304878 | 0.085366 | 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 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
4770f1350b22aef851c5e0499d62c58f3879b5c1 | 223 | py | Python | python/py-strings/swap-case.py | th3c0d3br34ker/hackerrank-solutions | c61e987cbb359fd27e41051c39ffd7f377f0c5f2 | [
"MIT"
] | 1 | 2020-08-04T18:31:24.000Z | 2020-08-04T18:31:24.000Z | python/py-strings/swap-case.py | th3c0d3br34ker/hackerrank-solutions | c61e987cbb359fd27e41051c39ffd7f377f0c5f2 | [
"MIT"
] | null | null | null | python/py-strings/swap-case.py | th3c0d3br34ker/hackerrank-solutions | c61e987cbb359fd27e41051c39ffd7f377f0c5f2 | [
"MIT"
] | null | null | null | def swap_case(s):
t=""
for i in s:
if i.isalpha():
if i.isupper():
t=t+i.lower()
else:
t=t+i.upper()
else:
t=t+i
return (t)
| 14.866667 | 29 | 0.336323 | 30 | 223 | 2.466667 | 0.5 | 0.081081 | 0.121622 | 0.189189 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.524664 | 223 | 14 | 30 | 15.928571 | 0.698113 | 0 | 0 | 0.181818 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.090909 | false | 0 | 0 | 0 | 0.181818 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 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 | 2 |
47786a617d52a2bab0838e558835f33f7a0e6124 | 1,395 | py | Python | tests/sim/test_clk_loop.py | Risto97/pygears | 19393e85101a16762cb3bbbf3010946ef69217f2 | [
"MIT"
] | null | null | null | tests/sim/test_clk_loop.py | Risto97/pygears | 19393e85101a16762cb3bbbf3010946ef69217f2 | [
"MIT"
] | null | null | null | tests/sim/test_clk_loop.py | Risto97/pygears | 19393e85101a16762cb3bbbf3010946ef69217f2 | [
"MIT"
] | null | null | null | # from pygears import gear
# from pygears.typing import Uint
# from pygears.sim import clk, drv, seqr, sim
# from pygears.cookbook.verif import check
# from pygears.sim.extens.vcd import VCD
# def test_general():
# @gear
# async def priority_mux(*din: b'T') -> b'T':
# for i, d in enumerate(din):
# if not d.empty():
# async with d as item:
# print(f'Priority sends {item} from channel {i}')
# yield item
# print(f'Priority done')
# break
# await clk()
# @gear
# async def f(din0: Uint['T'], din1: Uint['T'], *, skip) -> Uint['T']:
# async with din0 as item0:
# print(f'f got {item0} on din0')
# for i in range(skip + 1):
# async with din1 as item1:
# print(f'f got {item1} on din1')
# if i == skip:
# yield item0 + item1
# print(f'f sent {item0 + item1}')
# stim0 = seqr(t=Uint[16], seq=[10]*4) \
# | drv
# stim1 = seqr(t=Uint[16], seq=list(range(8))) \
# | drv
# (f(stim0, stim1, skip=1), stim1) \
# | priority_mux \
# | check(ref=[0, 11, 1, 2, 13, 3, 4, 15, 5, 6, 17, 7])
# sim(outdir='/tmp/proba', extens=[VCD], vcd_include=['*priority*'])
# test_general()
| 30.326087 | 74 | 0.478136 | 182 | 1,395 | 3.637363 | 0.417582 | 0.083082 | 0.031722 | 0.054381 | 0.042296 | 0 | 0 | 0 | 0 | 0 | 0 | 0.051195 | 0.369892 | 1,395 | 45 | 75 | 31 | 0.701934 | 0.941935 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 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 | 0 | 0 | 0 | 0 | 0 | 2 |
477cc8c8ccf1738f714ec5d8f41d2bd78ddc1e6f | 348 | py | Python | tests/integration/flask_app.py | xiamx/scout_apm_python | d03dab45f65cf7d1030e11fabf6da4cf6e72ee59 | [
"MIT"
] | null | null | null | tests/integration/flask_app.py | xiamx/scout_apm_python | d03dab45f65cf7d1030e11fabf6da4cf6e72ee59 | [
"MIT"
] | null | null | null | tests/integration/flask_app.py | xiamx/scout_apm_python | d03dab45f65cf7d1030e11fabf6da4cf6e72ee59 | [
"MIT"
] | null | null | null | # coding: utf-8
from __future__ import absolute_import, division, print_function, unicode_literals
from flask import Flask
app = Flask(__name__)
@app.route("/")
def home():
return "Welcome home."
@app.route("/hello/")
def hello():
return "Hello World!"
@app.route("/crash/")
def crash():
raise ValueError("BØØM!") # non-ASCII
| 15.130435 | 82 | 0.678161 | 45 | 348 | 5 | 0.622222 | 0.106667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.003448 | 0.166667 | 348 | 22 | 83 | 15.818182 | 0.772414 | 0.066092 | 0 | 0 | 0 | 0 | 0.139752 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.166667 | 0.166667 | 0.583333 | 0.083333 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 2 |
47a334917658faf0037522e4068e878ca62061e3 | 607 | py | Python | project/settings.py | CONABIO-audio/selia-admin | 0fe3326d63de7904f86f3040cb613801737880f7 | [
"BSD-4-Clause"
] | null | null | null | project/settings.py | CONABIO-audio/selia-admin | 0fe3326d63de7904f86f3040cb613801737880f7 | [
"BSD-4-Clause"
] | 9 | 2020-02-06T02:10:46.000Z | 2022-01-13T01:53:53.000Z | project/settings.py | CONABIO-audio/selia-admin | 0fe3326d63de7904f86f3040cb613801737880f7 | [
"BSD-4-Clause"
] | null | null | null | import os
from irekua_dev_settings.settings import *
from irekua_database.settings import *
from irekua_models.settings import *
from selia_visualizers.settings import *
from selia_annotator.settings import *
from selia_admin.settings import *
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
MEDIA_ROOT = os.path.join(os.path.dirname(BASE_DIR), 'media')
LOCALE_PATHS = [os.path.join(BASE_DIR, 'locale'), ]
INSTALLED_APPS = (
SELIA_ADMIN_APPS +
SELIA_VISUALIZERS_APPS +
SELIA_ANNOTATOR_APPS +
IREKUA_MODELS_APPS +
IREKUA_DATABASE_APPS +
IREKUA_BASE_APPS
)
| 25.291667 | 70 | 0.772652 | 84 | 607 | 5.238095 | 0.297619 | 0.190909 | 0.204545 | 0.156818 | 0.072727 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.135091 | 607 | 23 | 71 | 26.391304 | 0.838095 | 0 | 0 | 0 | 0 | 0 | 0.018122 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.388889 | 0 | 0.388889 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
47c016e9d4b238ba38a091efcf81ffa835b79def | 449 | py | Python | speedysvc/hybrid_lock/win32/test.py | mcyph/shmrpc | 4e0e972657f677a845eb6e7acbf788535c07117a | [
"Unlicense",
"MIT"
] | 4 | 2020-02-11T04:20:57.000Z | 2021-06-20T10:03:52.000Z | speedysvc/hybrid_lock/win32/test.py | mcyph/shmrpc | 4e0e972657f677a845eb6e7acbf788535c07117a | [
"Unlicense",
"MIT"
] | 1 | 2020-09-16T23:18:30.000Z | 2020-09-21T10:07:22.000Z | speedysvc/hybrid_lock/win32/test.py | mcyph/shmrpc | 4e0e972657f677a845eb6e7acbf788535c07117a | [
"Unlicense",
"MIT"
] | null | null | null | from HybridLock import HybridLock, CONNECT_OR_CREATE, CONNECT_TO_EXISTING
if __name__ == '__main__':
lock = HybridLock(b"my semaphore", CONNECT_OR_CREATE)
lock.lock()
try:
lock.lock(1)
except TimeoutError:
pass
lock2 = HybridLock(b"my semaphore", CONNECT_TO_EXISTING)
#lock2.lock()
#print("SHOULDN'T GET HERE!")
lock.unlock()
lock.lock()
lock.unlock()
lock.lock(1)
#lock.lock(1)
| 19.521739 | 73 | 0.64588 | 57 | 449 | 4.807018 | 0.473684 | 0.175182 | 0.09854 | 0.160584 | 0.211679 | 0 | 0 | 0 | 0 | 0 | 0 | 0.014535 | 0.233853 | 449 | 22 | 74 | 20.409091 | 0.781977 | 0.115813 | 0 | 0.461538 | 0 | 0 | 0.081218 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.076923 | 0.076923 | 0 | 0.076923 | 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 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
47c106116b377f30602e1944fa32dfbdb53a548a | 76 | py | Python | The Huxley/1051 - Volume de uma esfera.py | GuilhermeEsdras/My-Awesome-Practice-Stuff | b79cd3966614449ec1a60021c4db727f3cc619b6 | [
"MIT"
] | null | null | null | The Huxley/1051 - Volume de uma esfera.py | GuilhermeEsdras/My-Awesome-Practice-Stuff | b79cd3966614449ec1a60021c4db727f3cc619b6 | [
"MIT"
] | null | null | null | The Huxley/1051 - Volume de uma esfera.py | GuilhermeEsdras/My-Awesome-Practice-Stuff | b79cd3966614449ec1a60021c4db727f3cc619b6 | [
"MIT"
] | null | null | null | raio = float(input())
vol = (4*3.14*(raio**3)/3)
print("{:.2f}".format(vol)) | 25.333333 | 27 | 0.565789 | 14 | 76 | 3.071429 | 0.714286 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.1 | 0.078947 | 76 | 3 | 27 | 25.333333 | 0.514286 | 0 | 0 | 0 | 0 | 0 | 0.077922 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.333333 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
47c46d3061e5499818d18eca27a7cbab630d6878 | 396 | py | Python | exercises/zh/exc_04_10.py | Jette16/spacy-course | 32df0c8f6192de6c9daba89740a28c0537e4d6a0 | [
"MIT"
] | 2,085 | 2019-04-17T13:10:40.000Z | 2022-03-30T21:51:46.000Z | exercises/zh/exc_04_10.py | Jette16/spacy-course | 32df0c8f6192de6c9daba89740a28c0537e4d6a0 | [
"MIT"
] | 79 | 2019-04-18T14:42:55.000Z | 2022-03-07T08:15:43.000Z | exercises/zh/exc_04_10.py | Jette16/spacy-course | 32df0c8f6192de6c9daba89740a28c0537e4d6a0 | [
"MIT"
] | 361 | 2019-04-17T13:34:32.000Z | 2022-03-28T04:42:45.000Z | TRAINING_DATA = [
(
"我去年去了西安,那里的城墙很壮观!",
{"entities": [(4, 5, "TOURIST_DESTINATION")]},
),
(
"人一辈子一定要去一趟巴黎,但那里的埃菲尔铁塔有点无趣。",
{"entities": [(5, 6, "TOURIST_DESTINATION")]},
),
(
"深圳也有个巴黎的埃菲尔铁塔,哈哈哈",
{"entities": []}
),
(
"北京很适合暑假去:长城、故宫,还有各种好吃的小吃!",
{"entities": [(0, 1, "TOURIST_DESTINATION")]},
),
]
| 20.842105 | 54 | 0.467172 | 28 | 396 | 6.464286 | 0.714286 | 0.298343 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.022222 | 0.318182 | 396 | 18 | 55 | 22 | 0.648148 | 0 | 0 | 0.222222 | 0 | 0 | 0.441919 | 0.131313 | 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 | 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 | 2 |
47c73cb8cac157ab133fbaa7deb0249b5f747625 | 356 | py | Python | src/abaqus/PlotOptions/OdbAnalysisWarning.py | Haiiliin/PyAbaqus | f20db6ebea19b73059fe875a53be370253381078 | [
"MIT"
] | 7 | 2022-01-21T09:15:45.000Z | 2022-02-15T09:31:58.000Z | src/abaqus/PlotOptions/OdbAnalysisWarning.py | Haiiliin/PyAbaqus | f20db6ebea19b73059fe875a53be370253381078 | [
"MIT"
] | null | null | null | src/abaqus/PlotOptions/OdbAnalysisWarning.py | Haiiliin/PyAbaqus | f20db6ebea19b73059fe875a53be370253381078 | [
"MIT"
] | null | null | null | class OdbAnalysisWarning:
"""The OdbAnalysisWarning object stores the description of different warnings encountered
during the analysis.
Notes
-----
This object can be accessed by:
.. code-block:: python
import visualization
session.odbData[name].diagnosticData.analysisWarnings[i]
"""
pass
| 22.25 | 93 | 0.657303 | 34 | 356 | 6.882353 | 0.882353 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.269663 | 356 | 15 | 94 | 23.733333 | 0.9 | 0.752809 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.5 | 0 | 0 | 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 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
47c8fbac65bc9ddb44d001a8596a1544e04e7b5c | 6,721 | py | Python | secretish_balloting/balloting/migrations/0001_initial.py | kimvanwyk/secretish-balloting | 9afd013ea57fd801ed1de039811f714f52d9537d | [
"MIT"
] | null | null | null | secretish_balloting/balloting/migrations/0001_initial.py | kimvanwyk/secretish-balloting | 9afd013ea57fd801ed1de039811f714f52d9537d | [
"MIT"
] | null | null | null | secretish_balloting/balloting/migrations/0001_initial.py | kimvanwyk/secretish-balloting | 9afd013ea57fd801ed1de039811f714f52d9537d | [
"MIT"
] | null | null | null | # Generated by Django 3.1.7 on 2021-05-15 14:47
from django.db import migrations, models
import django.db.models.deletion
# Functions from the following migrations need manual copying.
# Move them and any dependencies into this file, then update the
# RunPython operations to refer to the local versions:
# balloting.migrations.0002_superuser
class Migration(migrations.Migration):
initial = True
dependencies = []
operations = [
migrations.CreateModel(
name="Ballot",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("name_text", models.CharField(max_length=100)),
(
"opening_date",
models.DateTimeField(verbose_name="opening date and time"),
),
(
"closing_date",
models.DateTimeField(verbose_name="closing date and time"),
),
(
"url_fragment_text",
models.CharField(
default="default",
help_text="Slug text to be used in the urls for this ballot",
max_length=40,
),
),
(
"url_summary_fragment_text",
models.CharField(
default="48245591",
help_text="Slug text to be used in the summary url for this ballot",
max_length=40,
),
),
],
),
migrations.CreateModel(
name="Question",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("question_text", models.CharField(max_length=100)),
(
"ballot",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
to="balloting.ballot",
),
),
(
"order_int",
models.IntegerField(default=1, verbose_name="Question order"),
),
],
),
migrations.CreateModel(
name="Choice",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("choice_text", models.CharField(max_length=100)),
(
"question",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
to="balloting.question",
),
),
],
),
migrations.CreateModel(
name="Voter",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"email_text",
models.EmailField(max_length=254, verbose_name="Email address"),
),
(
"description_text",
models.CharField(
help_text="A descriptive note for this voter",
max_length=200,
verbose_name="Description",
),
),
(
"emailed_bool",
models.BooleanField(
default=False,
verbose_name="Voter has been emailed voting instructions",
),
),
(
"url_fragment_text",
models.CharField(
blank=True, default=None, max_length=20, null=True, unique=True
),
),
(
"ballot",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
to="balloting.ballot",
),
),
],
),
migrations.CreateModel(
name="Vote",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"choice",
models.ForeignKey(
default=None,
null=True,
on_delete=django.db.models.deletion.CASCADE,
to="balloting.choice",
),
),
(
"voter",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
to="balloting.voter",
),
),
],
),
migrations.AlterField(
model_name="ballot",
name="url_fragment_text",
field=models.CharField(
help_text="Slug text to be used in the urls for this ballot",
max_length=40,
),
),
migrations.AlterField(
model_name="ballot",
name="url_summary_fragment_text",
field=models.CharField(
help_text="Slug text to be used in the summary url for this ballot",
max_length=40,
),
),
migrations.AlterField(
model_name="question",
name="order_int",
field=models.IntegerField(verbose_name="Question order"),
),
]
| 32.785366 | 92 | 0.381044 | 457 | 6,721 | 5.455142 | 0.256018 | 0.052948 | 0.053349 | 0.052948 | 0.571199 | 0.50341 | 0.466105 | 0.444043 | 0.444043 | 0.424789 | 0 | 0.017053 | 0.537569 | 6,721 | 204 | 93 | 32.946078 | 0.785071 | 0.038387 | 0 | 0.649215 | 1 | 0 | 0.121573 | 0.007744 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.010471 | 0 | 0.031414 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 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 | 2 |
47d2498187d4ec3fdbf7d603cc842c668077f487 | 630 | py | Python | xu/compa/Parapluie/src/ActionWidget/PClose.py | sonnts996/XuCompa-Request | f343e7bfd1b4263eb76438c96d347c549cc75ce3 | [
"Apache-2.0"
] | null | null | null | xu/compa/Parapluie/src/ActionWidget/PClose.py | sonnts996/XuCompa-Request | f343e7bfd1b4263eb76438c96d347c549cc75ce3 | [
"Apache-2.0"
] | null | null | null | xu/compa/Parapluie/src/ActionWidget/PClose.py | sonnts996/XuCompa-Request | f343e7bfd1b4263eb76438c96d347c549cc75ce3 | [
"Apache-2.0"
] | null | null | null | from PyQt5 import QtCore
from PyQt5.QtCore import QSize
from PyQt5.QtWidgets import QToolButton
from xu.compa.Parapluie import Parapluie, PResource
class PClose(QToolButton):
def __init__(self):
super().__init__()
self.setIconSize(QSize(12, 12))
self.setObjectName(Parapluie.Object_CloseButton)
self.setIcon(PResource.defaultIcon(Parapluie.Icon_Cancel_Svg))
def enterEvent(self, a0: QtCore.QEvent):
self.setIcon(PResource.invertIcon(Parapluie.Icon_Cancel_Svg))
def leaveEvent(self, a0: QtCore.QEvent):
self.setIcon(PResource.defaultIcon(Parapluie.Icon_Cancel_Svg))
| 31.5 | 70 | 0.746032 | 75 | 630 | 6.066667 | 0.426667 | 0.059341 | 0.131868 | 0.145055 | 0.417582 | 0.356044 | 0.356044 | 0.232967 | 0 | 0 | 0 | 0.017013 | 0.160317 | 630 | 19 | 71 | 33.157895 | 0.8431 | 0 | 0 | 0.142857 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.214286 | false | 0 | 0.285714 | 0 | 0.571429 | 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 | 0 | 1 | 0 | 0 | 2 |
47ddeaefd9c8202215c2ba8bf8d4ffff8c9c87d8 | 234 | py | Python | setup.py | Stratoshad/energy_analysis | 73a8491631b064291741b5fbea7b0ac7278a2af0 | [
"MIT"
] | null | null | null | setup.py | Stratoshad/energy_analysis | 73a8491631b064291741b5fbea7b0ac7278a2af0 | [
"MIT"
] | null | null | null | setup.py | Stratoshad/energy_analysis | 73a8491631b064291741b5fbea7b0ac7278a2af0 | [
"MIT"
] | null | null | null | from setuptools import find_packages, setup
setup(
name='src',
packages=find_packages(),
version='0.1.0',
description='A project analysing energy data from EU countries',
author='Stratoshad',
license='MIT',
)
| 21.272727 | 68 | 0.683761 | 29 | 234 | 5.448276 | 0.793103 | 0.151899 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.015873 | 0.192308 | 234 | 10 | 69 | 23.4 | 0.820106 | 0 | 0 | 0 | 0 | 0 | 0.299145 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.111111 | 0 | 0.111111 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
47df6416a84494b87b48f96c0d2975511d51415e | 1,615 | py | Python | hood/urls.py | priscillapepe/Neighbourhood | 8eea7dc7f1c4aa70474db3f727f62c0ef4c45db7 | [
"MIT"
] | null | null | null | hood/urls.py | priscillapepe/Neighbourhood | 8eea7dc7f1c4aa70474db3f727f62c0ef4c45db7 | [
"MIT"
] | null | null | null | hood/urls.py | priscillapepe/Neighbourhood | 8eea7dc7f1c4aa70474db3f727f62c0ef4c45db7 | [
"MIT"
] | null | null | null | """hood URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.1/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path,include
from django.contrib.auth import views
from community.views import home,signup
from community.forms import UserLoginForm, ResetPasswordForm
urlpatterns = [
path('admin/', admin.site.urls),
path('',include('community.urls')),
path('signup/', signup, name="signup"),
path('login/', views.LoginView.as_view(template_name="login.html", authentication_form=UserLoginForm), name="login"),
path('logout/', views.LogoutView.as_view(), name="logout"),
path('password-reset/', views.PasswordResetView.as_view(template_name="reset_password.html", form_class=ResetPasswordForm), name="password_reset"),
path('password-reset/done/', views.PasswordResetDoneView.as_view(template_name="reset_password_done.html"), name="password_reset_done"),
path('password-reset-complete/', views.PasswordResetCompleteView.as_view(template_name="reset_password_complete.html"), name="password_reset_complete"),
]
| 47.5 | 156 | 0.745511 | 219 | 1,615 | 5.388128 | 0.328767 | 0.030508 | 0.047458 | 0.061017 | 0.177966 | 0.177966 | 0.063559 | 0 | 0 | 0 | 0 | 0.00563 | 0.120124 | 1,615 | 33 | 157 | 48.939394 | 0.824771 | 0.383901 | 0 | 0 | 0 | 0 | 0.256332 | 0.100304 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.266667 | 0.333333 | 0 | 0.333333 | 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 | 0 | 0 | 0 | 2 |
47f1e6fcc886b0d6ef088965a11731fe7b37a1fa | 976 | py | Python | Exam-Prep/Exam_22-Aug-20/project/rooms/room.py | geodimitrov/PythonOOP_SoftUni | f1c6718c878b618b3ab3f174cd4d187bd178940b | [
"MIT"
] | 1 | 2021-06-30T11:53:44.000Z | 2021-06-30T11:53:44.000Z | Exam-Prep/Exam_22-Aug-20/project/rooms/room.py | geodimitrov/PythonOOP_SoftUni | f1c6718c878b618b3ab3f174cd4d187bd178940b | [
"MIT"
] | null | null | null | Exam-Prep/Exam_22-Aug-20/project/rooms/room.py | geodimitrov/PythonOOP_SoftUni | f1c6718c878b618b3ab3f174cd4d187bd178940b | [
"MIT"
] | null | null | null | class Room:
room_cost = 0
def __init__(self, name: str, budget: float, members_count: int):
self.family_name = name
self.budget = budget
self.members_count = members_count
self.children = []
self.expenses = 0
@property
def total_monthly_cost(self):
return self.expenses + self.room_cost
@property
def expenses(self):
return self.__expenses
@expenses.setter
def expenses(self, value):
if value < 0:
raise ValueError("Expenses cannot be negative")
self.__expenses = value
def calculate_expenses(self, *args):
result = sum(el.get_monthly_expense() for arg in args for el in arg)
self.expenses = result
def __repr__(self):
return f"{self.family_name} with {self.members_count} members. Budget: {self.budget:.2f}$, Expenses: {self.expenses:.2f}$\n" \
f"--- Appliances monthly cost: {self.expenses:.2f}$"
| 30.5 | 134 | 0.620902 | 120 | 976 | 4.841667 | 0.375 | 0.144578 | 0.048193 | 0.079174 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.008463 | 0.273566 | 976 | 31 | 135 | 31.483871 | 0.811001 | 0 | 0 | 0.08 | 0 | 0.04 | 0.194672 | 0.022541 | 0 | 0 | 0 | 0 | 0 | 1 | 0.24 | false | 0 | 0 | 0.12 | 0.44 | 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 | 0 | 0 | 0 | 2 |
9a0bcaffa742dd08ece693df1c39afe37a33e4fc | 2,119 | py | Python | hkm/migrations/0002_auto_20170203_1507.py | andersinno/kuvaselaamo | aed553a0ba85e82055e0de025ba2d3e3e4f2c9e6 | [
"MIT"
] | 1 | 2017-05-07T10:46:24.000Z | 2017-05-07T10:46:24.000Z | hkm/migrations/0002_auto_20170203_1507.py | City-of-Helsinki/kuvaselaamo | 3fa9b69e3f5496620852d8b138129d0069339fcd | [
"MIT"
] | 60 | 2016-10-18T11:18:48.000Z | 2022-02-13T20:04:18.000Z | hkm/migrations/0002_auto_20170203_1507.py | andersinno/kuvaselaamo | aed553a0ba85e82055e0de025ba2d3e3e4f2c9e6 | [
"MIT"
] | 9 | 2017-04-18T13:26:26.000Z | 2020-02-13T20:05:13.000Z | # -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2017-02-03 13:07
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('hkm', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='printproduct',
name='prize',
),
migrations.RemoveField(
model_name='productorder',
name='total_prize',
),
migrations.RemoveField(
model_name='productorder',
name='unit_prize',
),
migrations.AddField(
model_name='printproduct',
name='price',
field=models.DecimalField(decimal_places=2, default=1, max_digits=10, verbose_name='Price'),
),
migrations.AddField(
model_name='productorder',
name='datetime_payment_processed',
field=models.DateTimeField(blank=True, null=True, verbose_name='Payment processed at'),
),
migrations.AddField(
model_name='productorder',
name='is_payment_successful',
field=models.NullBooleanField(verbose_name='Payment successful'),
),
migrations.AddField(
model_name='productorder',
name='total_price',
field=models.DecimalField(blank=True, decimal_places=2, max_digits=10, null=True, verbose_name='Total price'),
),
migrations.AddField(
model_name='productorder',
name='unit_price',
field=models.DecimalField(blank=True, decimal_places=2, max_digits=10, null=True, verbose_name='Unit price'),
),
migrations.AlterField(
model_name='productorder',
name='is_checkout_successful',
field=models.NullBooleanField(verbose_name='Checkout successful'),
),
migrations.AlterField(
model_name='productorder',
name='is_order_successful',
field=models.NullBooleanField(verbose_name='Order successful'),
),
]
| 33.634921 | 122 | 0.598395 | 198 | 2,119 | 6.19697 | 0.313131 | 0.07335 | 0.136919 | 0.162999 | 0.573757 | 0.557457 | 0.370008 | 0.132029 | 0.132029 | 0.132029 | 0 | 0.020598 | 0.289759 | 2,119 | 62 | 123 | 34.177419 | 0.794684 | 0.032091 | 0 | 0.545455 | 1 | 0 | 0.182617 | 0.033691 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.036364 | 0 | 0.090909 | 0.036364 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
9a1a255f27c75706814744325288ae364429e8ba | 782 | py | Python | attributes/unit_test/discoverer/python.py | Lufedi/reaper | bdf56b499e5b704c27b9f6c053d798c2a10fa4cf | [
"Apache-2.0"
] | 106 | 2015-07-21T16:18:26.000Z | 2022-03-31T06:45:34.000Z | attributes/unit_test/discoverer/python.py | Kowndinya2000/enhanced_repo_reaper | 744f794ba53bde5667b3b0f99b07273d0e32a495 | [
"Apache-2.0"
] | 21 | 2015-07-11T03:48:28.000Z | 2022-01-18T12:57:30.000Z | attributes/unit_test/discoverer/python.py | Kowndinya2000/enhanced_repo_reaper | 744f794ba53bde5667b3b0f99b07273d0e32a495 | [
"Apache-2.0"
] | 26 | 2015-07-22T22:38:21.000Z | 2022-03-14T10:11:56.000Z | from attributes.unit_test.discoverer import TestDiscoverer
class PythonTestDiscoverer(TestDiscoverer):
def __init__(self):
self.language = 'Python'
self.languages = ['Python']
self.extensions = ['*.py']
self.frameworks = [
self.__django_test__,
self.__nose__,
self.__unittest__,
]
def __django_test__(self, path, sloc):
pattern = '((from|import)(\s)(django\.test))'
return self.measure(path, sloc, pattern)
def __nose__(self, path, sloc):
pattern = '((from|import)(\s)(nose))'
return self.measure(path, sloc, pattern)
def __unittest__(self, path, sloc):
pattern = '((from|import)(\s)(unittest))'
return self.measure(path, sloc, pattern)
| 30.076923 | 58 | 0.604859 | 81 | 782 | 5.45679 | 0.333333 | 0.108597 | 0.20362 | 0.128959 | 0.434389 | 0.434389 | 0.361991 | 0 | 0 | 0 | 0 | 0 | 0.258312 | 782 | 25 | 59 | 31.28 | 0.762069 | 0 | 0 | 0.15 | 0 | 0 | 0.131714 | 0.111253 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.2 | 0 | 0.6 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
9a2bb113e1d47f97bf8691c8f9eda9901bfc8ffa | 353 | py | Python | 1181/1181.py | doribugi/BOJ | eae161475b1d155b17376206dfd2f6a7d40e9a8c | [
"MIT"
] | null | null | null | 1181/1181.py | doribugi/BOJ | eae161475b1d155b17376206dfd2f6a7d40e9a8c | [
"MIT"
] | 1 | 2019-06-15T14:38:09.000Z | 2022-01-26T00:18:53.000Z | 1181/1181.py | doribugi/BOJ | eae161475b1d155b17376206dfd2f6a7d40e9a8c | [
"MIT"
] | null | null | null | # 문제: https://www.acmicpc.net/problem/1181
# 풀이: 문자열 길이와 문자열로 정렬하여 중복빼고 출력
import sys
n = int(sys.stdin.readline())
words = [sys.stdin.readline().rstrip() for _ in range(n)]
sorted_words = sorted(words, key=lambda x: (len(x), x))
for i in range(len(sorted_words)):
if i == 0 or sorted_words[i] != sorted_words[i - 1]:
print(sorted_words[i])
| 35.3 | 57 | 0.668555 | 62 | 353 | 3.709677 | 0.580645 | 0.286957 | 0.156522 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.02027 | 0.161473 | 353 | 9 | 58 | 39.222222 | 0.756757 | 0.1983 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.142857 | 0 | 0.142857 | 0.142857 | 0 | 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 | 2 |
9a45179a2d982b35b8393484d25e6f2cd9fa106b | 508 | py | Python | misago/misago/menus/cache.py | vascoalramos/misago-deployment | 20226072138403108046c0afad9d99eb4163cedc | [
"MIT"
] | 2 | 2021-03-06T21:06:13.000Z | 2021-03-09T15:05:12.000Z | misago/misago/menus/cache.py | vascoalramos/misago-deployment | 20226072138403108046c0afad9d99eb4163cedc | [
"MIT"
] | null | null | null | misago/misago/menus/cache.py | vascoalramos/misago-deployment | 20226072138403108046c0afad9d99eb4163cedc | [
"MIT"
] | null | null | null | from django.core.cache import cache
from ..cache.versions import invalidate_cache
from . import MENU_ITEMS_CACHE
def get_menus_cache(cache_versions):
key = get_cache_key(cache_versions)
return cache.get(key)
def set_menus_cache(cache_versions, menus):
key = get_cache_key(cache_versions)
cache.set(key, menus)
def get_cache_key(cache_versions):
return "%s_%s" % (MENU_ITEMS_CACHE, cache_versions[MENU_ITEMS_CACHE])
def clear_menus_cache():
invalidate_cache(MENU_ITEMS_CACHE)
| 22.086957 | 73 | 0.775591 | 76 | 508 | 4.802632 | 0.223684 | 0.249315 | 0.153425 | 0.131507 | 0.246575 | 0.246575 | 0 | 0 | 0 | 0 | 0 | 0 | 0.137795 | 508 | 22 | 74 | 23.090909 | 0.833333 | 0 | 0 | 0.153846 | 0 | 0 | 0.009843 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.307692 | false | 0 | 0.230769 | 0.076923 | 0.692308 | 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 | 0 | 0 | 0 | 2 |
9a4677a59df9dd2e7f0f9b24ee8cf02c5fcc026d | 267 | py | Python | output/models/nist_data/atomic/decimal/schema_instance/nistschema_sv_iv_atomic_decimal_total_digits_5_xsd/__init__.py | tefra/xsdata-w3c-tests | b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f | [
"MIT"
] | 1 | 2021-08-14T17:59:21.000Z | 2021-08-14T17:59:21.000Z | output/models/nist_data/atomic/decimal/schema_instance/nistschema_sv_iv_atomic_decimal_total_digits_5_xsd/__init__.py | tefra/xsdata-w3c-tests | b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f | [
"MIT"
] | 4 | 2020-02-12T21:30:44.000Z | 2020-04-15T20:06:46.000Z | output/models/nist_data/atomic/decimal/schema_instance/nistschema_sv_iv_atomic_decimal_total_digits_5_xsd/__init__.py | tefra/xsdata-w3c-tests | b6b6a4ac4e0ab610e4b50d868510a8b7105b1a5f | [
"MIT"
] | null | null | null | from output.models.nist_data.atomic.decimal.schema_instance.nistschema_sv_iv_atomic_decimal_total_digits_5_xsd.nistschema_sv_iv_atomic_decimal_total_digits_5 import NistschemaSvIvAtomicDecimalTotalDigits5
__all__ = [
"NistschemaSvIvAtomicDecimalTotalDigits5",
]
| 44.5 | 204 | 0.898876 | 30 | 267 | 7.3 | 0.633333 | 0.178082 | 0.127854 | 0.182648 | 0.356164 | 0.356164 | 0.356164 | 0.356164 | 0 | 0 | 0 | 0.01581 | 0.052434 | 267 | 5 | 205 | 53.4 | 0.849802 | 0 | 0 | 0 | 0 | 0 | 0.146067 | 0.146067 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
9a50e77a1652e398754471be82c432955867a65c | 1,038 | py | Python | src/gocept/testing/mock.py | gocept/gocept.testing | dc3cf740615a11a59911eea9353ae3fc1f4adcb0 | [
"MIT"
] | 1 | 2019-09-16T07:47:45.000Z | 2019-09-16T07:47:45.000Z | src/gocept/testing/mock.py | gocept/gocept.testing | dc3cf740615a11a59911eea9353ae3fc1f4adcb0 | [
"MIT"
] | 1 | 2020-01-03T16:16:57.000Z | 2020-01-03T16:16:57.000Z | src/gocept/testing/mock.py | gocept/gocept.testing | dc3cf740615a11a59911eea9353ae3fc1f4adcb0 | [
"MIT"
] | null | null | null | from unittest import mock
class Patches:
def __init__(self):
self.patches = []
def add(self, *args, **kw):
patch = mock.patch(*args, **kw)
self.patches.append(patch)
return patch.start()
def add_object(self, *args, **kw):
patch = mock.patch.object(*args, **kw)
self.patches.append(patch)
return patch.start()
def add_dict(self, *args, **kw):
patch = mock.patch.dict(*args, **kw)
self.patches.append(patch)
return patch.start()
def reset(self):
for patch in self.patches:
patch.stop()
self.patches[:] = []
class Assertions:
def assertCalledWith(self, mock, *args, **kw):
return mock.assert_called_with(*args, **kw)
class Property(mock.Mock):
def __get__(self, instance, class_):
return self()
class PatchHelper:
def setUp(self):
super().setUp()
self.patches = Patches()
def tearDown(self):
self.patches.reset()
super().tearDown()
| 20.352941 | 51 | 0.576108 | 122 | 1,038 | 4.795082 | 0.278689 | 0.150427 | 0.051282 | 0.076923 | 0.374359 | 0.374359 | 0.251282 | 0.251282 | 0.251282 | 0.251282 | 0 | 0 | 0.282274 | 1,038 | 50 | 52 | 20.76 | 0.785235 | 0 | 0 | 0.181818 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.090909 | 1 | 0.272727 | false | 0 | 0.030303 | 0.060606 | 0.575758 | 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 | 0 | 1 | 0 | 0 | 2 |
9a660f26f8ad184c30c65d85a55fd3ed55553816 | 94 | py | Python | vendor_monitor/__init__.py | chintal/tendril-monitor-vendor | af7577bd88b3d35e09a733607555d5d10e1cd9c7 | [
"MIT"
] | null | null | null | vendor_monitor/__init__.py | chintal/tendril-monitor-vendor | af7577bd88b3d35e09a733607555d5d10e1cd9c7 | [
"MIT"
] | null | null | null | vendor_monitor/__init__.py | chintal/tendril-monitor-vendor | af7577bd88b3d35e09a733607555d5d10e1cd9c7 | [
"MIT"
] | null | null | null |
__author__ = 'Chintalagiri Shashank'
__email__ = 'shashank@chintal.in'
__version__ = '0.1.0'
| 18.8 | 36 | 0.744681 | 11 | 94 | 5.272727 | 0.818182 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.036145 | 0.117021 | 94 | 4 | 37 | 23.5 | 0.662651 | 0 | 0 | 0 | 0 | 0 | 0.483871 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 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 | 2 |
7bd40bf391e31260c2838ce89387e0e7bba17376 | 475 | py | Python | 000577MyerPy/000577_30_Dict_add_rem_20190915.py | SafonovMikhail/python_000577 | 739f764e80f1ca354386f00b8e9db1df8c96531d | [
"Apache-2.0"
] | null | null | null | 000577MyerPy/000577_30_Dict_add_rem_20190915.py | SafonovMikhail/python_000577 | 739f764e80f1ca354386f00b8e9db1df8c96531d | [
"Apache-2.0"
] | null | null | null | 000577MyerPy/000577_30_Dict_add_rem_20190915.py | SafonovMikhail/python_000577 | 739f764e80f1ca354386f00b8e9db1df8c96531d | [
"Apache-2.0"
] | null | null | null | # 000577_30_Dict_add_rem
customer_29876 = {'first name': 'David', 'last name': 'Elliott', 'address': '4803 Wellesley St.', 'city': 'Toronto'}
print("initial dict", customer_29876)
# rem
del customer_29876["address"]
print('remove "address"',customer_29876)
# add "street"
print("add street")
customer_29876["street"] = "Park Avenue"
print(customer_29876)
# change "Winipeg"
print('change city from Toronto to Winipeg')
customer_29876["city"] = "Winipeg"
print(customer_29876) | 33.928571 | 116 | 0.738947 | 63 | 475 | 5.380952 | 0.460317 | 0.306785 | 0.106195 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.121495 | 0.098947 | 475 | 14 | 117 | 33.928571 | 0.670561 | 0.117895 | 0 | 0.2 | 0 | 0 | 0.421687 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.6 | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 2 |
7bde079fcd3251d4fa1b5c31b943cb90efd2beb4 | 361 | py | Python | P25010-Guangzhou-Jiachengwu/week09/ex_reverse.py | xiaohh2016/python-25 | 8981ba89bfb32754c3f9c881ee8fcaf13332ce51 | [
"Apache-2.0"
] | 1 | 2019-09-11T23:24:58.000Z | 2019-09-11T23:24:58.000Z | P25010-Guangzhou-Jiachengwu/week09/ex_reverse.py | xiaohh2016/python-25 | 8981ba89bfb32754c3f9c881ee8fcaf13332ce51 | [
"Apache-2.0"
] | null | null | null | P25010-Guangzhou-Jiachengwu/week09/ex_reverse.py | xiaohh2016/python-25 | 8981ba89bfb32754c3f9c881ee8fcaf13332ce51 | [
"Apache-2.0"
] | 5 | 2019-09-11T06:33:34.000Z | 2020-02-17T12:52:31.000Z | # 字符串 str= 'reverse this string', 请使用三种方法翻转字符串。
# 方法1:
str= 'reverse this string'
print(str[::-1])
# 方法2:
str= 'reverse this string'
length=len(str)
str1=''
for i in range(length,0,-1):
str1+=str[i-1]
print(str1)
# 方法3:
str= 'reverse this string'
str3=reversed(str)
str4=''
for i in str3:
str4+=i
print(str4)
# 最后一个可以直接使用拼接方法,更简单.
# 其余两个方法掌握的也很不错.
| 13.884615 | 47 | 0.66205 | 56 | 361 | 4.267857 | 0.446429 | 0.167364 | 0.23431 | 0.334728 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.049669 | 0.163435 | 361 | 25 | 48 | 14.44 | 0.741722 | 0.263158 | 0 | 0.214286 | 0 | 0 | 0.220077 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.214286 | 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 | 0 | 0 | 0 | 2 |
7be9babf1b995ef8c89f15e1c8543c5d30c34278 | 2,806 | py | Python | ml_workflow/workflow_tracable.py | BenjaminHabert/ml_workflow | 266e503e895defe510d657a2a54ea19623f9e181 | [
"MIT"
] | 1 | 2021-02-03T17:45:09.000Z | 2021-02-03T17:45:09.000Z | ml_workflow/workflow_tracable.py | BenjaminHabert/ml_workflow | 266e503e895defe510d657a2a54ea19623f9e181 | [
"MIT"
] | 1 | 2021-01-25T15:56:44.000Z | 2021-01-25T15:56:44.000Z | ml_workflow/workflow_tracable.py | BenjaminHabert/ml_workflow | 266e503e895defe510d657a2a54ea19623f9e181 | [
"MIT"
] | 1 | 2021-02-03T17:45:16.000Z | 2021-02-03T17:45:16.000Z | import inspect
from . import execution_context
import re
import logging
from .misc_utils import TimeIt
from .decorator import Decorator
from packaging import version
logger = logging.getLogger(__name__)
class WorkflowTracable(Decorator):
AUTHORISED_ATTR = set([
'name', 'highlight', 'author', 'created_at',
'version', 'branch', 'tags',
'return_tuple',
])
VALID_NAME_RE = re.compile("^[a-zA-Z0-9_\-\.]+$")
DEFAULT_VERSION = version.parse('0.0')
def __init__(self, **kwargs):
super().__init__()
if not (set(kwargs.keys()) <= self.get_authorized_attr()):
unauthorised_keys = set(kwargs.keys()) - self.get_authorized_attr()
raise Exception(
f"Unauthorized keys for {self.__class__} :"
f" {unauthorised_keys}")
# Default value
self.set_default_values()
self.__dict__.update(kwargs)
if 'version' in kwargs:
self.version = version.parse(kwargs['version'])
self.__check_name()
def set_default_values(self):
self.return_tuple = False
# This method is called by Decorator.__call__, after the first call,
# as a decorator
def call_as_decorated(self, *args, **kwargs):
raise NotImplementedError()
def call(self, *args, **kwargs):
return self.source_function(*args, **kwargs)
def __str__(self):
return self.name
def __repr__(self):
return self.name
def __enter__(self):
execution_context.notify_entry(self)
def __exit__(self, type, value, traceback):
execution_context.notify_exit(self)
def get_source(self):
if self.source_function is None:
return None
return inspect.getsource(self.source_function)
def get_branch(self):
if not hasattr(self, 'branch'):
return None
return self.branch
def get_tags(self):
try:
return self.tags
except AttributeError:
return None
def get_version(self):
if not self.has_version():
return self.DEFAULT_VERSION
return self.version
def has_version(self):
return hasattr(self, 'version')
@classmethod
def get_authorized_attr(cls):
return cls.AUTHORISED_ATTR
def get_full_details(self):
msg = f"Rule :\n"
for k in self.get_authorized_attr():
if hasattr(self, k):
msg += f" {k} => {getattr(self, k)}\n"
msg += f" origin : {self.get_definition_location()}"
return msg
def __check_name(self):
if not WorkflowTracable.VALID_NAME_RE.match(self.name):
raise Exception(f"Invalid name found : {self.name}. Only allowed characters are : a-zA-Z0-9_\-\.")
| 27.509804 | 110 | 0.616892 | 333 | 2,806 | 4.915916 | 0.33033 | 0.042761 | 0.041539 | 0.038485 | 0.067196 | 0.041539 | 0.041539 | 0 | 0 | 0 | 0 | 0.002948 | 0.274768 | 2,806 | 101 | 111 | 27.782178 | 0.801474 | 0.033856 | 0 | 0.067568 | 0 | 0.013514 | 0.120148 | 0.01183 | 0 | 0 | 0 | 0 | 0 | 1 | 0.216216 | false | 0 | 0.094595 | 0.067568 | 0.554054 | 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 | 0 | 1 | 0 | 0 | 2 |
7bf945982b165c414329afaa857a315775a02882 | 195 | py | Python | wikicurses/__init__.py | danieldjewell/wikicurses | ff00e6240c3582b0c4a00b9a337e628b5e3d6e58 | [
"MIT"
] | 84 | 2015-01-07T20:28:29.000Z | 2022-02-07T05:42:06.000Z | wikicurses/__init__.py | danieldjewell/wikicurses | ff00e6240c3582b0c4a00b9a337e628b5e3d6e58 | [
"MIT"
] | 12 | 2015-02-25T03:56:45.000Z | 2021-07-04T20:40:33.000Z | wikicurses/__init__.py | danieldjewell/wikicurses | ff00e6240c3582b0c4a00b9a337e628b5e3d6e58 | [
"MIT"
] | 6 | 2015-06-23T15:50:30.000Z | 2019-10-02T00:43:49.000Z | from enum import IntEnum
__version__ = "1.4"
class formats(IntEnum):
i, b, blockquote, searchresult, h1, h2, h, pre, code, \
divpadding, divborder = (1 << i for i in range(11))
| 24.375 | 63 | 0.630769 | 28 | 195 | 4.25 | 0.857143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.047297 | 0.241026 | 195 | 7 | 64 | 27.857143 | 0.756757 | 0 | 0 | 0 | 0 | 0 | 0.015385 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.2 | 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 | 0 | 0 | 0 | 0 | 0 | 2 |
d00568d92ccf1901ee88d12b7d141ab6afef6e52 | 3,767 | py | Python | examples/additional_examples/scalling/solvents/plot_solvent_scaling.py | t-young31/gap-train | 864574abe20cc6072376e7c36ffb2ee1635e74e3 | [
"MIT"
] | 13 | 2021-02-16T15:25:27.000Z | 2022-01-26T12:09:37.000Z | examples/additional_examples/scalling/solvents/plot_solvent_scaling.py | duartegroup/gap-train | 864574abe20cc6072376e7c36ffb2ee1635e74e3 | [
"MIT"
] | 5 | 2021-04-09T16:07:47.000Z | 2021-08-05T15:40:50.000Z | examples/additional_examples/scalling/solvents/plot_solvent_scaling.py | t-young31/gap-train | 864574abe20cc6072376e7c36ffb2ee1635e74e3 | [
"MIT"
] | 3 | 2021-03-23T16:55:22.000Z | 2022-01-03T23:40:28.000Z | import matplotlib.pyplot as plt
import numpy as np
from matplotlib.ticker import FormatStrFormatter
plt.style.use('paper')
def mean(list_arr):
return [np.average(arr) if len(arr) > 0 else -1000
for arr in list_arr]
def error(list_arr):
return [np.std(arr)/np.sqrt(len(arr)-1) if len(arr) > 2 else 0
for arr in list_arr]
if __name__ == '__main__':
n_atoms_list = [8, 10, 6, 12, 3, 5, 5, 18, 16, 15, 12, 11, 6, 9, 14, 6,
12, 14, 7, 11, 13, 15, 13, 8, 9, 3, 18, 9, 13, 9, 10, 7]
n_evals = [
[433, 419, 369], # 0
[609, 510, 487],
[100, 141, 149],
[229, 142, 224],
[80, 133, 56],
[62, 51, 23],
[130, 115, 82], # 6
[2385, 2612, 2666],
[3245, 3085, 3183],
[3525, 3945, 3744],
[1844, 1850, 2142], # 10
[1026, 1250, 1215],
[359, 352, 368],
[1427, 1161, 1493],
[3677, 3581, 3749],
[348, 539, 384], # 15
[2614, 2526, 2575],
[925, 828, 752],
[273, 245, 254],
[503, 563, 401],
[2143, 1556, 1952], # 20
[980, 1233, 1172],
[840, 744, 1189],
[399, 359, 365],
[1072, 999, 972],
[57, 77, 68],
[2379, 2155, 2051],
[402, 407, 340],
[3551, 3464, 3372],
[315, 372, 279],
[3389, 3362, ], # 30
[292, 235, 191]
]
n_train_configs = [
[125, 117, 102],
[147, 150, 136],
[44, 42, 43],
[68, 60, 63],
[24, 38, 23],
[20, 17, 13], # 5
[34, 33, 27],
[618, 643, 649],
[1001, 1003, 1004],
[955, 963, 953],
[407, 455, 483], # 10
[247, 289, 284],
[103, 103, 110],
[365, 305, 352],
[884, 846, 839],
[95, 119, 111],
[633, 636, 628],
[234, 196, 202],
[71, 74, 64],
[137, 140, 116],
[495, 401, 507],
[250, 303, 272],
[210, 193, 270],
[109, 89, 87],
[255, 248, 232],
[23, 31, 24],
[550, 532, 490],
[113, 114, 108],
[802, 824, 802],
[87, 104, 80],
[766, 787, ],
[73, 66, 62]
]
fig, (ax1, ax2) = plt.subplots(ncols=2, figsize=(10, 5))
evals_line = ax1.errorbar(n_atoms_list, mean(n_evals),
yerr=error(n_evals),
marker='o', lw=1, mfc='blue', ecolor='blue', alpha=0.6,
fmt='o', color='blue',
label='$n_{eval}$')
train_line = ax2.errorbar(n_atoms_list, mean(n_train_configs),
yerr=error(n_train_configs),
marker='s', lw=1, mfc='red', ecolor='red', alpha=0.6, fmt='o',
color='red',
label='$n_{train}$')
for i, ax in enumerate((ax1, ax2)):
ax.xaxis.set_major_formatter(FormatStrFormatter('%.i'))
for idx in range(len(n_atoms_list)):
y = n_evals if i == 0 else n_train_configs
ax.annotate(str(idx),
xy=(n_atoms_list[idx], np.average(y[idx])),
xytext=(n_atoms_list[idx]+0.2, np.average(y[idx])),
fontsize=7)
ax1.set_xlabel('# atoms')
ax1.set_ylabel('$n_{eval}$')
ax1.set_ylim(-0.02*4000, 4000)
ax1.set_xticks(list(range(min(n_atoms_list), max(n_atoms_list), 2)))
ax1.legend(loc='lower right')
ax2.set_xlabel('# atoms')
ax2.set_ylabel('$n_{train}$')
ax2.set_ylim(-0.02*1100, 1100)
ax2.set_xticks(list(range(min(n_atoms_list), max(n_atoms_list), 2)))
ax2.legend(loc='lower right')
plt.tight_layout()
plt.savefig('solvent_scaling.png', dpi=500)
| 28.976923 | 78 | 0.464826 | 516 | 3,767 | 3.273256 | 0.554264 | 0.035524 | 0.059207 | 0.017762 | 0.117229 | 0.099467 | 0.053286 | 0.053286 | 0.053286 | 0.053286 | 0 | 0.29051 | 0.359437 | 3,767 | 129 | 79 | 29.20155 | 0.409449 | 0.005309 | 0 | 0.017857 | 0 | 0 | 0.036918 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.017857 | false | 0 | 0.026786 | 0.017857 | 0.0625 | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
d011b9d205070dcd70f71be1d2f7156e864e7edc | 1,781 | py | Python | src/main/java/com/google/security/zynamics/binnavi/scripts/sample_plugin.py | myArea51/binnavi | 021e62dcb7c3fae2a99064b0ea497cb221dc7238 | [
"Apache-2.0"
] | 3,083 | 2015-08-19T13:31:12.000Z | 2022-03-30T09:22:21.000Z | src/main/java/com/google/security/zynamics/binnavi/scripts/sample_plugin.py | Jason-Cooke/binnavi | b98b191d8132cbde7186b486d23a217fcab4ec44 | [
"Apache-2.0"
] | 99 | 2015-08-19T14:42:49.000Z | 2021-04-13T10:58:32.000Z | src/main/java/com/google/security/zynamics/binnavi/scripts/sample_plugin.py | Jason-Cooke/binnavi | b98b191d8132cbde7186b486d23a217fcab4ec44 | [
"Apache-2.0"
] | 613 | 2015-08-19T14:15:44.000Z | 2022-03-26T04:40:55.000Z | """
Copyright 2014 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
import sys
from javax.swing import JMenuItem as JMenuItem
from javax.swing import AbstractAction as AbstractAction
from com.google.security.zynamics.binnavi.API.plugins import IMainWindowMenuPlugin as IMainWindowMenuPlugin
from com.google.security.zynamics.binnavi.API.helpers import MessageBox as MessageBox
from com.google.security.zynamics.binnavi.API.gui import LogConsole as console
class MessageAction(AbstractAction):
def __init__(self, pi):
AbstractAction.__init__(self, "Python Sample Plugin")
self.pi = pi
def actionPerformed(self, e):
console.log("Hello from the python sample script")
MessageBox.showInformation(self.pi.mainWindow.frame, "Hello from the python sample script")
class SamplePlugin(IMainWindowMenuPlugin):
def getName(self):
return "Python Sample Plugin"
def getGuid(self):
return 545845490
def getDescription(self):
return "Displays a message box"
def init(self, pi):
self.pi = pi
def unload(self):
pass
def extendPluginMenu(self):
return [ JMenuItem(MessageAction(self.pi)) ]
sample = SamplePlugin()
navi.getPluginRegistry().addPlugin(sample)
| 32.381818 | 108 | 0.747333 | 233 | 1,781 | 5.678112 | 0.502146 | 0.045351 | 0.029478 | 0.047619 | 0.133787 | 0.133787 | 0.088435 | 0 | 0 | 0 | 0 | 0.011644 | 0.180236 | 1,781 | 54 | 109 | 32.981481 | 0.894521 | 0.321168 | 0 | 0.071429 | 0 | 0 | 0.115083 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.285714 | false | 0.035714 | 0.214286 | 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 | 0 | 0 | 0 | 2 |
d03539635a66c9568f5b0a77277bf2a5ebcb5938 | 297 | py | Python | src/kgmk/dsa/math/bit_count/table/bottomup/__init__.py | kagemeka/python | 486ce39d97360b61029527bacf00a87fdbcf552c | [
"MIT"
] | null | null | null | src/kgmk/dsa/math/bit_count/table/bottomup/__init__.py | kagemeka/python | 486ce39d97360b61029527bacf00a87fdbcf552c | [
"MIT"
] | null | null | null | src/kgmk/dsa/math/bit_count/table/bottomup/__init__.py | kagemeka/python | 486ce39d97360b61029527bacf00a87fdbcf552c | [
"MIT"
] | null | null | null | import typing
class BitCount():
def __getitem__(self, n: int) -> int: return self.__a[n]
def __call__(self, n: int) -> int: return self.__a[n]
def __init__(self, n: int) -> typing.NoReturn:
a = [0] * n
for i in range(1, n):
a[i] = a[i >> 1] + i & 1
self.__a = a
| 19.8 | 58 | 0.552189 | 50 | 297 | 2.92 | 0.4 | 0.10274 | 0.164384 | 0.150685 | 0.356164 | 0.356164 | 0.356164 | 0.356164 | 0.356164 | 0 | 0 | 0.018692 | 0.279461 | 297 | 15 | 59 | 19.8 | 0.663551 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0.111111 | 0.222222 | 0.555556 | 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 | 0 | 0 | 0 | 2 |
d03a18b18d7380128e4432786b172b810b692121 | 61 | py | Python | release/stubs.min/Tekla/Structures/ModelInternal_parts/dotUndoOperation_t.py | htlcnn/ironpython-stubs | 780d829e2104b2789d5f4d6f32b0ec9f2930ca03 | [
"MIT"
] | 182 | 2017-06-27T02:26:15.000Z | 2022-03-30T18:53:43.000Z | release/stubs.min/Tekla/Structures/ModelInternal_parts/dotUndoOperation_t.py | htlcnn/ironpython-stubs | 780d829e2104b2789d5f4d6f32b0ec9f2930ca03 | [
"MIT"
] | 28 | 2017-06-27T13:38:23.000Z | 2022-03-15T11:19:44.000Z | release/stubs.min/Tekla/Structures/ModelInternal_parts/dotUndoOperation_t.py | htlcnn/ironpython-stubs | 780d829e2104b2789d5f4d6f32b0ec9f2930ca03 | [
"MIT"
] | 67 | 2017-06-28T09:43:59.000Z | 2022-03-20T21:17:10.000Z | class dotUndoOperation_t(object):
# no doc
Operation=None
| 12.2 | 33 | 0.770492 | 8 | 61 | 5.75 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.147541 | 61 | 4 | 34 | 15.25 | 0.884615 | 0.098361 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
d05c87d94b6072ee0e9976abb28285cb9f5f8a7d | 1,015 | py | Python | src/nti/ntiids/schema.py | NextThought/nti.ntiids | cac86ce2baa7d673b51a51f3dddc6add678279c4 | [
"Apache-2.0"
] | null | null | null | src/nti/ntiids/schema.py | NextThought/nti.ntiids | cac86ce2baa7d673b51a51f3dddc6add678279c4 | [
"Apache-2.0"
] | null | null | null | src/nti/ntiids/schema.py | NextThought/nti.ntiids | cac86ce2baa7d673b51a51f3dddc6add678279c4 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Support for using NTIIDs in a zope schema.
"""
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
from nti.ntiids._compat import text_type
from nti.ntiids.ntiids import validate_ntiid_string
from nti.schema.field import ValidURI
class ValidNTIID(ValidURI):
"""
A schema field that checks that the value is a correctly
formed NTIID. (This does not perform any validation that the
value is actually reachable or accessibly in a library or catalog.)
"""
_type = text_type
def fromUnicode(self, value):
# The very first thing the superclass does is turn
# the value into a bytestring again (under py2),
# which is obviously wrong for us. So skip that.
value = value.strip()
self.validate(value)
return value
def _validate(self, value):
super(ValidNTIID, self)._validate(value)
validate_ntiid_string(value)
| 26.710526 | 71 | 0.703448 | 139 | 1,015 | 4.964029 | 0.532374 | 0.043478 | 0.069565 | 0.04058 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.002545 | 0.225616 | 1,015 | 37 | 72 | 27.432432 | 0.875318 | 0.407882 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.133333 | false | 0 | 0.4 | 0 | 0.733333 | 0.066667 | 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 | 0 | 1 | 0 | 0 | 2 |
d05ece5443cb094616da453b12293ebf22a04fd5 | 447 | py | Python | tests/tests.py | ratantejmadan/cloud-image-repository | 18e438807380326b1ba024a8b08fe20becd3370c | [
"MIT"
] | 1 | 2022-01-24T17:47:59.000Z | 2022-01-24T17:47:59.000Z | tests/tests.py | ratantejmadan/cloud-image-repository | 18e438807380326b1ba024a8b08fe20becd3370c | [
"MIT"
] | null | null | null | tests/tests.py | ratantejmadan/cloud-image-repository | 18e438807380326b1ba024a8b08fe20becd3370c | [
"MIT"
] | null | null | null | # import os
# import tempfile
#
# import pytest
#
# import app
# from app import login
#
#
# def login(client, username, password):
# return client.post('/login', data=dict(
# username=username,
# password=password
# ), follow_redirects=True)
#
#
# def logout(client):
# return client.get('/logout', follow_redirects=True)
#
#
# def test_login():
# username = app.config["username"]
# password = app.confif[""]
| 18.625 | 57 | 0.63311 | 50 | 447 | 5.6 | 0.46 | 0.171429 | 0.135714 | 0.157143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.212528 | 447 | 23 | 58 | 19.434783 | 0.795455 | 0.894855 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 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 | 0 | 0 | 0 | 0 | 0 | 2 |
d06e9925db1e08627e5e661e3cec43889ca03d89 | 5,930 | py | Python | src/playthrough-bot/discord/modules/admin.py | Rain288/playthrough-bot | 9ddefa336bf59cf8ab4a1de83ff4c4777195619b | [
"MIT"
] | 1 | 2019-02-02T03:58:05.000Z | 2019-02-02T03:58:05.000Z | src/playthrough-bot/discord/modules/admin.py | Rain288/playthrough-bot | 9ddefa336bf59cf8ab4a1de83ff4c4777195619b | [
"MIT"
] | 1 | 2019-02-02T03:58:05.000Z | 2019-02-10T14:51:05.000Z | src/playthrough-bot/discord/modules/admin.py | evangelos-ch/playthrough-bot | 9ddefa336bf59cf8ab4a1de83ff4c4777195619b | [
"MIT"
] | null | null | null | # pylint: disable=unexpected-keyword-arg
import shlex
import click
import discord
from discord.utils import get
from discord.ext.commands import Cog, command
from playthrough-bot import config
from playthrough-bot.discord import utils
from playthrough-bot.models import Game, GameAlias, Guild, Role, CompletionRole, Category, Channel
logger = utils.get_logger()
@click.group()
@click.pass_context
def admin(context):
"""Command line tool for administration of the server."""
pass
@admin.group()
@click.pass_context
def game(context):
"""Manage game operations"""
pass
@game.command()
@click.argument("game", type=str)
@click.option("--alias", "-a", type=str, help="alias for the game")
@click.option(
"--completion_role", "-c", type=int, help="role id of the completion role"
)
@click.option("--channel_suffix", "-s", type=str, help="suffix of playthrough channels")
@click.option(
"--active_category", "-a", type=int, help="category id to put active channels in"
)
@click.option(
"--finished_category",
"-f",
type=int,
help="category id to put finished channels in",
)
@click.pass_context
async def add(
context,
game,
alias=None,
completion_role=None,
channel_suffix=None,
active_category=None,
finished_category=None,
):
"""Command to add a game"""
discord_context = context.obj["discord_context"]
guild_obj = Guild.get(id=discord_context.guild.id)
async with discord_context.typing():
if Game.get(name=game):
await discord_context.send(f"{game} already exists.")
return
if not channel_suffix:
channel_suffix = f"plays-{game.lower().strip()}"
game_obj = Game.create(name=game, channel_suffix=channel_suffix)
if alias:
GameAlias.create(name=alias, game=game_obj)
if completion_role:
role = get(discord_context.guild.roles, id=role)
else:
role = await discord_context.guild.create_role(name=game)
CompletionRole.create(
id=role.id, guild=guild_obj, name=role.name, game=game_obj
)
if active_category:
category = get(discord_context.guild.categories, id=active_category)
else:
category = await discord_context.guild.create_category(
name=f"{game} Playthroughs"
)
Category.create(
id=category.id, guild=guild_obj, name=category.name, game_id=game_obj.id,
)
if finished_category:
category = get(discord_context.guild.categories, id=finished_category)
else:
category = await discord_context.guild.create_category(
name=f"{game} Archived"
)
Category.create(
id=category.id,
guild=guild_obj,
name=category.name,
game_id=game_obj.id,
archival=True,
)
await discord_context.send(f"Successfully added {game}!")
@game.command()
@click.argument("game", type=str)
@click.pass_context
async def remove(context, game):
"""Command to remove a game"""
discord_context = context.obj["discord_context"]
guild_id = discord_context.guild.id
game_obj = Game.get_by_alias(game)
if not game_obj:
await discord_context.send(f"Game {game} not found. Try again!")
return
game_obj.delete()
await discord_context.send(f"Game {game} successfully removed!")
@admin.group()
@click.pass_context
def channel(context):
"""Manage channels"""
pass
@channel.command()
@click.argument("channel_id", type=int)
@click.pass_context
async def delete(context, channel_id):
"""Command to delete a specific channel"""
discord_context = context.obj["discord_context"]
guild_id = discord_context.guild.id
channel = Channel.get(guild_id=guild_id, id=channel_id)
if channel:
channel.delete()
channel = get(discord_context.guild.channels, id=channel_id)
if channel:
await channel.delete(reason=f"Admin command by: {discord_context.author.name}")
await discord_context.send("Successfully deleted channel.")
class Admin(Cog):
def __init__(self, client):
self.client = client
logger.info(f"Module {self.__class__.__name__} loaded successfully.")
@command(pass_context=True)
async def admin(self, context, *, args):
if context.author.id not in config.ADMINS:
logger.info("Unauthorized user %s attempted to invoke admin command.", context.author.name)
await context.send("You are not authorizeid to use the admin command.")
return
args = shlex.split(args)
try:
call = admin(args, standalone_mode=False, obj={"discord_context": context})
status = await call if type(call) != int else call
if status == 0: # Click returns 0 if --help was called directly
# Hack to get help at the right level
target = admin
info_name = f"{config.PREFIX}admin"
for arg in args:
if arg != "--help" and not arg.startswith("-"):
target = globals()[arg]
info_name += f" {arg}"
else:
break
# Get help string
with click.Context(target, info_name=info_name) as ctx:
await context.send(target.get_help(ctx))
except click.exceptions.UsageError as e:
print(e)
await context.send(
"Incorrect command use. Use the `--help` flag to get more info."
)
except Exception as e:
logger.warning(f"Exception occurred in admin command: {e}")
await context.send(f"An error occurred when using the command: ```{e}```")
def setup(client):
client.add_cog(Admin(client))
| 31.375661 | 103 | 0.631029 | 735 | 5,930 | 4.961905 | 0.213605 | 0.092131 | 0.067727 | 0.028791 | 0.292843 | 0.2306 | 0.207019 | 0.175213 | 0.125857 | 0.111324 | 0 | 0.000455 | 0.258516 | 5,930 | 188 | 104 | 31.542553 | 0.828974 | 0.022934 | 0 | 0.243243 | 0 | 0 | 0.163532 | 0.014687 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0.067568 | 0.054054 | null | null | 0.006757 | 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 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
d06ed16ba14ee6d588b9f855c5517f9714e20119 | 52,365 | py | Python | tools/mcsema_disass/ida7/CFG_pb2.py | trailofbits/mcsema | 26368053f761be05dab708bc28fb97090c64b2be | [
"Apache-2.0"
] | 1,301 | 2015-01-05T15:08:11.000Z | 2019-10-22T19:35:09.000Z | mcsema/lib/ida7/CFG_pb2.py | TheGreatRambler/NintendoSwitchGameToNative | 90dee5e3b24325f781ee3adf0f3ce083c47bf13d | [
"MIT"
] | 395 | 2015-01-05T22:10:44.000Z | 2019-10-19T23:34:47.000Z | tools/mcsema_disass/ida7/CFG_pb2.py | trailofbits/mcsema | 26368053f761be05dab708bc28fb97090c64b2be | [
"Apache-2.0"
] | 248 | 2015-01-05T14:09:33.000Z | 2019-10-22T09:31:07.000Z | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: CFG.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf.internal import enum_type_wrapper
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
from google.protobuf import descriptor_pb2
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor.FileDescriptor(
name='CFG.proto',
package='mcsema',
serialized_pb=_b('\n\tCFG.proto\x12\x06mcsema\"5\n\x11PreservationRange\x12\x10\n\x08\x62\x65gin_ea\x18\x01 \x02(\x03\x12\x0e\n\x06\x65nd_ea\x18\x02 \x01(\x03\"R\n\x12PreservedRegisters\x12\x11\n\tregisters\x18\x01 \x03(\t\x12)\n\x06ranges\x18\x02 \x03(\x0b\x32\x19.mcsema.PreservationRange\"\xe2\x01\n\rCodeReference\x12\x37\n\x0coperand_type\x18\x01 \x02(\x0e\x32!.mcsema.CodeReference.OperandType\x12\n\n\x02\x65\x61\x18\x02 \x02(\x03\x12\x0c\n\x04mask\x18\x03 \x01(\x03\"~\n\x0bOperandType\x12\x14\n\x10ImmediateOperand\x10\x00\x12\x11\n\rMemoryOperand\x10\x01\x12\x1d\n\x19MemoryDisplacementOperand\x10\x02\x12\x16\n\x12\x43ontrolFlowOperand\x10\x03\x12\x0f\n\x0bOffsetTable\x10\x04\"N\n\x0bInstruction\x12\n\n\x02\x65\x61\x18\x01 \x02(\x03\x12$\n\x05xrefs\x18\x02 \x03(\x0b\x32\x15.mcsema.CodeReference\x12\r\n\x05lp_ea\x18\x03 \x01(\x04\"t\n\x05\x42lock\x12\n\n\x02\x65\x61\x18\x01 \x02(\x03\x12)\n\x0cinstructions\x18\x02 \x03(\x0b\x32\x13.mcsema.Instruction\x12\x15\n\rsuccessor_eas\x18\x03 \x03(\x03\x12\x1d\n\x15is_referenced_by_data\x18\x04 \x02(\x08\"2\n\x0eMemoryLocation\x12\x10\n\x08register\x18\x01 \x02(\t\x12\x0e\n\x06offset\x18\x02 \x01(\x03\"a\n\tValueDecl\x12\x0c\n\x04type\x18\x01 \x02(\t\x12&\n\x06memory\x18\x02 \x01(\x0b\x32\x16.mcsema.MemoryLocation\x12\x10\n\x08register\x18\x03 \x01(\t\x12\x0c\n\x04name\x18\x04 \x01(\t\"\x9c\x02\n\x0c\x46unctionDecl\x12%\n\nparameters\x18\x01 \x03(\x0b\x32\x11.mcsema.ValueDecl\x12(\n\rreturn_values\x18\x02 \x03(\x0b\x32\x11.mcsema.ValueDecl\x12)\n\x0ereturn_address\x18\x03 \x02(\x0b\x32\x11.mcsema.ValueDecl\x12/\n\x14return_stack_pointer\x18\x04 \x02(\x0b\x32\x11.mcsema.ValueDecl\x12\x13\n\x0bis_variadic\x18\x05 \x02(\x08\x12\x13\n\x0bis_noreturn\x18\x06 \x02(\x08\x12\x35\n\x12\x63\x61lling_convention\x18\x07 \x02(\x0e\x32\x19.mcsema.CallingConvention\"\xa8\x01\n\x08\x46unction\x12\n\n\x02\x65\x61\x18\x01 \x02(\x03\x12\x1d\n\x06\x62locks\x18\x02 \x03(\x0b\x32\r.mcsema.Block\x12\x15\n\ris_entrypoint\x18\x03 \x02(\x08\x12\x0c\n\x04name\x18\x04 \x01(\t\x12(\n\x08\x65h_frame\x18\x05 \x03(\x0b\x32\x16.mcsema.ExceptionFrame\x12\"\n\x04\x64\x65\x63l\x18\x06 \x01(\x0b\x32\x14.mcsema.FunctionDecl\"\xa1\x02\n\x10\x45xternalFunction\x12\x0c\n\x04name\x18\x01 \x02(\t\x12\n\n\x02\x65\x61\x18\x02 \x02(\x03\x12\x36\n\x02\x63\x63\x18\x03 \x02(\x0e\x32*.mcsema.ExternalFunction.CallingConvention\x12\x12\n\nhas_return\x18\x04 \x02(\x08\x12\x11\n\tno_return\x18\x05 \x02(\x08\x12\x16\n\x0e\x61rgument_count\x18\x06 \x02(\x05\x12\x0f\n\x07is_weak\x18\x07 \x02(\x08\x12\"\n\x04\x64\x65\x63l\x18\x08 \x01(\x0b\x32\x14.mcsema.FunctionDecl\"G\n\x11\x43\x61llingConvention\x12\x11\n\rCallerCleanup\x10\x00\x12\x11\n\rCalleeCleanup\x10\x01\x12\x0c\n\x08\x46\x61stCall\x10\x02\"d\n\x10\x45xternalVariable\x12\x0c\n\x04name\x18\x01 \x02(\t\x12\n\n\x02\x65\x61\x18\x02 \x02(\x03\x12\x0c\n\x04size\x18\x03 \x02(\x05\x12\x0f\n\x07is_weak\x18\x04 \x02(\x08\x12\x17\n\x0fis_thread_local\x18\x05 \x02(\x08\"\xba\x01\n\rDataReference\x12\n\n\x02\x65\x61\x18\x01 \x02(\x03\x12\r\n\x05width\x18\x02 \x02(\x05\x12\x11\n\ttarget_ea\x18\x03 \x02(\x03\x12@\n\x11target_fixup_kind\x18\x04 \x02(\x0e\x32%.mcsema.DataReference.TargetFixupKind\"9\n\x0fTargetFixupKind\x12\x0c\n\x08\x41\x62solute\x10\x00\x12\x18\n\x14OffsetFromThreadBase\x10\x01\"$\n\x08Variable\x12\n\n\x02\x65\x61\x18\x01 \x02(\x03\x12\x0c\n\x04name\x18\x02 \x02(\t\",\n\tReference\x12\x0f\n\x07inst_ea\x18\x01 \x02(\x04\x12\x0e\n\x06offset\x18\x02 \x02(\x03\"\xcc\x01\n\x0e\x45xceptionFrame\x12\x0f\n\x07\x66unc_ea\x18\x01 \x02(\x04\x12\x10\n\x08start_ea\x18\x03 \x02(\x04\x12\x0e\n\x06\x65nd_ea\x18\x04 \x02(\x04\x12\r\n\x05lp_ea\x18\x05 \x02(\x04\x12-\n\x06\x61\x63tion\x18\x06 \x02(\x0e\x32\x1d.mcsema.ExceptionFrame.Action\x12\'\n\x05ttype\x18\x07 \x03(\x0b\x32\x18.mcsema.ExternalVariable\" \n\x06\x41\x63tion\x12\x0b\n\x07\x43leanup\x10\x00\x12\t\n\x05\x43\x61tch\x10\x01\"8\n\x0eGlobalVariable\x12\n\n\x02\x65\x61\x18\x01 \x02(\x03\x12\x0c\n\x04name\x18\x02 \x02(\t\x12\x0c\n\x04size\x18\x03 \x02(\x03\"\xe4\x01\n\x07Segment\x12\n\n\x02\x65\x61\x18\x01 \x02(\x03\x12\x0c\n\x04\x64\x61ta\x18\x02 \x02(\x0c\x12\x11\n\tread_only\x18\x03 \x02(\x08\x12\x13\n\x0bis_external\x18\x04 \x02(\x08\x12\x0c\n\x04name\x18\x05 \x02(\t\x12\x15\n\rvariable_name\x18\x06 \x01(\t\x12\x13\n\x0bis_exported\x18\x07 \x02(\x08\x12\x17\n\x0fis_thread_local\x18\x08 \x02(\x08\x12$\n\x05xrefs\x18\t \x03(\x0b\x32\x15.mcsema.DataReference\x12\x1e\n\x04vars\x18\n \x03(\x0b\x32\x10.mcsema.Variable\"\xcd\x02\n\x06Module\x12\x0c\n\x04name\x18\x01 \x02(\t\x12\x1f\n\x05\x66uncs\x18\x02 \x03(\x0b\x32\x10.mcsema.Function\x12!\n\x08segments\x18\x03 \x03(\x0b\x32\x0f.mcsema.Segment\x12\x30\n\x0e\x65xternal_funcs\x18\x04 \x03(\x0b\x32\x18.mcsema.ExternalFunction\x12/\n\rexternal_vars\x18\x05 \x03(\x0b\x32\x18.mcsema.ExternalVariable\x12+\n\x0bglobal_vars\x18\x08 \x03(\x0b\x32\x16.mcsema.GlobalVariable\x12\x32\n\x0epreserved_regs\x18\t \x03(\x0b\x32\x1a.mcsema.PreservedRegisters\x12-\n\tdead_regs\x18\n \x03(\x0b\x32\x1a.mcsema.PreservedRegisters*\xa8\x01\n\x11\x43\x61llingConvention\x12\x05\n\x01\x43\x10\x00\x12\x0f\n\x0bX86_StdCall\x10@\x12\x10\n\x0cX86_FastCall\x10\x41\x12\x10\n\x0cX86_ThisCall\x10\x46\x12\x0f\n\x0bX86_64_SysV\x10N\x12\t\n\x05Win64\x10O\x12\x12\n\x0eX86_VectorCall\x10P\x12\x0f\n\x0bX86_RegCall\x10\\\x12\x16\n\x12\x41\x41rch64_VectorCall\x10\x61')
)
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
_CALLINGCONVENTION = _descriptor.EnumDescriptor(
name='CallingConvention',
full_name='mcsema.CallingConvention',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='C', index=0, number=0,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='X86_StdCall', index=1, number=64,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='X86_FastCall', index=2, number=65,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='X86_ThisCall', index=3, number=70,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='X86_64_SysV', index=4, number=78,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='Win64', index=5, number=79,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='X86_VectorCall', index=6, number=80,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='X86_RegCall', index=7, number=92,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='AArch64_VectorCall', index=8, number=97,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=2696,
serialized_end=2864,
)
_sym_db.RegisterEnumDescriptor(_CALLINGCONVENTION)
CallingConvention = enum_type_wrapper.EnumTypeWrapper(_CALLINGCONVENTION)
C = 0
X86_StdCall = 64
X86_FastCall = 65
X86_ThisCall = 70
X86_64_SysV = 78
Win64 = 79
X86_VectorCall = 80
X86_RegCall = 92
AArch64_VectorCall = 97
_CODEREFERENCE_OPERANDTYPE = _descriptor.EnumDescriptor(
name='OperandType',
full_name='mcsema.CodeReference.OperandType',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='ImmediateOperand', index=0, number=0,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='MemoryOperand', index=1, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='MemoryDisplacementOperand', index=2, number=2,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='ControlFlowOperand', index=3, number=3,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='OffsetTable', index=4, number=4,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=261,
serialized_end=387,
)
_sym_db.RegisterEnumDescriptor(_CODEREFERENCE_OPERANDTYPE)
_EXTERNALFUNCTION_CALLINGCONVENTION = _descriptor.EnumDescriptor(
name='CallingConvention',
full_name='mcsema.ExternalFunction.CallingConvention',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='CallerCleanup', index=0, number=0,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='CalleeCleanup', index=1, number=1,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='FastCall', index=2, number=2,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=1415,
serialized_end=1486,
)
_sym_db.RegisterEnumDescriptor(_EXTERNALFUNCTION_CALLINGCONVENTION)
_DATAREFERENCE_TARGETFIXUPKIND = _descriptor.EnumDescriptor(
name='TargetFixupKind',
full_name='mcsema.DataReference.TargetFixupKind',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='Absolute', index=0, number=0,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='OffsetFromThreadBase', index=1, number=1,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=1720,
serialized_end=1777,
)
_sym_db.RegisterEnumDescriptor(_DATAREFERENCE_TARGETFIXUPKIND)
_EXCEPTIONFRAME_ACTION = _descriptor.EnumDescriptor(
name='Action',
full_name='mcsema.ExceptionFrame.Action',
filename=None,
file=DESCRIPTOR,
values=[
_descriptor.EnumValueDescriptor(
name='Cleanup', index=0, number=0,
options=None,
type=None),
_descriptor.EnumValueDescriptor(
name='Catch', index=1, number=1,
options=None,
type=None),
],
containing_type=None,
options=None,
serialized_start=2036,
serialized_end=2068,
)
_sym_db.RegisterEnumDescriptor(_EXCEPTIONFRAME_ACTION)
_PRESERVATIONRANGE = _descriptor.Descriptor(
name='PreservationRange',
full_name='mcsema.PreservationRange',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='begin_ea', full_name='mcsema.PreservationRange.begin_ea', index=0,
number=1, type=3, cpp_type=2, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='end_ea', full_name='mcsema.PreservationRange.end_ea', index=1,
number=2, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=21,
serialized_end=74,
)
_PRESERVEDREGISTERS = _descriptor.Descriptor(
name='PreservedRegisters',
full_name='mcsema.PreservedRegisters',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='registers', full_name='mcsema.PreservedRegisters.registers', index=0,
number=1, type=9, cpp_type=9, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='ranges', full_name='mcsema.PreservedRegisters.ranges', index=1,
number=2, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=76,
serialized_end=158,
)
_CODEREFERENCE = _descriptor.Descriptor(
name='CodeReference',
full_name='mcsema.CodeReference',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='operand_type', full_name='mcsema.CodeReference.operand_type', index=0,
number=1, type=14, cpp_type=8, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='ea', full_name='mcsema.CodeReference.ea', index=1,
number=2, type=3, cpp_type=2, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='mask', full_name='mcsema.CodeReference.mask', index=2,
number=3, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
_CODEREFERENCE_OPERANDTYPE,
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=161,
serialized_end=387,
)
_INSTRUCTION = _descriptor.Descriptor(
name='Instruction',
full_name='mcsema.Instruction',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='ea', full_name='mcsema.Instruction.ea', index=0,
number=1, type=3, cpp_type=2, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='xrefs', full_name='mcsema.Instruction.xrefs', index=1,
number=2, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='lp_ea', full_name='mcsema.Instruction.lp_ea', index=2,
number=3, type=4, cpp_type=4, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=389,
serialized_end=467,
)
_BLOCK = _descriptor.Descriptor(
name='Block',
full_name='mcsema.Block',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='ea', full_name='mcsema.Block.ea', index=0,
number=1, type=3, cpp_type=2, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='instructions', full_name='mcsema.Block.instructions', index=1,
number=2, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='successor_eas', full_name='mcsema.Block.successor_eas', index=2,
number=3, type=3, cpp_type=2, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='is_referenced_by_data', full_name='mcsema.Block.is_referenced_by_data', index=3,
number=4, type=8, cpp_type=7, label=2,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=469,
serialized_end=585,
)
_MEMORYLOCATION = _descriptor.Descriptor(
name='MemoryLocation',
full_name='mcsema.MemoryLocation',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='register', full_name='mcsema.MemoryLocation.register', index=0,
number=1, type=9, cpp_type=9, label=2,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='offset', full_name='mcsema.MemoryLocation.offset', index=1,
number=2, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=587,
serialized_end=637,
)
_VALUEDECL = _descriptor.Descriptor(
name='ValueDecl',
full_name='mcsema.ValueDecl',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='type', full_name='mcsema.ValueDecl.type', index=0,
number=1, type=9, cpp_type=9, label=2,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='memory', full_name='mcsema.ValueDecl.memory', index=1,
number=2, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='register', full_name='mcsema.ValueDecl.register', index=2,
number=3, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='name', full_name='mcsema.ValueDecl.name', index=3,
number=4, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=639,
serialized_end=736,
)
_FUNCTIONDECL = _descriptor.Descriptor(
name='FunctionDecl',
full_name='mcsema.FunctionDecl',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='parameters', full_name='mcsema.FunctionDecl.parameters', index=0,
number=1, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='return_values', full_name='mcsema.FunctionDecl.return_values', index=1,
number=2, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='return_address', full_name='mcsema.FunctionDecl.return_address', index=2,
number=3, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='return_stack_pointer', full_name='mcsema.FunctionDecl.return_stack_pointer', index=3,
number=4, type=11, cpp_type=10, label=2,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='is_variadic', full_name='mcsema.FunctionDecl.is_variadic', index=4,
number=5, type=8, cpp_type=7, label=2,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='is_noreturn', full_name='mcsema.FunctionDecl.is_noreturn', index=5,
number=6, type=8, cpp_type=7, label=2,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='calling_convention', full_name='mcsema.FunctionDecl.calling_convention', index=6,
number=7, type=14, cpp_type=8, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=739,
serialized_end=1023,
)
_FUNCTION = _descriptor.Descriptor(
name='Function',
full_name='mcsema.Function',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='ea', full_name='mcsema.Function.ea', index=0,
number=1, type=3, cpp_type=2, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='blocks', full_name='mcsema.Function.blocks', index=1,
number=2, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='is_entrypoint', full_name='mcsema.Function.is_entrypoint', index=2,
number=3, type=8, cpp_type=7, label=2,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='name', full_name='mcsema.Function.name', index=3,
number=4, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='eh_frame', full_name='mcsema.Function.eh_frame', index=4,
number=5, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='decl', full_name='mcsema.Function.decl', index=5,
number=6, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=1026,
serialized_end=1194,
)
_EXTERNALFUNCTION = _descriptor.Descriptor(
name='ExternalFunction',
full_name='mcsema.ExternalFunction',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='name', full_name='mcsema.ExternalFunction.name', index=0,
number=1, type=9, cpp_type=9, label=2,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='ea', full_name='mcsema.ExternalFunction.ea', index=1,
number=2, type=3, cpp_type=2, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='cc', full_name='mcsema.ExternalFunction.cc', index=2,
number=3, type=14, cpp_type=8, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='has_return', full_name='mcsema.ExternalFunction.has_return', index=3,
number=4, type=8, cpp_type=7, label=2,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='no_return', full_name='mcsema.ExternalFunction.no_return', index=4,
number=5, type=8, cpp_type=7, label=2,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='argument_count', full_name='mcsema.ExternalFunction.argument_count', index=5,
number=6, type=5, cpp_type=1, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='is_weak', full_name='mcsema.ExternalFunction.is_weak', index=6,
number=7, type=8, cpp_type=7, label=2,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='decl', full_name='mcsema.ExternalFunction.decl', index=7,
number=8, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
_EXTERNALFUNCTION_CALLINGCONVENTION,
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=1197,
serialized_end=1486,
)
_EXTERNALVARIABLE = _descriptor.Descriptor(
name='ExternalVariable',
full_name='mcsema.ExternalVariable',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='name', full_name='mcsema.ExternalVariable.name', index=0,
number=1, type=9, cpp_type=9, label=2,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='ea', full_name='mcsema.ExternalVariable.ea', index=1,
number=2, type=3, cpp_type=2, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='size', full_name='mcsema.ExternalVariable.size', index=2,
number=3, type=5, cpp_type=1, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='is_weak', full_name='mcsema.ExternalVariable.is_weak', index=3,
number=4, type=8, cpp_type=7, label=2,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='is_thread_local', full_name='mcsema.ExternalVariable.is_thread_local', index=4,
number=5, type=8, cpp_type=7, label=2,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=1488,
serialized_end=1588,
)
_DATAREFERENCE = _descriptor.Descriptor(
name='DataReference',
full_name='mcsema.DataReference',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='ea', full_name='mcsema.DataReference.ea', index=0,
number=1, type=3, cpp_type=2, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='width', full_name='mcsema.DataReference.width', index=1,
number=2, type=5, cpp_type=1, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='target_ea', full_name='mcsema.DataReference.target_ea', index=2,
number=3, type=3, cpp_type=2, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='target_fixup_kind', full_name='mcsema.DataReference.target_fixup_kind', index=3,
number=4, type=14, cpp_type=8, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
_DATAREFERENCE_TARGETFIXUPKIND,
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=1591,
serialized_end=1777,
)
_VARIABLE = _descriptor.Descriptor(
name='Variable',
full_name='mcsema.Variable',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='ea', full_name='mcsema.Variable.ea', index=0,
number=1, type=3, cpp_type=2, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='name', full_name='mcsema.Variable.name', index=1,
number=2, type=9, cpp_type=9, label=2,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=1779,
serialized_end=1815,
)
_REFERENCE = _descriptor.Descriptor(
name='Reference',
full_name='mcsema.Reference',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='inst_ea', full_name='mcsema.Reference.inst_ea', index=0,
number=1, type=4, cpp_type=4, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='offset', full_name='mcsema.Reference.offset', index=1,
number=2, type=3, cpp_type=2, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=1817,
serialized_end=1861,
)
_EXCEPTIONFRAME = _descriptor.Descriptor(
name='ExceptionFrame',
full_name='mcsema.ExceptionFrame',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='func_ea', full_name='mcsema.ExceptionFrame.func_ea', index=0,
number=1, type=4, cpp_type=4, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='start_ea', full_name='mcsema.ExceptionFrame.start_ea', index=1,
number=3, type=4, cpp_type=4, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='end_ea', full_name='mcsema.ExceptionFrame.end_ea', index=2,
number=4, type=4, cpp_type=4, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='lp_ea', full_name='mcsema.ExceptionFrame.lp_ea', index=3,
number=5, type=4, cpp_type=4, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='action', full_name='mcsema.ExceptionFrame.action', index=4,
number=6, type=14, cpp_type=8, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='ttype', full_name='mcsema.ExceptionFrame.ttype', index=5,
number=7, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
_EXCEPTIONFRAME_ACTION,
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=1864,
serialized_end=2068,
)
_GLOBALVARIABLE = _descriptor.Descriptor(
name='GlobalVariable',
full_name='mcsema.GlobalVariable',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='ea', full_name='mcsema.GlobalVariable.ea', index=0,
number=1, type=3, cpp_type=2, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='name', full_name='mcsema.GlobalVariable.name', index=1,
number=2, type=9, cpp_type=9, label=2,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='size', full_name='mcsema.GlobalVariable.size', index=2,
number=3, type=3, cpp_type=2, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=2070,
serialized_end=2126,
)
_SEGMENT = _descriptor.Descriptor(
name='Segment',
full_name='mcsema.Segment',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='ea', full_name='mcsema.Segment.ea', index=0,
number=1, type=3, cpp_type=2, label=2,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='data', full_name='mcsema.Segment.data', index=1,
number=2, type=12, cpp_type=9, label=2,
has_default_value=False, default_value=_b(""),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='read_only', full_name='mcsema.Segment.read_only', index=2,
number=3, type=8, cpp_type=7, label=2,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='is_external', full_name='mcsema.Segment.is_external', index=3,
number=4, type=8, cpp_type=7, label=2,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='name', full_name='mcsema.Segment.name', index=4,
number=5, type=9, cpp_type=9, label=2,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='variable_name', full_name='mcsema.Segment.variable_name', index=5,
number=6, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='is_exported', full_name='mcsema.Segment.is_exported', index=6,
number=7, type=8, cpp_type=7, label=2,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='is_thread_local', full_name='mcsema.Segment.is_thread_local', index=7,
number=8, type=8, cpp_type=7, label=2,
has_default_value=False, default_value=False,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='xrefs', full_name='mcsema.Segment.xrefs', index=8,
number=9, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='vars', full_name='mcsema.Segment.vars', index=9,
number=10, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=2129,
serialized_end=2357,
)
_MODULE = _descriptor.Descriptor(
name='Module',
full_name='mcsema.Module',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='name', full_name='mcsema.Module.name', index=0,
number=1, type=9, cpp_type=9, label=2,
has_default_value=False, default_value=_b("").decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='funcs', full_name='mcsema.Module.funcs', index=1,
number=2, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='segments', full_name='mcsema.Module.segments', index=2,
number=3, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='external_funcs', full_name='mcsema.Module.external_funcs', index=3,
number=4, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='external_vars', full_name='mcsema.Module.external_vars', index=4,
number=5, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='global_vars', full_name='mcsema.Module.global_vars', index=5,
number=8, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='preserved_regs', full_name='mcsema.Module.preserved_regs', index=6,
number=9, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
_descriptor.FieldDescriptor(
name='dead_regs', full_name='mcsema.Module.dead_regs', index=7,
number=10, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
options=None),
],
extensions=[
],
nested_types=[],
enum_types=[
],
options=None,
is_extendable=False,
extension_ranges=[],
oneofs=[
],
serialized_start=2360,
serialized_end=2693,
)
_PRESERVEDREGISTERS.fields_by_name['ranges'].message_type = _PRESERVATIONRANGE
_CODEREFERENCE.fields_by_name['operand_type'].enum_type = _CODEREFERENCE_OPERANDTYPE
_CODEREFERENCE_OPERANDTYPE.containing_type = _CODEREFERENCE
_INSTRUCTION.fields_by_name['xrefs'].message_type = _CODEREFERENCE
_BLOCK.fields_by_name['instructions'].message_type = _INSTRUCTION
_VALUEDECL.fields_by_name['memory'].message_type = _MEMORYLOCATION
_FUNCTIONDECL.fields_by_name['parameters'].message_type = _VALUEDECL
_FUNCTIONDECL.fields_by_name['return_values'].message_type = _VALUEDECL
_FUNCTIONDECL.fields_by_name['return_address'].message_type = _VALUEDECL
_FUNCTIONDECL.fields_by_name['return_stack_pointer'].message_type = _VALUEDECL
_FUNCTIONDECL.fields_by_name['calling_convention'].enum_type = _CALLINGCONVENTION
_FUNCTION.fields_by_name['blocks'].message_type = _BLOCK
_FUNCTION.fields_by_name['eh_frame'].message_type = _EXCEPTIONFRAME
_FUNCTION.fields_by_name['decl'].message_type = _FUNCTIONDECL
_EXTERNALFUNCTION.fields_by_name['cc'].enum_type = _EXTERNALFUNCTION_CALLINGCONVENTION
_EXTERNALFUNCTION.fields_by_name['decl'].message_type = _FUNCTIONDECL
_EXTERNALFUNCTION_CALLINGCONVENTION.containing_type = _EXTERNALFUNCTION
_DATAREFERENCE.fields_by_name['target_fixup_kind'].enum_type = _DATAREFERENCE_TARGETFIXUPKIND
_DATAREFERENCE_TARGETFIXUPKIND.containing_type = _DATAREFERENCE
_EXCEPTIONFRAME.fields_by_name['action'].enum_type = _EXCEPTIONFRAME_ACTION
_EXCEPTIONFRAME.fields_by_name['ttype'].message_type = _EXTERNALVARIABLE
_EXCEPTIONFRAME_ACTION.containing_type = _EXCEPTIONFRAME
_SEGMENT.fields_by_name['xrefs'].message_type = _DATAREFERENCE
_SEGMENT.fields_by_name['vars'].message_type = _VARIABLE
_MODULE.fields_by_name['funcs'].message_type = _FUNCTION
_MODULE.fields_by_name['segments'].message_type = _SEGMENT
_MODULE.fields_by_name['external_funcs'].message_type = _EXTERNALFUNCTION
_MODULE.fields_by_name['external_vars'].message_type = _EXTERNALVARIABLE
_MODULE.fields_by_name['global_vars'].message_type = _GLOBALVARIABLE
_MODULE.fields_by_name['preserved_regs'].message_type = _PRESERVEDREGISTERS
_MODULE.fields_by_name['dead_regs'].message_type = _PRESERVEDREGISTERS
DESCRIPTOR.message_types_by_name['PreservationRange'] = _PRESERVATIONRANGE
DESCRIPTOR.message_types_by_name['PreservedRegisters'] = _PRESERVEDREGISTERS
DESCRIPTOR.message_types_by_name['CodeReference'] = _CODEREFERENCE
DESCRIPTOR.message_types_by_name['Instruction'] = _INSTRUCTION
DESCRIPTOR.message_types_by_name['Block'] = _BLOCK
DESCRIPTOR.message_types_by_name['MemoryLocation'] = _MEMORYLOCATION
DESCRIPTOR.message_types_by_name['ValueDecl'] = _VALUEDECL
DESCRIPTOR.message_types_by_name['FunctionDecl'] = _FUNCTIONDECL
DESCRIPTOR.message_types_by_name['Function'] = _FUNCTION
DESCRIPTOR.message_types_by_name['ExternalFunction'] = _EXTERNALFUNCTION
DESCRIPTOR.message_types_by_name['ExternalVariable'] = _EXTERNALVARIABLE
DESCRIPTOR.message_types_by_name['DataReference'] = _DATAREFERENCE
DESCRIPTOR.message_types_by_name['Variable'] = _VARIABLE
DESCRIPTOR.message_types_by_name['Reference'] = _REFERENCE
DESCRIPTOR.message_types_by_name['ExceptionFrame'] = _EXCEPTIONFRAME
DESCRIPTOR.message_types_by_name['GlobalVariable'] = _GLOBALVARIABLE
DESCRIPTOR.message_types_by_name['Segment'] = _SEGMENT
DESCRIPTOR.message_types_by_name['Module'] = _MODULE
DESCRIPTOR.enum_types_by_name['CallingConvention'] = _CALLINGCONVENTION
PreservationRange = _reflection.GeneratedProtocolMessageType('PreservationRange', (_message.Message,), dict(
DESCRIPTOR = _PRESERVATIONRANGE,
__module__ = 'CFG_pb2'
# @@protoc_insertion_point(class_scope:mcsema.PreservationRange)
))
_sym_db.RegisterMessage(PreservationRange)
PreservedRegisters = _reflection.GeneratedProtocolMessageType('PreservedRegisters', (_message.Message,), dict(
DESCRIPTOR = _PRESERVEDREGISTERS,
__module__ = 'CFG_pb2'
# @@protoc_insertion_point(class_scope:mcsema.PreservedRegisters)
))
_sym_db.RegisterMessage(PreservedRegisters)
CodeReference = _reflection.GeneratedProtocolMessageType('CodeReference', (_message.Message,), dict(
DESCRIPTOR = _CODEREFERENCE,
__module__ = 'CFG_pb2'
# @@protoc_insertion_point(class_scope:mcsema.CodeReference)
))
_sym_db.RegisterMessage(CodeReference)
Instruction = _reflection.GeneratedProtocolMessageType('Instruction', (_message.Message,), dict(
DESCRIPTOR = _INSTRUCTION,
__module__ = 'CFG_pb2'
# @@protoc_insertion_point(class_scope:mcsema.Instruction)
))
_sym_db.RegisterMessage(Instruction)
Block = _reflection.GeneratedProtocolMessageType('Block', (_message.Message,), dict(
DESCRIPTOR = _BLOCK,
__module__ = 'CFG_pb2'
# @@protoc_insertion_point(class_scope:mcsema.Block)
))
_sym_db.RegisterMessage(Block)
MemoryLocation = _reflection.GeneratedProtocolMessageType('MemoryLocation', (_message.Message,), dict(
DESCRIPTOR = _MEMORYLOCATION,
__module__ = 'CFG_pb2'
# @@protoc_insertion_point(class_scope:mcsema.MemoryLocation)
))
_sym_db.RegisterMessage(MemoryLocation)
ValueDecl = _reflection.GeneratedProtocolMessageType('ValueDecl', (_message.Message,), dict(
DESCRIPTOR = _VALUEDECL,
__module__ = 'CFG_pb2'
# @@protoc_insertion_point(class_scope:mcsema.ValueDecl)
))
_sym_db.RegisterMessage(ValueDecl)
FunctionDecl = _reflection.GeneratedProtocolMessageType('FunctionDecl', (_message.Message,), dict(
DESCRIPTOR = _FUNCTIONDECL,
__module__ = 'CFG_pb2'
# @@protoc_insertion_point(class_scope:mcsema.FunctionDecl)
))
_sym_db.RegisterMessage(FunctionDecl)
Function = _reflection.GeneratedProtocolMessageType('Function', (_message.Message,), dict(
DESCRIPTOR = _FUNCTION,
__module__ = 'CFG_pb2'
# @@protoc_insertion_point(class_scope:mcsema.Function)
))
_sym_db.RegisterMessage(Function)
ExternalFunction = _reflection.GeneratedProtocolMessageType('ExternalFunction', (_message.Message,), dict(
DESCRIPTOR = _EXTERNALFUNCTION,
__module__ = 'CFG_pb2'
# @@protoc_insertion_point(class_scope:mcsema.ExternalFunction)
))
_sym_db.RegisterMessage(ExternalFunction)
ExternalVariable = _reflection.GeneratedProtocolMessageType('ExternalVariable', (_message.Message,), dict(
DESCRIPTOR = _EXTERNALVARIABLE,
__module__ = 'CFG_pb2'
# @@protoc_insertion_point(class_scope:mcsema.ExternalVariable)
))
_sym_db.RegisterMessage(ExternalVariable)
DataReference = _reflection.GeneratedProtocolMessageType('DataReference', (_message.Message,), dict(
DESCRIPTOR = _DATAREFERENCE,
__module__ = 'CFG_pb2'
# @@protoc_insertion_point(class_scope:mcsema.DataReference)
))
_sym_db.RegisterMessage(DataReference)
Variable = _reflection.GeneratedProtocolMessageType('Variable', (_message.Message,), dict(
DESCRIPTOR = _VARIABLE,
__module__ = 'CFG_pb2'
# @@protoc_insertion_point(class_scope:mcsema.Variable)
))
_sym_db.RegisterMessage(Variable)
Reference = _reflection.GeneratedProtocolMessageType('Reference', (_message.Message,), dict(
DESCRIPTOR = _REFERENCE,
__module__ = 'CFG_pb2'
# @@protoc_insertion_point(class_scope:mcsema.Reference)
))
_sym_db.RegisterMessage(Reference)
ExceptionFrame = _reflection.GeneratedProtocolMessageType('ExceptionFrame', (_message.Message,), dict(
DESCRIPTOR = _EXCEPTIONFRAME,
__module__ = 'CFG_pb2'
# @@protoc_insertion_point(class_scope:mcsema.ExceptionFrame)
))
_sym_db.RegisterMessage(ExceptionFrame)
GlobalVariable = _reflection.GeneratedProtocolMessageType('GlobalVariable', (_message.Message,), dict(
DESCRIPTOR = _GLOBALVARIABLE,
__module__ = 'CFG_pb2'
# @@protoc_insertion_point(class_scope:mcsema.GlobalVariable)
))
_sym_db.RegisterMessage(GlobalVariable)
Segment = _reflection.GeneratedProtocolMessageType('Segment', (_message.Message,), dict(
DESCRIPTOR = _SEGMENT,
__module__ = 'CFG_pb2'
# @@protoc_insertion_point(class_scope:mcsema.Segment)
))
_sym_db.RegisterMessage(Segment)
Module = _reflection.GeneratedProtocolMessageType('Module', (_message.Message,), dict(
DESCRIPTOR = _MODULE,
__module__ = 'CFG_pb2'
# @@protoc_insertion_point(class_scope:mcsema.Module)
))
_sym_db.RegisterMessage(Module)
# @@protoc_insertion_point(module_scope)
| 38.617257 | 5,362 | 0.732207 | 6,732 | 52,365 | 5.424242 | 0.059121 | 0.062877 | 0.039873 | 0.051813 | 0.674198 | 0.621207 | 0.606008 | 0.590481 | 0.559508 | 0.528864 | 0 | 0.049218 | 0.138241 | 52,365 | 1,355 | 5,363 | 38.645756 | 0.759983 | 0.02263 | 0 | 0.683294 | 1 | 0.002375 | 0.175303 | 0.126767 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.005542 | 0 | 0.005542 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
d07d8e60683a9eb35b070c3be610ce1f31370e66 | 330 | py | Python | app/tests/test_validators.py | ogambakerubo/StackOverflow-lite | 32dd194851d1746178c333db678dbb3c7bc9f70f | [
"MIT"
] | null | null | null | app/tests/test_validators.py | ogambakerubo/StackOverflow-lite | 32dd194851d1746178c333db678dbb3c7bc9f70f | [
"MIT"
] | null | null | null | app/tests/test_validators.py | ogambakerubo/StackOverflow-lite | 32dd194851d1746178c333db678dbb3c7bc9f70f | [
"MIT"
] | null | null | null | #StackOverflow-lite/app/tests/test_validators.py
"""Tests for validators run with pytest"""
import unittest
from app.api.validators import validate_string
class ValidatorsTestCase(unittest.TestCase):
def test_for_strings(self):
with self.assertRaises(ValueError):
validate_string("@##$$Hello")
| 23.571429 | 49 | 0.727273 | 38 | 330 | 6.184211 | 0.684211 | 0.119149 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.169697 | 330 | 14 | 50 | 23.571429 | 0.857664 | 0.254545 | 0 | 0 | 0 | 0 | 0.041494 | 0 | 0 | 0 | 0 | 0 | 0.166667 | 1 | 0.166667 | false | 0 | 0.333333 | 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 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
d083e66f965efd12e91308af85df0379714b8610 | 325 | py | Python | tasks/symlink-archive/flask/app/__init__.py | HackerDom/qctf-starter-2018 | f4eef0fd41d777661b9fbcc61dcee9709d9f6268 | [
"MIT"
] | 8 | 2018-03-15T12:07:11.000Z | 2020-12-01T15:02:46.000Z | tasks/symlink-archive/flask/app/__init__.py | HackerDom/qctf-starter-2018 | f4eef0fd41d777661b9fbcc61dcee9709d9f6268 | [
"MIT"
] | 17 | 2020-01-28T22:17:42.000Z | 2022-03-11T23:18:09.000Z | tasks/symlink-archive/flask/app/__init__.py | HackerDom/qctf-starter-2018 | f4eef0fd41d777661b9fbcc61dcee9709d9f6268 | [
"MIT"
] | 2 | 2018-11-26T18:54:27.000Z | 2018-12-05T17:37:32.000Z | from flask import Flask
from flask_login import LoginManager
import generate_dirs
app = Flask(__name__)
app.config.from_object('config')
login_manager = LoginManager()
login_manager.init_app(app)
generate_dirs.generate(app.config['USERS_FILE'], app.config['USER_DATA_DIR'], app.config['FAKE_USERS'])
from app import views
| 25 | 103 | 0.806154 | 48 | 325 | 5.145833 | 0.416667 | 0.145749 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.086154 | 325 | 12 | 104 | 27.083333 | 0.83165 | 0 | 0 | 0 | 1 | 0 | 0.12 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.444444 | 0 | 0.444444 | 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 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
d099bf106c01e53ef2ccf3ca7eb8c380eaf838a6 | 1,311 | py | Python | Henrique/Python3-Desafio-036.py | HenriqueMAP/Curso-em-Video-Python3 | 394f02f5a758f21bdb84da97d949bd35b90a085c | [
"MIT"
] | 3 | 2020-10-06T12:40:23.000Z | 2021-07-01T23:49:26.000Z | Henrique/Python3-Desafio-036.py | HenriqueMAP/Curso-em-Video-Python3 | 394f02f5a758f21bdb84da97d949bd35b90a085c | [
"MIT"
] | null | null | null | Henrique/Python3-Desafio-036.py | HenriqueMAP/Curso-em-Video-Python3 | 394f02f5a758f21bdb84da97d949bd35b90a085c | [
"MIT"
] | null | null | null | # Challenge 036 - 04/21/2021 - Henrique Matheus Alves Pereira
# Write a program to approve the bank loan for the purchase of a home.
# Ask the price of the house, the buyer's salary and how many years he will pay.
# The monthly installment cannot exceed 30% of the salary or the loan will be denied.
print("Challenge 036")
print("Please, for the following information, enter only two digits after the comma.")
priceHouse = float(input("1 - Please, enter the purchase price of the home (R$):"))
financingTime = float(input("2 - Please, enter the financing time of the home (Years):"))
salary = float(input("3 - Please, enter you salary (R$):"))
bankLoanReleased = "Bank loan released, considering that the monthly installment is below 30% of the informed salary."
bankLoanNotReleased = "Bank loan not released, considering that the monthly installment amount is above 30% of the informed salary."
monthlyInstallment = float(priceHouse/(financingTime*12))
print("The monthly installment is: R${:.2f}" .format(monthlyInstallment))
print(bankLoanReleased) if monthlyInstallment <= float(salary*0.3) else print(bankLoanNotReleased)
print("Financial institutions accept to commit up to 30% of the gross family income in real estate financing. Source: https://ka.com.br/qual-e-a-renda-para-financiamento-com-a-caixa/") | 87.4 | 184 | 0.768116 | 197 | 1,311 | 5.111675 | 0.522843 | 0.034757 | 0.083416 | 0.051639 | 0.129096 | 0.087388 | 0 | 0 | 0 | 0 | 0 | 0.026455 | 0.135011 | 1,311 | 15 | 184 | 87.4 | 0.861552 | 0.221968 | 0 | 0 | 0 | 0.090909 | 0.640748 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.454545 | 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 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 2 |
d0a62809af232633482dfce371b713a53c16de73 | 1,402 | py | Python | kigo/bpmn/elements/events.py | AsyncMicroStack/kigo-bpmn | dfe8c312399f86067393973a0c28a8695bb5e07a | [
"Apache-2.0"
] | null | null | null | kigo/bpmn/elements/events.py | AsyncMicroStack/kigo-bpmn | dfe8c312399f86067393973a0c28a8695bb5e07a | [
"Apache-2.0"
] | null | null | null | kigo/bpmn/elements/events.py | AsyncMicroStack/kigo-bpmn | dfe8c312399f86067393973a0c28a8695bb5e07a | [
"Apache-2.0"
] | null | null | null | from kigo.bpmn.elements.element import Element
class Event(Element):
item_name = "bpmn:event"
class StartEvent(Event):
item_name = "bpmn:startEvent"
def __init__(self, eid=None, name=None, outgoing=[]):
self.eid = eid
self.name = name
self.outgoing = outgoing
def __repr__(self):
return f"{type(self)} <id '{self.eid}'> <name '{self.name}'> <outgoing {self.outgoing}>"
class StartMessageEvent(Event):
item_name = "bpmn:startMessageEvent"
class EndEvent(Event):
item_name = "bpmn:endEvent"
def __init__(self, eid=None, name=None, incoming=[]):
self.eid = eid
self.name = name
self.incoming = incoming
def __repr__(self):
return f"{type(self)} <id '{self.eid}'> <name '{self.name}'> <incoming {self.incoming}>"
class EndMessageEvent(Event):
item_name = "bpmn:endMessageEvent"
class IntermediateMessageCatchingEvent(Event):
item_name = "bpmn:intermediateMessageCatchingEvent"
class MessageEventDefinition(Event):
item_name = "bpmn:messageEventDefinition"
class TimerEventDefinition(Event):
item_name = "bpmn:timerEventDefinition"
class ConditionalEventDefinition(Event):
item_name = "bpmn:conditionalEventDefinition"
class SignalEventDefinition(Event):
item_name = "bpmn:signalEventDefinition"
class BoundaryEventn(Event):
item_name = "bpmn:boundaryEvent"
| 22.983607 | 96 | 0.696148 | 150 | 1,402 | 6.326667 | 0.22 | 0.092729 | 0.139094 | 0.179136 | 0.208641 | 0.208641 | 0.208641 | 0.099052 | 0.099052 | 0.099052 | 0 | 0 | 0.182596 | 1,402 | 60 | 97 | 23.366667 | 0.828098 | 0 | 0 | 0.171429 | 0 | 0.057143 | 0.285307 | 0.119829 | 0 | 0 | 0 | 0 | 0 | 1 | 0.114286 | false | 0 | 0.028571 | 0.057143 | 0.828571 | 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 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
d0adceb6882867653290a4d5451da8f815afcafb | 482 | py | Python | e-estruturas condicionais/des-034 condicional-008.py | solito83/aprendendo-programar-em-python | af5bce7efa2ffa4d081c015830e3710044899924 | [
"MIT"
] | null | null | null | e-estruturas condicionais/des-034 condicional-008.py | solito83/aprendendo-programar-em-python | af5bce7efa2ffa4d081c015830e3710044899924 | [
"MIT"
] | null | null | null | e-estruturas condicionais/des-034 condicional-008.py | solito83/aprendendo-programar-em-python | af5bce7efa2ffa4d081c015830e3710044899924 | [
"MIT"
] | null | null | null | des = 'Desafio-034 estruturas condicionais'
print ('{}'.format(des))
#Escreva um programa que pergunte o salário de um funcionário e calcule o valor do seu aumento. Para salários superiores a R$1250,00, calcule um aumento de 10%. Para os inferiores ou iguais, o aumento é de 15%.
salario = (float(input('Digite seu salário atual: ')))
if salario <= 1250:
print ('comentarios', salario + (salario * (15 / 100)))
else:
print ('comentarios', salario + (salario * (10 /100)))
| 43.818182 | 210 | 0.701245 | 70 | 482 | 4.828571 | 0.642857 | 0.094675 | 0.136095 | 0.177515 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.067669 | 0.172199 | 482 | 10 | 211 | 48.2 | 0.779449 | 0.43361 | 0 | 0 | 0 | 0 | 0.3125 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.428571 | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 2 |
d0b3df53f9cb2a8fbde507f179dcc9b12e5dd5d8 | 1,806 | py | Python | tests/cupyx_tests/jit_tests/test_raw.py | viantirreau/cupy | cafe9af0e974ff88fc6aa43bf106e343a60fb983 | [
"MIT"
] | 1 | 2021-06-03T16:51:02.000Z | 2021-06-03T16:51:02.000Z | tests/cupyx_tests/jit_tests/test_raw.py | viantirreau/cupy | cafe9af0e974ff88fc6aa43bf106e343a60fb983 | [
"MIT"
] | null | null | null | tests/cupyx_tests/jit_tests/test_raw.py | viantirreau/cupy | cafe9af0e974ff88fc6aa43bf106e343a60fb983 | [
"MIT"
] | null | null | null | import unittest
import numpy
import cupy
from cupyx import jit
from cupy import testing
class TestRaw(unittest.TestCase):
def test_raw_kick_one_kernel(self):
@jit.rawkernel()
def f(x, y):
y[0] = x[0]
x = cupy.array([10], dtype=numpy.int32)
y = cupy.array([20], dtype=numpy.int32)
f((1,), (1,), (x, y))
assert int(y[0]) == 10
def test_raw_elementwise_single_op(self):
@jit.rawkernel()
def f(x, y):
tid = jit.threadIdx.x + jit.blockDim.x * jit.blockIdx.x
y[tid] = x[tid]
x = testing.shaped_random((30,), dtype=numpy.int32, seed=0)
y = testing.shaped_random((30,), dtype=numpy.int32, seed=1)
f((5,), (6,), (x, y))
assert bool((x == y).all())
def test_raw_elementwise_loop(self):
@jit.rawkernel()
def f(x, y, size):
tid = jit.threadIdx.x + jit.blockDim.x * jit.blockIdx.x
ntid = jit.blockDim.x * jit.gridDim.x
for i in range(tid, size, ntid):
y[i] = x[i]
x = testing.shaped_random((1024,), dtype=numpy.int32, seed=0)
y = testing.shaped_random((1024,), dtype=numpy.int32, seed=1)
f((5,), (6,), (x, y, numpy.uint32(1024)))
assert bool((x == y).all())
def test_raw_grid_block_interface(self):
@jit.rawkernel()
def f(x, y, size):
tid = jit.threadIdx.x + jit.blockDim.x * jit.blockIdx.x
ntid = jit.blockDim.x * jit.gridDim.x
for i in range(tid, size, ntid):
y[i] = x[i]
x = testing.shaped_random((1024,), dtype=numpy.int32, seed=0)
y = testing.shaped_random((1024,), dtype=numpy.int32, seed=1)
f[5, 6](x, y, numpy.uint32(1024))
assert bool((x == y).all())
| 31.684211 | 69 | 0.54485 | 265 | 1,806 | 3.633962 | 0.222642 | 0.024922 | 0.124611 | 0.11838 | 0.717549 | 0.717549 | 0.717549 | 0.671859 | 0.61163 | 0.570093 | 0 | 0.055512 | 0.291805 | 1,806 | 56 | 70 | 32.25 | 0.69742 | 0 | 0 | 0.533333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.088889 | 1 | 0.177778 | false | 0 | 0.111111 | 0 | 0.311111 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
d0b414e5124480cb862378bf68e0ce983daabef1 | 562 | py | Python | twobuntu/categories/views.py | 2buntu/2buntu-blog | 0a718ccee8301f28e86791e06159e6ed8a2674b4 | [
"Apache-2.0"
] | 16 | 2015-01-12T12:25:28.000Z | 2021-06-22T03:23:44.000Z | twobuntu/categories/views.py | 2buntu/2buntu-blog | 0a718ccee8301f28e86791e06159e6ed8a2674b4 | [
"Apache-2.0"
] | 5 | 2015-01-02T01:23:40.000Z | 2015-10-22T06:11:40.000Z | twobuntu/categories/views.py | 2buntu/2buntu-blog | 0a718ccee8301f28e86791e06159e6ed8a2674b4 | [
"Apache-2.0"
] | 11 | 2015-01-27T06:23:45.000Z | 2020-05-20T11:46:12.000Z | from django.shortcuts import render
from twobuntu.articles.models import Article
from twobuntu.categories.models import Category
from twobuntu.decorators import canonical
@canonical(Category)
def view(request, category):
"""
Display articles filed under the specified category.
"""
return render(request, 'categories/view.html', {
'title': category.name,
'category': category,
'articles': Article.objects.select_related('author','author__profile','category').filter(category=category, status=Article.PUBLISHED),
})
| 31.222222 | 142 | 0.733096 | 61 | 562 | 6.704918 | 0.540984 | 0.08802 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.156584 | 562 | 17 | 143 | 33.058824 | 0.862869 | 0.092527 | 0 | 0 | 0 | 0 | 0.1417 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.090909 | false | 0 | 0.363636 | 0 | 0.545455 | 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 | 0 | 1 | 0 | 0 | 2 |
d0c5d4da295b04aee9abedaa869680b8362d052c | 2,019 | py | Python | src/integral_timber_joints/rhino/debug_tools.py | gramaziokohler/integral_timber_joints | 70e75a66e13b5ada580fcffc58879f5fcb8fce32 | [
"MIT"
] | 3 | 2021-09-16T13:08:32.000Z | 2022-02-21T17:20:21.000Z | src/integral_timber_joints/rhino/debug_tools.py | gramaziokohler/integral_timber_joints | 70e75a66e13b5ada580fcffc58879f5fcb8fce32 | [
"MIT"
] | 80 | 2021-09-06T09:55:38.000Z | 2022-03-22T18:44:24.000Z | src/integral_timber_joints/rhino/debug_tools.py | gramaziokohler/integral_timber_joints | 70e75a66e13b5ada580fcffc58879f5fcb8fce32 | [
"MIT"
] | null | null | null | import Rhino # type: ignore
import rhinoscriptsyntax as rs
import scriptcontext
import re
from integral_timber_joints.rhino.load import get_process, get_process_artist, process_is_none
from integral_timber_joints.rhino.assembly_artist import AssemblyNurbsArtist
from integral_timber_joints.process import RobotClampAssemblyProcess
from integral_timber_joints.process import ComputationalResult
from integral_timber_joints.assembly import BeamAssemblyMethod
from compas_rhino.utilities import clear_layer, delete_objects, draw_mesh
try:
from typing import Dict, List, Optional, Tuple
from integral_timber_joints.process import RFLPathPlanner
except:
pass
if __name__ == '__main__':
process = get_process()
# artist = get_process_artist()
# artist = AssemblyNurbsArtist(process.assembly)
beam_id = 'b3'
beam = process.assembly.beam(beam_id)
# process.assembly.set_joint_attribute(('b1', 'b3'), "tool_type_preference", 'SL1_G200')
# process.assembly.set_joint_attribute(('b0', 'b3'), "tool_type_preference", 'SL1_G200')
# assign_tool_type_to_joints(process, beam_id, True)
# print (process.get_available_tool_type_dict())
for beam_id in process.assembly.sequence:
if beam_id != 'b4' : continue
process.assign_tool_type_to_joints(beam_id, True)
print ("-------------------------")
print (beam_id)
# process.assign_tool_type_to_joints(beam_id, True)
for joint_id in process.assembly.get_joint_ids_with_tools_for_beam(beam_id):
print("joint_id", joint_id)
print("- tool_type_preference", process.assembly.get_joint_attribute(joint_id, "tool_type_preference"))
print("- tool_type", process.assembly.get_joint_attribute(joint_id, "tool_type"))
print("- tool_id", process.assembly.get_joint_attribute(joint_id, "tool_id"))
# print(process.assembly.get_beam_attribute(beam_id, "gripper_id"))
# print(process.assembly.get_beam_attribute(beam_id, "gripper_type"))
| 41.204082 | 115 | 0.746409 | 260 | 2,019 | 5.403846 | 0.269231 | 0.117438 | 0.076868 | 0.102491 | 0.445552 | 0.343061 | 0.225623 | 0.225623 | 0.195018 | 0.072598 | 0 | 0.008159 | 0.150074 | 2,019 | 48 | 116 | 42.0625 | 0.810606 | 0.269936 | 0 | 0 | 0 | 0 | 0.084074 | 0.017088 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.068966 | 0.413793 | 0 | 0.413793 | 0.206897 | 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 | 0 | 0 | 0 | 2 |
d0e15a624f63414acc574d34a41cb021b113ad6e | 3,220 | py | Python | xmppserver/xmpp/registration.py | ovekaaven/django-xmpp-server | aa391173b4cdfc98e2f6de29d24aa4273b3620c3 | [
"MIT"
] | null | null | null | xmppserver/xmpp/registration.py | ovekaaven/django-xmpp-server | aa391173b4cdfc98e2f6de29d24aa4273b3620c3 | [
"MIT"
] | null | null | null | xmppserver/xmpp/registration.py | ovekaaven/django-xmpp-server | aa391173b4cdfc98e2f6de29d24aa4273b3620c3 | [
"MIT"
] | null | null | null | from slixmpp import Callback
from slixmpp.exceptions import XMPPError
from slixmpp.plugins.xep_0077 import stanza as register_stanza
from .matcher import ServerStanzaPath
from ..conf import settings
class Registration(object):
def __init__(self, stream):
self.stream = stream
stream.register_plugin('xep_0077')
stream['xep_0030'].add_feature(register_stanza.Register.namespace)
stream.register_handler(
Callback('Registration',
ServerStanzaPath('iq/register'),
self._handle_register))
def _handle_register(self, iq):
type = iq['type']
if type == 'get':
self.stream.loop.create_task(self._get_register(iq))
elif type == 'set':
self.stream.loop.create_task(self._set_register(iq))
else:
iq.unhandled()
async def _get_register(self, iq):
reply = iq.reply()
fields = reply['register']
if settings.ALLOW_REGISTRATION:
# TODO: field customization.
if 'mechanisms' in self.stream.features:
# already authenticated
fields.set_registered(True)
fields['username'] = self.stream.boundjid.user
fields.add_field('password')
else:
fields.add_field('username')
fields.add_field('password')
else:
url = settings.REGISTRATION_URL
if url is None:
url = 'http://' + self.stream.host
fields['instructions'] = 'To register, visit %s' % url
fields['oob']['url'] = url
reply.send()
async def _set_register(self, iq):
if not settings.ALLOW_REGISTRATION:
reply = iq.reply()
reply['error']['condition'] = 'not-allowed'
reply.send()
return
fields = iq['register']
try:
if fields.get_remove():
# delete registration
if 'mechanisms' not in self.stream.features:
raise XMPPError('forbidden')
username = self.stream.boundjid.user
await self.stream.roster_hook.delete_user()
self.stream.user_deleted()
elif 'mechanisms' in self.stream.features:
# update registration
username = fields['username']
if username != self.stream.boundjid.user:
raise XMPPError('bad-request')
password = fields['password']
if password != '':
await self.stream.roster_hook.change_password(password)
else:
# create registration
# TODO: try to avoid registration spam
username = fields['username']
password = fields['password']
if username == '' or password == '':
raise XMPPError('not-acceptable')
if not await self.stream.roster_hook.create_user(username, password):
raise XMPPError('conflict')
except Exception as e:
iq.exception(e)
return
iq.reply().send()
| 37.44186 | 85 | 0.551863 | 314 | 3,220 | 5.528662 | 0.305732 | 0.086406 | 0.024194 | 0.034562 | 0.19182 | 0.032258 | 0 | 0 | 0 | 0 | 0 | 0.005742 | 0.350932 | 3,220 | 85 | 86 | 37.882353 | 0.82488 | 0.045031 | 0 | 0.222222 | 0 | 0 | 0.088657 | 0 | 0 | 0 | 0 | 0.011765 | 0 | 1 | 0.027778 | false | 0.111111 | 0.069444 | 0 | 0.138889 | 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 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
d0e9c8d89e107aa99c5acdf27678f3378f56c8b0 | 514 | py | Python | ivo/ivo_frappe/doctype/colour_recipe/colour_recipe.py | peterzh/ivo_frappe | 56dbedb6d73953913ccc19f7609ce82482f607d9 | [
"MIT"
] | null | null | null | ivo/ivo_frappe/doctype/colour_recipe/colour_recipe.py | peterzh/ivo_frappe | 56dbedb6d73953913ccc19f7609ce82482f607d9 | [
"MIT"
] | null | null | null | ivo/ivo_frappe/doctype/colour_recipe/colour_recipe.py | peterzh/ivo_frappe | 56dbedb6d73953913ccc19f7609ce82482f607d9 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
# Copyright (c) 2021, Peter Zatka-Haas and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class Colourrecipe(Document):
def validate(self):
#Check that the proportions of child recipe items add up to 100%
recipe = self.as_dict()['recipe']
proportions = [x['proportion'] for x in recipe]
if sum(proportions) != 100.0:
frappe.throw('Proportions must sum to 100%!')
| 32.125 | 66 | 0.7393 | 73 | 514 | 5.123288 | 0.712329 | 0.026738 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.034483 | 0.153697 | 514 | 15 | 67 | 34.266667 | 0.825287 | 0.361868 | 0 | 0 | 0 | 0 | 0.139319 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | false | 0 | 0.333333 | 0 | 0.555556 | 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 | 0 | 1 | 0 | 0 | 2 |
d0ebce490d4171b4c33d284b733712d916de76d2 | 6,995 | py | Python | app/tests/test_functions.py | jiobu1/labspt15-cityspire-g-ds | 5e94db65008c51c8ca1448d236cb46bd74c022fc | [
"MIT"
] | null | null | null | app/tests/test_functions.py | jiobu1/labspt15-cityspire-g-ds | 5e94db65008c51c8ca1448d236cb46bd74c022fc | [
"MIT"
] | 31 | 2021-03-20T15:11:32.000Z | 2021-05-02T23:05:54.000Z | app/tests/test_functions.py | jiobu1/labspt15-cityspire-g-ds | 5e94db65008c51c8ca1448d236cb46bd74c022fc | [
"MIT"
] | 5 | 2021-05-01T00:02:34.000Z | 2021-05-04T01:47:49.000Z | import unittest
def parse_grades(grades_string):
GRADES = ['PK', 'K', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', 'Ungraded']
# Remove & for grades list
grades_string = grades_string.replace(' &', ',')
# Grades list - will add to separated grade string to grades
grades = []
# split strings based on ','
string_list = grades_string.split(',')
# look for sections of list with '-'
dash = "-"
for i in range(len(string_list)):
clean_string = string_list[i].strip()
if dash in clean_string:
# split using '-', loop and add to grades variable
start_grade, end_grade = clean_string.split(dash)
grades += GRADES[GRADES.index(start_grade) : GRADES.index(end_grade)+ 1]
else:
# add string to grades
grades.append(clean_string)
return grades
unique_grades_combination = ['9-12', '6-8', 'K-4', '5-8', '4-5', 'K-5', '4-6', '7-12', 'K-6',
'4-8', 'K-8', '1-6', 'PK-3', '6-12', 'K-3', 'PK-K', 'PK', 'PK-8',
'PK-6', '4-12', 'PK-6 & Ungraded', '1-8', 'K', 'PK-5', 'PK-12',
'7-11', '3-6', 'K-12', '3-8', '2-10', 'K-1, 5-8', 'PK-4',
'Ungraded', '1-12', '2-5', '3-5', '10-12', 'PK-1 & Ungraded',
'K-11', 'K-2', 'K-1', '9-10', 'K-7', '1-5', 'PK-1', 'PK-K, 2',
'PK-2', '7-8', 'PK-11', '9', 'K-9', '2-11', '2-12', '2-9', '8-12',
'K-10', 'PK & Ungraded', '7-9', '6', '5-6', '2, 5-6, 8-9, 11-12',
'11-12', '3-12', 'K-1, 3-4, 6-7, 9, 11', '1-11', '5-12', '6-10',
'11', '3-7', '7-10', 'PK-10', 'PK-12 & Ungraded', 'PK-9', '6-9',
'4-9', '9-11', '6-7', '5-12 & Ungraded', '8-11', '2-8',
'3, 5, 7-11', 'PK, 8', 'PK-7', '6, 9-12', '1-3', 'K-3, 5-10, 12',
'PK-8 & Ungraded', '5', '12', 'K-8, 10-12', '1-9', '1-5, 7-8',
'9, 12', '5-7', '8', '3-10', '1-12 & Ungraded', '5, 7-8, 10-12',
'PK, 1-4', '1-4', '3, 6-7, 10, 12', '3-4, 6, 9-12', '1-2', '8-9',
'4', 'PK-3, 5-7', 'K-1, 4, 6, 8', '5-10', '6-12 & Ungraded',
'6-11', 'K, 5-12', 'K-6, 8', 'PK-4 & Ungraded', 'PK-1, 3-5',
'PK-1, 3', '10-12 & Ungraded', 'K-3, 5-9, 11-12', 'PK-K, 2-4, 6-8',
'PK, 3-4', '1-7', '1-10', 'PK, 2', '2, 4, 7, 9-10, 12', 'PK, 1',
'1-3, 5, 8', '1-3, 5-6, 8', 'K, 3, 5-12', '4-11', 'K-4, 7-8',
'7-8, 10-12', 'PK, 1, 3-12', '7, 9-12', 'PK-2, 6, 8', '2-6',
'PK-8, 10-11', '2-3', '3-4', 'PK, 3-5', '3-9', 'PK-4, 6',
'PK, 1-6', 'PK-4, 8', 'PK-K, 9-12', '3-11', 'PK-3 & Ungraded',
'PK-3, 5-6', '2-7', '2-12 & Ungraded', 'PK-K, 2-7', '8-10', '2-4',
'PK-4, 6-8', 'PK-K, 3-5, 7', '7, 11', 'K-5, 7, 9-10, 12',
'PK-K, 2-4, 6 & Ungraded', '2', 'PK-7, 11', 'K, 2, 4-9, 12',
'PK-1, 4, 6', '9-12 & Ungraded', '4-6, 8', '2-4, 6, 9-12', '4-7',
'PK-3, 5-8', '1-2, 4-8', 'PK, 12', '10', '3-5, 9-10, 12', '5-11',
'2-3, 5, 10-12', '3-10, 12', 'K-12 & Ungraded', '4-10',
'PK-1, 3, 5', 'PK-1, 5, 7, 9', 'PK-K, 2-5', 'K, 2-7, 9',
'K-7, 9-12', '2, 6-7', '6-10, 12', 'K-5, 7-9, 11',
'2, 4, 6, 8, 10, 12', 'K-2, 4-12', 'PK, 7-12', '1, 3-4, 6-12',
'K-6, 8-11', '2-5, 7-12', '1, 4-10, 12', 'PK-2, 4, 6, 8',
'K-10, 12', '9 & Ungraded', 'PK-5 & Ungraded', 'PK-3, 5',
'1, 3-5, 7', 'PK, 2, 4-7, 9-10, 12', 'K, 2, 5-12', 'PK-4, 6-12',
'3', '4, 10', '2, 5-6, 8-12', 'K-6, 8-12', 'PK, 3-6, 8, 10, 12',
'K-3, 6-8', '3-9, 11-12', 'PK-5, 7-12', 'K, 2-4, 7-12', '1-4, 6-8',
'PK-3, 5-12', '1-3, 5-9', '1, 3-8', '9-11 & Ungraded', '5-9',
'K, 4-5, 7-8', 'PK, 1-5', '3-12 & Ungraded', 'K-8 & Ungraded',
'2-3, 5-8', '1-6, 9-12', 'PK-8, 10-12', 'PK-K, 4-8', 'K-1, 7-12',
'K-4, 6-7, 9-12', '9-10, 12', 'K-5, 7', 'K, 2-8', '1, 4, 7, 10-11',
'K, 2-3, 5-6', 'K-5, 7, 11-12', '7', 'PK-4, 7-12', 'K-9, 11-12',
'K-4, 6-8, 10', '1, 3-5, 7-12', 'K-2, 5-7', 'K, 3, 6-8, 10, 12',
'K, 3, 7-8, 12', 'PK, 9-12', 'K-2, 4-10, 12', '12 & Ungraded',
'PK-6, 8-10', 'PK-1, 3-8', '1, 3', 'K-8, 12', '3-4, 6-9, 12',
'5, 7-8', 'PK-K, 2-3', 'K-1, 3-12', '1, 5-9, 12', '5, 7-8, 10-11',
'PK-5, 7-8', '4, 7, 10-12', 'PK-1, 3-4', 'PK-2, 4-6', 'K-8, 10',
'10-11', '6, 9', 'PK-2, 4', 'K-4, 6', 'K-2, 6-7, 12', 'PK-6, 8',
'3-4, 7, 10-12', '1, 3-7', 'K-5, 8', '2, 4-5, 7, 9-11',
'1-3, 5, 7-8', '1-2, 9-12', 'K-1, 3-5, 7-8', 'K, 2-8, 10',
'PK, 1-3, 6', '7-8, 10-11', '7, 10-12', '3, 5, 8-9, 11-12',
'1-3, 5', 'K-5, 7-12', '1-7, 9-10, 12', '2, 4-8', 'K-3, 6-12',
'PK, 5-8', '6-8, 10', 'PK-5, 7', 'PK, 1, 5', 'PK, 1-4, 6',
'3, 5, 10, 12', 'PK-6, 8-12', '4-5, 7-12', 'PK-1, 6-7, 9-11',
'2-7, 9-11', 'K-1, 6, 8, 11', '7, 9, 11-12', '1-3, 5-10',
'K-5, 7-9', '1', 'K-5, 7-11', '7-12 & Ungraded', '1-6 & Ungraded',
'3, 12', 'PK-8, 11', 'K-5, 7-9, 12', 'K-1, 4, 7-9, 11',
'1-2, 4-12', 'PK-9, 11-12']
class TestParseGrades(unittest.TestCase):
def test_join_string_grades_success(self):
actual = parse_grades('2, 4, 6, 8, 10, 12')
expected = ['2','4','6','8','10','12']
self.assertEqual(actual, expected)
def test_parse_grades_success(self):
actual = parse_grades('K-4')
expected = ['K', '1', '2', '3', '4']
self.assertEqual(actual, expected)
def test_multiple_separators(self):
actual = parse_grades('2-4, 6, 9-12')
expected = ['2', '3', '4', '6', '9', '10', '11', '12']
self.assertEqual(actual, expected)
def test_grades_list_with_ampersand(self):
actual = parse_grades('6-12 & Ungraded')
expected = ['6', '7', '8', '9', '10', '11', '12', 'Ungraded']
self.assertEqual(actual, expected)
def test_small_lists(self):
actual = parse_grades('PK-K')
expected = ['PK', 'K']
self.assertEqual(actual, expected)
def test_multiple_separators2(self):
actual = parse_grades('PK-K, 2-4, 6 & Ungraded')
expected = ['PK', 'K', '2', '3', '4', '6', 'Ungraded']
self.assertEqual(actual, expected)
def test_multiple_separators3(self):
actual = parse_grades('5-10')
expected = ['5', '6', '7', '8', '9', '10']
self.assertEqual(actual, expected)
def test_multiple_separators4(self):
actual = parse_grades('K, 5-12')
expected = ['K', '5', '6', '7', '8', '9', '10', '11', '12']
self.assertEqual(actual, expected)
def test_multiple_separators5(self):
actual = parse_grades( 'PK-3, 5-7')
expected = ['PK', 'K', '1', '2', '3', '5', '6', '7']
self.assertEqual(actual, expected)
def test_complete_dataset(self):
# create a loop that goes thru dataset and invoke parse_grades with each element
# used this to create dictionary of grade combo and parsed_grades
separated_grades_list = []
for i in unique_grades_combination:
separated_grades_list.append(parse_grades(i))
return separated_grades_list | 49.609929 | 99 | 0.455039 | 1,351 | 6,995 | 2.3094 | 0.068098 | 0.019872 | 0.010577 | 0.060577 | 0.298397 | 0.234936 | 0.147115 | 0.040705 | 0.027564 | 0.027564 | 0 | 0.208038 | 0.253038 | 6,995 | 141 | 100 | 49.609929 | 0.389091 | 0.051322 | 0 | 0.078261 | 0 | 0 | 0.392275 | 0 | 0 | 0 | 0 | 0 | 0.078261 | 1 | 0.095652 | false | 0 | 0.008696 | 0 | 0.130435 | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
d0f20dcb700e2354cf804011863e22d7063ac144 | 64 | py | Python | python/import/obj/district/margahayu.py | dudung/cookbook | 8a43a923af8367dafd04e3dd2ef6b9e7ed82b22f | [
"MIT"
] | null | null | null | python/import/obj/district/margahayu.py | dudung/cookbook | 8a43a923af8367dafd04e3dd2ef6b9e7ed82b22f | [
"MIT"
] | null | null | null | python/import/obj/district/margahayu.py | dudung/cookbook | 8a43a923af8367dafd04e3dd2ef6b9e7ed82b22f | [
"MIT"
] | null | null | null | level = 3
name = 'Margahayu'
capital = 'Sukamenak'
area = 10.54
| 12.8 | 21 | 0.671875 | 9 | 64 | 4.777778 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.096154 | 0.1875 | 64 | 4 | 22 | 16 | 0.730769 | 0 | 0 | 0 | 0 | 0 | 0.28125 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 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 | 2 |
d0feef784c515c82543ab823a3ca3ebf74cdfc94 | 343 | py | Python | todo/views.py | vollov/django-todo-rest | 5a1d10fd4d55e6fa1399552496023b7388e3baab | [
"MIT"
] | null | null | null | todo/views.py | vollov/django-todo-rest | 5a1d10fd4d55e6fa1399552496023b7388e3baab | [
"MIT"
] | null | null | null | todo/views.py | vollov/django-todo-rest | 5a1d10fd4d55e6fa1399552496023b7388e3baab | [
"MIT"
] | null | null | null | #from django.shortcuts import render
from rest_framework import viewsets
# Create your views here.
from todo.models import Todo
from todo.serializers import TodoSerializer
#from django.conf import settings
class TodoViewSet(viewsets.ModelViewSet):
queryset = Todo.objects.all().order_by('-created')
serializer_class = TodoSerializer
| 28.583333 | 54 | 0.804665 | 43 | 343 | 6.348837 | 0.651163 | 0.07326 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.125364 | 343 | 11 | 55 | 31.181818 | 0.91 | 0.265306 | 0 | 0 | 0 | 0 | 0.032129 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 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 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
ef73870702f1b4c263bac162d3c08a67390d28a4 | 437 | py | Python | src/geo_regions/admin.py | evis-market/web-interface-backend | f8930ff1c009ad18e522ab29680b4bcd50a6020e | [
"MIT"
] | 2 | 2021-08-30T22:58:32.000Z | 2021-12-12T10:47:52.000Z | src/geo_regions/admin.py | evis-market/web-interface-backend | f8930ff1c009ad18e522ab29680b4bcd50a6020e | [
"MIT"
] | null | null | null | src/geo_regions/admin.py | evis-market/web-interface-backend | f8930ff1c009ad18e522ab29680b4bcd50a6020e | [
"MIT"
] | 1 | 2021-08-22T19:12:44.000Z | 2021-08-22T19:12:44.000Z | from django.contrib import admin
from django_admin_listfilter_dropdown.filters import RelatedDropdownFilter
from mptt.admin import MPTTModelAdmin
from geo_regions.models import GeoRegion
class GeoRegionAdmin(MPTTModelAdmin):
list_display = ('name', 'iso_code', 'parent')
list_filter = (
('parent', RelatedDropdownFilter),
)
search_fields = ('name', 'iso_code')
admin.site.register(GeoRegion, GeoRegionAdmin)
| 25.705882 | 74 | 0.762014 | 47 | 437 | 6.893617 | 0.595745 | 0.061728 | 0.067901 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.146453 | 437 | 16 | 75 | 27.3125 | 0.868633 | 0 | 0 | 0 | 0 | 0 | 0.08238 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.363636 | 0 | 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 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
ef9ca7a2781a3926adc3f5584031e97112ce7a29 | 195 | py | Python | tests/management/commands/subcommands/nested.py | CptLemming/django-subcommand | 0d1c04b4150b2e44961b9da535b4d582c0fb7dce | [
"BSD-3-Clause"
] | 1 | 2016-01-26T13:57:37.000Z | 2016-01-26T13:57:37.000Z | tests/management/commands/subcommands/nested.py | CptLemming/django-subcommand | 0d1c04b4150b2e44961b9da535b4d582c0fb7dce | [
"BSD-3-Clause"
] | 1 | 2016-01-26T10:54:08.000Z | 2016-01-26T12:20:46.000Z | tests/management/commands/subcommands/nested.py | CptLemming/django-subcommand | 0d1c04b4150b2e44961b9da535b4d582c0fb7dce | [
"BSD-3-Clause"
] | null | null | null | from subcommand.base import SubcommandCommand
from .sub import MySubcommand
class NestedCommand(SubcommandCommand):
help = 'Nested'
subcommands = {
'sub': MySubcommand,
}
| 16.25 | 45 | 0.702564 | 17 | 195 | 8.058824 | 0.705882 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.220513 | 195 | 11 | 46 | 17.727273 | 0.901316 | 0 | 0 | 0 | 0 | 0 | 0.046154 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.285714 | 0 | 0.714286 | 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 | 0 | 0 | 1 | 0 | 0 | 2 |
ef9f02069cc7528ba6fd80db7e139f0e69a5a476 | 365 | py | Python | http451/management/commands/cleanall.py | cyberstormdotmu/django-http-451 | 80eb46d2561c4b87484d70830f9ab2dc0b9ef000 | [
"BSD-3-Clause"
] | null | null | null | http451/management/commands/cleanall.py | cyberstormdotmu/django-http-451 | 80eb46d2561c4b87484d70830f9ab2dc0b9ef000 | [
"BSD-3-Clause"
] | null | null | null | http451/management/commands/cleanall.py | cyberstormdotmu/django-http-451 | 80eb46d2561c4b87484d70830f9ab2dc0b9ef000 | [
"BSD-3-Clause"
] | null | null | null | from django.core.management.base import BaseCommand, CommandError
class Command(BaseCommand):
help = 'Clean all entries for http451'
def add_arguments(self, parser):
pass
# parser.add_argument('dump', nargs='+', type=int)
def handle(self, *args, **options):
self.stdout.write(self.style.ERROR('Command not yet implemented'))
| 28.076923 | 74 | 0.684932 | 45 | 365 | 5.511111 | 0.822222 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.010169 | 0.191781 | 365 | 12 | 75 | 30.416667 | 0.830508 | 0.131507 | 0 | 0 | 0 | 0 | 0.177778 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.285714 | false | 0.142857 | 0.142857 | 0 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
efaaba7e124c79c9a7ba5c71d44d748b76534168 | 606 | py | Python | 02-block-ciphers/helpers.py | mithi/simple-cryptography | 13559f8b4dd9da2545e6f8b3564fda5e33ae7410 | [
"MIT"
] | 49 | 2019-03-16T06:26:36.000Z | 2022-03-13T17:21:11.000Z | basic-cryptography-scripts/basic-cryptography-scripts/02-block-ciphers/helpers.py | paulveillard/cybersecurity-cryptography | f081a793130550c68ef668b561f653c21231d5dc | [
"Apache-2.0"
] | 8 | 2019-03-11T05:11:51.000Z | 2019-03-15T18:12:30.000Z | basic-cryptography-scripts/basic-cryptography-scripts/02-block-ciphers/helpers.py | paulveillard/cybersecurity-cryptography | f081a793130550c68ef668b561f653c21231d5dc | [
"Apache-2.0"
] | 11 | 2019-03-31T06:09:22.000Z | 2022-03-13T17:21:12.000Z | from cryptography.hazmat.primitives.ciphers.algorithms import AES
from cryptography.hazmat.primitives.ciphers import modes, Cipher
from cryptography.hazmat.backends import default_backend
def xor(x, y):
# assert len(x) == len(y)
a = int.from_bytes(x, "big")
b = int.from_bytes(y, "big")
return (a ^ b).to_bytes(len(x), "big")
def AES_DECRYPT(key):
cipher = Cipher(AES(key), modes.ECB(), backend=default_backend())
return cipher.decryptor().update
def AES_ENCRYPT(key):
cipher = Cipher(AES(key), modes.ECB(), backend=default_backend())
return cipher.encryptor().update
| 28.857143 | 69 | 0.709571 | 86 | 606 | 4.906977 | 0.383721 | 0.113744 | 0.156398 | 0.151659 | 0.478673 | 0.293839 | 0.293839 | 0.293839 | 0.293839 | 0.293839 | 0 | 0 | 0.148515 | 606 | 20 | 70 | 30.3 | 0.817829 | 0.037954 | 0 | 0.153846 | 0 | 0 | 0.015491 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.230769 | false | 0 | 0.230769 | 0 | 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 | 0 | 1 | 0 | 0 | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.