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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
03c611fb4f50a42c6f79fa67871d099851e47dda | 107 | py | Python | testtakepicture.py | 1082sqnatc/missionspacelab2019 | 439753c8e309ece98963f58c9bb443217e75364e | [
"Apache-2.0"
] | null | null | null | testtakepicture.py | 1082sqnatc/missionspacelab2019 | 439753c8e309ece98963f58c9bb443217e75364e | [
"Apache-2.0"
] | 12 | 2019-12-01T15:52:08.000Z | 2020-02-02T13:52:36.000Z | testtakepicture.py | 1082sqnatc/missionspacelab2019 | 439753c8e309ece98963f58c9bb443217e75364e | [
"Apache-2.0"
] | null | null | null | from src.takepicture import takePicture
x=1
while x < 10:
takePicture(x)
print("success")
x=x+1 | 17.833333 | 39 | 0.672897 | 17 | 107 | 4.235294 | 0.588235 | 0.333333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.047619 | 0.214953 | 107 | 6 | 40 | 17.833333 | 0.809524 | 0 | 0 | 0 | 0 | 0 | 0.064815 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.166667 | 0 | 0.166667 | 0.166667 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
03d3ac7a4d3e7b410abc26d86dafcac236ceca0f | 337 | py | Python | app/bot/types.py | DramatikMan/mlhl-01-python-bot | ab65432781db8bb5b0ff3b698514a14393809360 | [
"MIT"
] | null | null | null | app/bot/types.py | DramatikMan/mlhl-01-python-bot | ab65432781db8bb5b0ff3b698514a14393809360 | [
"MIT"
] | null | null | null | app/bot/types.py | DramatikMan/mlhl-01-python-bot | ab65432781db8bb5b0ff3b698514a14393809360 | [
"MIT"
] | null | null | null | from typing import Any
from telegram.ext import CallbackContext, Dispatcher
CCT = CallbackContext[
dict[Any, Any],
dict[Any, Any],
dict[Any, Any]
]
DP = Dispatcher[
CCT,
dict[Any, Any],
dict[Any, Any],
dict[Any, Any]
]
DataRecord = tuple[
int, int, int, int, int, int, int, int, int, str, str, float
]
| 16.85 | 64 | 0.626113 | 47 | 337 | 4.489362 | 0.340426 | 0.227488 | 0.298578 | 0.341232 | 0.412322 | 0.412322 | 0.412322 | 0.412322 | 0.28436 | 0 | 0 | 0 | 0.240356 | 337 | 19 | 65 | 17.736842 | 0.824219 | 0 | 0 | 0.375 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.125 | 0 | 0.125 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
03ecb8a44ff3c3e66ce134246974ad0988fe8e8e | 1,242 | py | Python | examples/tempy_examples.py | NinoDoko/TemPy | c6bdd4c12ae1a4a5db6a852295f7f758b7dc595a | [
"Apache-2.0"
] | null | null | null | examples/tempy_examples.py | NinoDoko/TemPy | c6bdd4c12ae1a4a5db6a852295f7f758b7dc595a | [
"Apache-2.0"
] | null | null | null | examples/tempy_examples.py | NinoDoko/TemPy | c6bdd4c12ae1a4a5db6a852295f7f758b7dc595a | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
import json
import os
from flask import Flask
app = Flask(__name__)
@app.route('/')
def none_handler():
from templates.homepage import page
return page.render()
@app.route('/hello_world')
def hello_world_handler():
from templates.hello_world import page
return page.render()
@app.route('/star_wars')
def star_wars_handler():
from templates.star_wars import page
json_filename = os.path.join(app.static_folder, 'sw-people.json')
with open(json_filename, 'r') as f:
people = json.load(f)['characters']
return page.render(characters=people)
@app.route('/list')
def render_list_handler():
from templates.render_list import page
return page.render()
@app.route('/static')
def static_files_handler():
from templates.static_files import page
return page.render()
@app.route('/table')
def table_handler():
from templates.table_example import page
return page.render()
@app.route('/css')
def css_handler():
from templates.css_example import page
return page.render()
@app.route('/homepage')
def homepage_handler():
from templates.homepage import page
return page.render()
if __name__ == '__main__':
app.run(port=8888, debug=True)
| 22.581818 | 69 | 0.706924 | 171 | 1,242 | 4.929825 | 0.28655 | 0.075919 | 0.189798 | 0.166074 | 0.355872 | 0.355872 | 0.355872 | 0.225386 | 0.128114 | 0 | 0 | 0.004812 | 0.163446 | 1,242 | 54 | 70 | 23 | 0.806545 | 0.016908 | 0 | 0.219512 | 0 | 0 | 0.07137 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.195122 | false | 0 | 0.268293 | 0 | 0.658537 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
ff0c4addd4684de4de158e744b10372828e5a73b | 99 | py | Python | globals/__init__.py | anmartinezs/pyseg | f991d8826e8d4e1eff70064183cb79425b7e9109 | [
"Apache-2.0"
] | 1 | 2018-09-11T17:10:52.000Z | 2018-09-11T17:10:52.000Z | globals/__init__.py | anmartinezs/pyseg | f991d8826e8d4e1eff70064183cb79425b7e9109 | [
"Apache-2.0"
] | null | null | null | globals/__init__.py | anmartinezs/pyseg | f991d8826e8d4e1eff70064183cb79425b7e9109 | [
"Apache-2.0"
] | null | null | null | __author__ = 'martinez'
import vtk
import numpy as np
from variables import *
from utils import * | 14.142857 | 23 | 0.767677 | 14 | 99 | 5.142857 | 0.714286 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.181818 | 99 | 7 | 24 | 14.142857 | 0.888889 | 0 | 0 | 0 | 0 | 0 | 0.08 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.8 | 0 | 0.8 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
ff109f1e8d0d2b14f171554da2663b60fd683a02 | 495 | py | Python | practice/aboutfunctions.py | mrElnekave/Hallow-Valley | 6c3ba0dc3932839941a00362da0212850b2b20a6 | [
"MIT"
] | null | null | null | practice/aboutfunctions.py | mrElnekave/Hallow-Valley | 6c3ba0dc3932839941a00362da0212850b2b20a6 | [
"MIT"
] | null | null | null | practice/aboutfunctions.py | mrElnekave/Hallow-Valley | 6c3ba0dc3932839941a00362da0212850b2b20a6 | [
"MIT"
] | null | null | null | def create_path(path:str):
"""
:param path:path is the relative path from the pixel images folder
:return: return the relative path from roots of project
"""
return current_path + path
#a function name is before the parameters and after the def
#function parameters: the values that the function knows, inside the parantheses
#function typehinting: tells the code that it should be a string...
#docstrings: tells what the function does, what parameters are, what it returns | 49.5 | 80 | 0.753535 | 75 | 495 | 4.946667 | 0.546667 | 0.06469 | 0.080863 | 0.102426 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.189899 | 495 | 10 | 81 | 49.5 | 0.925187 | 0.818182 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.5 | false | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
2072a741b04f9c964e7ed9b4b5f47b7e8423121d | 3,628 | py | Python | cubam/MajorityModel.py | welinder/cubam | fe5ba700f1adbb489c69af311558d64370d73d36 | [
"BSD-3-Clause-Clear"
] | 20 | 2015-01-10T02:53:44.000Z | 2022-03-20T18:10:15.000Z | cubam/MajorityModel.py | afcarl/cubam | fe5ba700f1adbb489c69af311558d64370d73d36 | [
"BSD-3-Clause-Clear"
] | 1 | 2019-01-30T17:02:51.000Z | 2019-01-30T17:02:51.000Z | cubam/MajorityModel.py | afcarl/cubam | fe5ba700f1adbb489c69af311558d64370d73d36 | [
"BSD-3-Clause-Clear"
] | 12 | 2016-02-22T02:43:55.000Z | 2021-09-19T20:50:09.000Z | from BinaryModel import *
from numpy.random import rand
class MajorityModel(BinaryModel):
def __init__(self, filename=None):
self.mdlPrm = {
'addNoise' : False,
}
self.wkrIds = {}
self.imgIds = {}
if filename:
self.load_data(filename)
else:
self._setup_prior()
def __del__(self):
pass
def load_data(self, filename, skipyaml=False):
"""
Data is assumed to be in the format:
imageId workerId label
"""
# load the text data
filein = open(filename)
info = filein.readline().rstrip().split(' ')
self.numLbls = int(info[2])
self.numWkrs = int(info[1])
self.numImgs = int(info[0])
self.imgPrm = []
for i in range(self.numImgs):
self.imgPrm.append([0, 0]) # (frac +ve votes, total n votes)
self.wkrLbls = dict((id, []) for id in range(self.numWkrs))
self.imgLbls = dict((id, []) for id in range(self.numImgs))
self.labels = []
for (lino, line) in enumerate(filein):
cols = [int(c) for c in line.rstrip().split(' ')]
iId = cols[0]; wId = cols[1]; lij = int(cols[2]==1)
self.wkrLbls[wId].append([iId, lij])
self.imgLbls[iId].append([wId, lij])
self.labels.append((iId, wId, lij))
self.imgPrm[iId][0] += lij
self.imgPrm[iId][1] += 1
# renormalize img prm
for i in range(len(self.imgPrm)):
self.imgPrm[i][0] = float(self.imgPrm[i][0])/self.imgPrm[i][1]
def get_num_wkrs(self):
return self.numWkrs
def get_num_imgs(self):
return self.numImgs
def get_num_lbls(self):
return self.numLbls
def set_model_param(self, raw=[], prm=None):
"""
Sets model parameters.
Arguments:
- `raw`: raw parameter vector
- `prm`: hash of model parameter values to be changed
"""
if not prm is None:
for (k, v) in prm.iteritems():
self.mdlPrm[k] = v
def set_worker_param(self, raw):
pass
def set_image_param(self, raw):
self.imgPrm = [r for r in raw]
def get_model_param(self):
return {}
def get_worker_param_raw(self):
return {}
def get_image_param_raw(self):
return [p for p in self.imgPrm]
def get_worker_param(self, id=None):
return {}
def get_image_param(self, id=None):
return [p for p in self.imgPrm]
def get_labels(self):
if self.mdlPrm['addNoise']:
return [int((self.imgPrm[i][0]+(rand()-.5)/self.imgPrm[i][1])>.5)\
for i in range(len(self.imgPrm))]
else:
return [int(self.imgPrm[i][0]>.5) for i \
in range(len(self.imgPrm))]
# TODO: load and save parameters
def optimize_worker_param(self):
pass
def optimize_image_param(self):
pass
def objective(self, prm=None):
pass
def image_objective(self, prm=None):
pass
def image_objective_range(self, imgId, prm):
pass
def worker_objective_range(self, wkrId, prm):
pass
def gradient(self, prm=None):
return []
def worker_gradient(self, prm=None):
return []
def image_gradient(self, prm=None):
pass
def get_num_wkr_lbls(self):
return [len(self.wkrLbls[id]) for id in range(self.numWkrs)]
def get_num_img_lbls(self):
return [len(self.imgLbls[id]) for id in range(self.numImgs)]
| 27.484848 | 78 | 0.5543 | 476 | 3,628 | 4.111345 | 0.243697 | 0.081758 | 0.033725 | 0.022483 | 0.304037 | 0.210015 | 0.159939 | 0.092489 | 0.029637 | 0 | 0 | 0.008512 | 0.320011 | 3,628 | 131 | 79 | 27.694656 | 0.784759 | 0.078556 | 0 | 0.2 | 0 | 0 | 0.00552 | 0 | 0 | 0 | 0 | 0.007634 | 0 | 1 | 0.288889 | false | 0.1 | 0.022222 | 0.133333 | 0.477778 | 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 | 1 | 0 | 0 | 0 | 3 |
207dbca61480d6630a2424d70a7f583f2e795a69 | 263 | py | Python | main/__init__.py | graingert/LiteBot | 8ce84fb9e150e532adc4d5c549b0c04f208ba20c | [
"MIT"
] | null | null | null | main/__init__.py | graingert/LiteBot | 8ce84fb9e150e532adc4d5c549b0c04f208ba20c | [
"MIT"
] | null | null | null | main/__init__.py | graingert/LiteBot | 8ce84fb9e150e532adc4d5c549b0c04f208ba20c | [
"MIT"
] | null | null | null | from main import status, tps, server_commands, scoreboard
def setup(bot):
bot.add_cog(status.Status(bot), True)
bot.add_cog(tps.Tps(bot), True)
bot.add_cog(server_commands.ServerCommands(bot), True)
bot.add_cog(scoreboard.ScoreBoard(bot), True)
| 29.222222 | 58 | 0.737643 | 40 | 263 | 4.7 | 0.375 | 0.12766 | 0.191489 | 0.207447 | 0.255319 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.13308 | 263 | 8 | 59 | 32.875 | 0.824561 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.166667 | 0 | 0.333333 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
20a31ef74c9a035d85a87d60cf973255e1f7ccbd | 349 | py | Python | backend/app/app/models/__init__.py | benlau6/fastapi-fullstack | 68a46d576310a1c846315228c1251f36ea23f056 | [
"MIT"
] | 1 | 2022-01-29T07:53:35.000Z | 2022-01-29T07:53:35.000Z | backend/app/app/models/__init__.py | benlau6/fastapi-fullstack | 68a46d576310a1c846315228c1251f36ea23f056 | [
"MIT"
] | null | null | null | backend/app/app/models/__init__.py | benlau6/fastapi-fullstack | 68a46d576310a1c846315228c1251f36ea23f056 | [
"MIT"
] | null | null | null | from .team import Team, TeamRead, TeamCreate, TeamUpdate # , TeamReadWithHeroes
from .hero import Hero, HeroRead, HeroCreate, HeroUpdate # , HeroReadWithTeam
from typing import List, Optional
class TeamReadWithHeroes(TeamRead):
heroes: List[HeroRead] = []
class HeroReadWithTeam(HeroRead):
team: Optional[TeamRead] = None
| 26.846154 | 81 | 0.733524 | 34 | 349 | 7.529412 | 0.529412 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.183381 | 349 | 12 | 82 | 29.083333 | 0.898246 | 0.111748 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.428571 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
20b2e3e32b7c66d0208f3258b3c38daa89dc0d38 | 297 | py | Python | test/sysinfo_test.py | peitur/docker-util | 6579c59b809a3dab80c440baa5fabc669cf88b9b | [
"Apache-2.0"
] | 1 | 2016-05-19T13:43:21.000Z | 2016-05-19T13:43:21.000Z | test/sysinfo_test.py | peitur/docker-util | 6579c59b809a3dab80c440baa5fabc669cf88b9b | [
"Apache-2.0"
] | 1 | 2020-11-23T10:21:16.000Z | 2020-11-23T10:25:16.000Z | test/sysinfo_test.py | peitur/docker-util | 6579c59b809a3dab80c440baa5fabc669cf88b9b | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/python3
import sys,os,re
sys.path.append( "../lib" )
sys.path.append( "./lib" )
import Controller
import unittest
from pprint import pprint
class SysinfoTest( unittest.TestCase ):
def test_configuration( self ):
pass
def test_information( self ):
pass
| 13.5 | 39 | 0.666667 | 37 | 297 | 5.297297 | 0.621622 | 0.071429 | 0.132653 | 0.163265 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.00431 | 0.218855 | 297 | 21 | 40 | 14.142857 | 0.840517 | 0.057239 | 0 | 0.181818 | 0 | 0 | 0.039427 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.181818 | false | 0.181818 | 0.363636 | 0 | 0.636364 | 0.090909 | 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 | 1 | 0 | 0 | 0 | 0 | 3 |
20c08cb1cb00cfdd681c8e68fa79bcb41a100fd8 | 108 | py | Python | code/arc012_1_01.py | KoyanagiHitoshi/AtCoder | 731892543769b5df15254e1f32b756190378d292 | [
"MIT"
] | 3 | 2019-08-16T16:55:48.000Z | 2021-04-11T10:21:40.000Z | code/arc012_1_01.py | KoyanagiHitoshi/AtCoder | 731892543769b5df15254e1f32b756190378d292 | [
"MIT"
] | null | null | null | code/arc012_1_01.py | KoyanagiHitoshi/AtCoder | 731892543769b5df15254e1f32b756190378d292 | [
"MIT"
] | null | null | null | d=({"Saturday":0,"Sunday":0,"Monday":5,"Tuesday":4,"Wednesday":3,"Thursday":2,"Friday":1})
print(d[input()]) | 54 | 90 | 0.638889 | 18 | 108 | 3.833333 | 0.888889 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.065421 | 0.009259 | 108 | 2 | 91 | 54 | 0.579439 | 0 | 0 | 0 | 0 | 0 | 0.458716 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.5 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
20d1c04ac4717063c357eb5f6d023fd7588ec86e | 279 | py | Python | dataset/classification_datasets/__init__.py | JetBrains-Research/contrastive-learning-framework | f213ba2928677e46f7c3938afc96cbbdc64ed77c | [
"MIT"
] | 4 | 2020-12-25T10:00:01.000Z | 2022-03-17T21:09:37.000Z | dataset/classification_datasets/__init__.py | JetBrains-Research/contrastive-learning-framework | f213ba2928677e46f7c3938afc96cbbdc64ed77c | [
"MIT"
] | 4 | 2021-03-12T09:50:20.000Z | 2021-05-07T17:59:20.000Z | dataset/classification_datasets/__init__.py | JetBrains-Research/contrastive-learning-framework | f213ba2928677e46f7c3938afc96cbbdc64ed77c | [
"MIT"
] | 1 | 2022-03-17T21:09:41.000Z | 2022-03-17T21:09:41.000Z | from .code_transformer_dataset import CodeTransformerDataset
from .graph_dataset import GraphDataset
from .path_dataset import PathDataset
from .text_dataset import TextDataset
__all__ = [
"TextDataset",
"PathDataset",
"GraphDataset",
"CodeTransformerDataset"
]
| 23.25 | 60 | 0.78853 | 26 | 279 | 8.115385 | 0.5 | 0.246446 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.146953 | 279 | 11 | 61 | 25.363636 | 0.886555 | 0 | 0 | 0 | 0 | 0 | 0.200717 | 0.078853 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 0.4 | 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 | 1 | 0 | 0 | 0 | 0 | 3 |
20dd4926d6dbb2603389704c797b5810776b1bfd | 596 | py | Python | src/python/web/handler/status.py | AlekLT/seedsync | d370a94253384e1e6e5caa5fcd44692f1d1f1ce3 | [
"Apache-2.0"
] | 255 | 2017-12-25T00:53:40.000Z | 2022-03-27T10:29:21.000Z | src/python/web/handler/status.py | AlekLT/seedsync | d370a94253384e1e6e5caa5fcd44692f1d1f1ce3 | [
"Apache-2.0"
] | 111 | 2018-01-04T10:35:49.000Z | 2022-03-29T15:12:52.000Z | src/python/web/handler/status.py | AlekLT/seedsync | d370a94253384e1e6e5caa5fcd44692f1d1f1ce3 | [
"Apache-2.0"
] | 53 | 2017-12-25T09:34:19.000Z | 2022-03-15T17:53:27.000Z | # Copyright 2017, Inderpreet Singh, All rights reserved.
from bottle import HTTPResponse
from common import Status, overrides
from ..web_app import IHandler, WebApp
from ..serialize import SerializeStatusJson
class StatusHandler(IHandler):
def __init__(self, status: Status):
self.__status = status
@overrides(IHandler)
def add_routes(self, web_app: WebApp):
web_app.add_handler("/server/status", self.__handle_get_status)
def __handle_get_status(self):
out_json = SerializeStatusJson.status(self.__status)
return HTTPResponse(body=out_json)
| 28.380952 | 71 | 0.746644 | 72 | 596 | 5.861111 | 0.486111 | 0.094787 | 0.075829 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.008114 | 0.172819 | 596 | 20 | 72 | 29.8 | 0.84787 | 0.090604 | 0 | 0 | 0 | 0 | 0.025926 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.230769 | false | 0 | 0.307692 | 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 | 1 | 0 | 1 | 0 | 0 | 3 |
20ec501020c2772aa4720af36c66feb8ad8012c1 | 817 | py | Python | blin/config.py | cyber-chuvash/blinBlinskiyNoviyGod | b4dab1c254194579636aa7db18dd49203e60e381 | [
"MIT"
] | null | null | null | blin/config.py | cyber-chuvash/blinBlinskiyNoviyGod | b4dab1c254194579636aa7db18dd49203e60e381 | [
"MIT"
] | null | null | null | blin/config.py | cyber-chuvash/blinBlinskiyNoviyGod | b4dab1c254194579636aa7db18dd49203e60e381 | [
"MIT"
] | null | null | null | import json
import logging
import os
class _JsonConfig:
def __init__(self):
self._conf = \
json.loads(open(os.path.join(os.path.abspath(os.path.dirname(__file__)), '../config.json'), 'r').read())
@property
def log_level(self):
return logging.getLevelName(self._conf.get('log_level', 'INFO'))
def __getattr__(self, item):
return self._conf[item]
class _EnvConfig:
@property
def log_level(self):
return logging.getLevelName(os.environ.get('LOG_LEVEL', 'INFO'))
@property
def checkpoints(self):
return os.environ.get('CHECKPOINTS', '60,30,10,5,4,3,2,1').split(',')
def __getattr__(self, item):
return os.environ[item.upper()]
try:
Config = _JsonConfig()
except FileNotFoundError:
Config = _EnvConfig()
| 20.425 | 116 | 0.640147 | 102 | 817 | 4.862745 | 0.441176 | 0.064516 | 0.056452 | 0.076613 | 0.290323 | 0.193548 | 0.193548 | 0.193548 | 0 | 0 | 0 | 0.017081 | 0.21175 | 817 | 39 | 117 | 20.948718 | 0.753106 | 0 | 0 | 0.28 | 0 | 0 | 0.087117 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.24 | false | 0 | 0.12 | 0.2 | 0.64 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
20ef0d8c7ddd5cae1764648c947491c9f4c7cb34 | 10,524 | py | Python | code/vendor/node_js2c.py | thorium-cfx/fivem | 587eb7c12066a2ebf8631bde7bb39ee2df1b5a0c | [
"MIT"
] | 5,411 | 2017-04-14T08:57:56.000Z | 2022-03-30T19:35:15.000Z | code/vendor/node_js2c.py | thorium-cfx/fivem | 587eb7c12066a2ebf8631bde7bb39ee2df1b5a0c | [
"MIT"
] | 802 | 2017-04-21T14:18:36.000Z | 2022-03-31T21:20:48.000Z | code/vendor/node_js2c.py | thorium-cfx/fivem | 587eb7c12066a2ebf8631bde7bb39ee2df1b5a0c | [
"MIT"
] | 2,011 | 2017-04-14T09:44:15.000Z | 2022-03-31T15:40:39.000Z | import os
import subprocess
import sys
inputs = [
'lib/assert/strict.js',
'lib/assert.js',
'lib/async_hooks.js',
'lib/buffer.js',
'lib/child_process.js',
'lib/cluster.js',
'lib/console.js',
'lib/constants.js',
'lib/crypto.js',
'lib/dgram.js',
'lib/diagnostics_channel.js',
'lib/dns/promises.js',
'lib/dns.js',
'lib/domain.js',
'lib/events.js',
'lib/fs/promises.js',
'lib/fs.js',
'lib/http.js',
'lib/http2.js',
'lib/https.js',
'lib/inspector.js',
'lib/internal/abort_controller.js',
'lib/internal/assert/assertion_error.js',
'lib/internal/assert/calltracker.js',
'lib/internal/assert.js',
'lib/internal/async_hooks.js',
'lib/internal/blob.js',
'lib/internal/blocklist.js',
'lib/internal/bootstrap/environment.js',
'lib/internal/bootstrap/loaders.js',
'lib/internal/bootstrap/node.js',
'lib/internal/bootstrap/pre_execution.js',
'lib/internal/bootstrap/switches/does_not_own_process_state.js',
'lib/internal/bootstrap/switches/does_own_process_state.js',
'lib/internal/bootstrap/switches/is_main_thread.js',
'lib/internal/bootstrap/switches/is_not_main_thread.js',
'lib/internal/buffer.js',
'lib/internal/child_process/serialization.js',
'lib/internal/child_process.js',
'lib/internal/cli_table.js',
'lib/internal/cluster/child.js',
'lib/internal/cluster/primary.js',
'lib/internal/cluster/round_robin_handle.js',
'lib/internal/cluster/shared_handle.js',
'lib/internal/cluster/utils.js',
'lib/internal/cluster/worker.js',
'lib/internal/console/constructor.js',
'lib/internal/console/global.js',
'lib/internal/constants.js',
'lib/internal/crypto/aes.js',
'lib/internal/crypto/certificate.js',
'lib/internal/crypto/cipher.js',
'lib/internal/crypto/diffiehellman.js',
'lib/internal/crypto/dsa.js',
'lib/internal/crypto/ec.js',
'lib/internal/crypto/hash.js',
'lib/internal/crypto/hashnames.js',
'lib/internal/crypto/hkdf.js',
'lib/internal/crypto/keygen.js',
'lib/internal/crypto/keys.js',
'lib/internal/crypto/mac.js',
'lib/internal/crypto/pbkdf2.js',
'lib/internal/crypto/random.js',
'lib/internal/crypto/rsa.js',
'lib/internal/crypto/scrypt.js',
'lib/internal/crypto/sig.js',
'lib/internal/crypto/util.js',
'lib/internal/crypto/webcrypto.js',
'lib/internal/crypto/x509.js',
'lib/internal/debugger/inspect.js',
'lib/internal/debugger/inspect_client.js',
'lib/internal/debugger/inspect_repl.js',
'lib/internal/dgram.js',
'lib/internal/dns/promises.js',
'lib/internal/dns/utils.js',
'lib/internal/dtrace.js',
'lib/internal/encoding.js',
'lib/internal/errors.js',
'lib/internal/error_serdes.js',
'lib/internal/event_target.js',
'lib/internal/fixed_queue.js',
'lib/internal/freelist.js',
'lib/internal/freeze_intrinsics.js',
'lib/internal/fs/cp/cp-sync.js',
'lib/internal/fs/cp/cp.js',
'lib/internal/fs/dir.js',
'lib/internal/fs/promises.js',
'lib/internal/fs/read_file_context.js',
'lib/internal/fs/rimraf.js',
'lib/internal/fs/streams.js',
'lib/internal/fs/sync_write_stream.js',
'lib/internal/fs/utils.js',
'lib/internal/fs/watchers.js',
'lib/internal/heap_utils.js',
'lib/internal/histogram.js',
'lib/internal/http.js',
'lib/internal/http2/compat.js',
'lib/internal/http2/core.js',
'lib/internal/http2/util.js',
'lib/internal/idna.js',
'lib/internal/inspector_async_hook.js',
'lib/internal/js_stream_socket.js',
'lib/internal/legacy/processbinding.js',
'lib/internal/linkedlist.js',
'lib/internal/main/check_syntax.js',
'lib/internal/main/eval_stdin.js',
'lib/internal/main/eval_string.js',
'lib/internal/main/inspect.js',
'lib/internal/main/print_help.js',
'lib/internal/main/prof_process.js',
'lib/internal/main/repl.js',
'lib/internal/main/run_main_module.js',
'lib/internal/main/worker_thread.js',
'lib/internal/modules/cjs/helpers.js',
'lib/internal/modules/cjs/loader.js',
'lib/internal/modules/esm/create_dynamic_module.js',
'lib/internal/modules/esm/get_format.js',
'lib/internal/modules/esm/get_source.js',
'lib/internal/modules/esm/loader.js',
'lib/internal/modules/esm/module_job.js',
'lib/internal/modules/esm/module_map.js',
'lib/internal/modules/esm/resolve.js',
'lib/internal/modules/esm/transform_source.js',
'lib/internal/modules/esm/translators.js',
'lib/internal/modules/package_json_reader.js',
'lib/internal/modules/run_main.js',
'lib/internal/net.js',
'lib/internal/options.js',
'lib/internal/perf/event_loop_delay.js',
'lib/internal/perf/event_loop_utilization.js',
'lib/internal/perf/nodetiming.js',
'lib/internal/perf/observe.js',
'lib/internal/perf/performance.js',
'lib/internal/perf/performance_entry.js',
'lib/internal/perf/timerify.js',
'lib/internal/perf/usertiming.js',
'lib/internal/perf/utils.js',
'lib/internal/per_context/domexception.js',
'lib/internal/per_context/messageport.js',
'lib/internal/per_context/primordials.js',
'lib/internal/policy/manifest.js',
'lib/internal/policy/sri.js',
'lib/internal/priority_queue.js',
'lib/internal/process/esm_loader.js',
'lib/internal/process/execution.js',
'lib/internal/process/per_thread.js',
'lib/internal/process/policy.js',
'lib/internal/process/promises.js',
'lib/internal/process/report.js',
'lib/internal/process/signal.js',
'lib/internal/process/task_queues.js',
'lib/internal/process/warning.js',
'lib/internal/process/worker_thread_only.js',
'lib/internal/querystring.js',
'lib/internal/readline/callbacks.js',
'lib/internal/readline/emitKeypressEvents.js',
'lib/internal/readline/utils.js',
'lib/internal/repl/await.js',
'lib/internal/repl/history.js',
'lib/internal/repl/utils.js',
'lib/internal/repl.js',
'lib/internal/socketaddress.js',
'lib/internal/socket_list.js',
'lib/internal/source_map/prepare_stack_trace.js',
'lib/internal/source_map/source_map.js',
'lib/internal/source_map/source_map_cache.js',
'lib/internal/streams/add-abort-signal.js',
'lib/internal/streams/buffer_list.js',
'lib/internal/streams/compose.js',
'lib/internal/streams/destroy.js',
'lib/internal/streams/duplex.js',
'lib/internal/streams/duplexify.js',
'lib/internal/streams/end-of-stream.js',
'lib/internal/streams/from.js',
'lib/internal/streams/lazy_transform.js',
'lib/internal/streams/legacy.js',
'lib/internal/streams/passthrough.js',
'lib/internal/streams/pipeline.js',
'lib/internal/streams/readable.js',
'lib/internal/streams/state.js',
'lib/internal/streams/transform.js',
'lib/internal/streams/utils.js',
'lib/internal/streams/writable.js',
'lib/internal/stream_base_commons.js',
'lib/internal/test/binding.js',
'lib/internal/test/transfer.js',
'lib/internal/timers.js',
'lib/internal/tls/parse-cert-string.js',
'lib/internal/tls/secure-context.js',
'lib/internal/tls/secure-pair.js',
'lib/internal/trace_events_async_hooks.js',
'lib/internal/tty.js',
'lib/internal/url.js',
'lib/internal/util/comparisons.js',
'lib/internal/util/debuglog.js',
'lib/internal/util/inspect.js',
'lib/internal/util/inspector.js',
'lib/internal/util/iterable_weak_map.js',
'lib/internal/util/types.js',
'lib/internal/util.js',
'lib/internal/v8_prof_polyfill.js',
'lib/internal/v8_prof_processor.js',
'lib/internal/validators.js',
'lib/internal/vm/module.js',
'lib/internal/watchdog.js',
'lib/internal/webstreams/encoding.js',
'lib/internal/webstreams/queuingstrategies.js',
'lib/internal/webstreams/readablestream.js',
'lib/internal/webstreams/transfer.js',
'lib/internal/webstreams/transformstream.js',
'lib/internal/webstreams/util.js',
'lib/internal/webstreams/writablestream.js',
'lib/internal/worker/io.js',
'lib/internal/worker/js_transferable.js',
'lib/internal/worker.js',
'lib/module.js',
'lib/net.js',
'lib/os.js',
'lib/path/posix.js',
'lib/path/win32.js',
'lib/path.js',
'lib/perf_hooks.js',
'lib/process.js',
'lib/punycode.js',
'lib/querystring.js',
'lib/readline.js',
'lib/repl.js',
'lib/stream/consumers.js',
'lib/stream/promises.js',
'lib/stream/web.js',
'lib/stream.js',
'lib/string_decoder.js',
'lib/sys.js',
'lib/timers/promises.js',
'lib/timers.js',
'lib/tls.js',
'lib/trace_events.js',
'lib/tty.js',
'lib/url.js',
'lib/util/types.js',
'lib/util.js',
'lib/v8.js',
'lib/vm.js',
'lib/wasi.js',
'lib/worker_threads.js',
'lib/zlib.js',
'lib/_http_agent.js',
'lib/_http_client.js',
'lib/_http_common.js',
'lib/_http_incoming.js',
'lib/_http_outgoing.js',
'lib/_http_server.js',
'lib/_stream_duplex.js',
'lib/_stream_passthrough.js',
'lib/_stream_readable.js',
'lib/_stream_transform.js',
'lib/_stream_wrap.js',
'lib/_stream_writable.js',
'lib/_tls_common.js',
'lib/_tls_wrap.js',
'deps/v8/tools/splaytree.mjs',
'deps/v8/tools/codemap.mjs',
'deps/v8/tools/consarray.mjs',
'deps/v8/tools/csvparser.mjs',
'deps/v8/tools/profile.mjs',
'deps/v8/tools/profile_view.mjs',
'deps/v8/tools/logreader.mjs',
'deps/v8/tools/arguments.mjs',
'deps/v8/tools/tickprocessor.mjs',
'deps/v8/tools/sourcemap.mjs',
'deps/v8/tools/tickprocessor-driver.mjs',
'deps/acorn/acorn/dist/acorn.js',
'deps/acorn/acorn-walk/dist/walk.js',
'deps/cjs-module-lexer/lexer.js',
'deps/cjs-module-lexer/dist/lexer.js',
'lib/_third_party_main.js',
'config.gypi',
]
deps = [
'deps/v8/tools/splaytree.mjs',
'deps/v8/tools/codemap.mjs',
'deps/v8/tools/consarray.mjs',
'deps/v8/tools/csvparser.mjs',
'deps/v8/tools/profile.mjs',
'deps/v8/tools/profile_view.mjs',
'deps/v8/tools/logreader.mjs',
'deps/v8/tools/arguments.mjs',
'deps/v8/tools/tickprocessor.mjs',
'deps/v8/tools/sourcemap.mjs',
'deps/v8/tools/tickprocessor-driver.mjs',
'deps/acorn/acorn/dist/acorn.js',
'deps/acorn/acorn-walk/dist/walk.js',
'deps/cjs-module-lexer/lexer.js',
'deps/cjs-module-lexer/dist/lexer.js',
]
noderoot = sys.argv[1]
mtimes = []
for inFile in deps:
mtimes = mtimes + [ os.path.getmtime(os.path.join(noderoot, inFile)) ]
mtimes = mtimes + [ os.path.getmtime(sys.argv[0]) ]
mtimes.sort()
mtimes.reverse()
minputs = []
for inFile in deps:
minputs = minputs + [ inFile.replace('/', os.path.sep) ]
outFile = os.path.join(noderoot, 'src/node_javascript.cc')
if not os.path.exists(outFile) or os.path.getmtime(outFile) < mtimes[0]:
subprocess.check_call([sys.executable, 'tools/js2c.py', '--directory', 'lib', '--target', 'src/node_javascript.cc', 'config.gypi'] + deps, cwd = noderoot)
| 32.481481 | 155 | 0.711612 | 1,540 | 10,524 | 4.775325 | 0.192208 | 0.176775 | 0.342943 | 0.051673 | 0.286511 | 0.171471 | 0.121838 | 0.113408 | 0.101169 | 0.101169 | 0 | 0.004096 | 0.095211 | 10,524 | 323 | 156 | 32.582043 | 0.768221 | 0 | 0 | 0.102564 | 0 | 0 | 0.776036 | 0.684246 | 0 | 0 | 0 | 0 | 0.016026 | 1 | 0 | false | 0.00641 | 0.009615 | 0 | 0.009615 | 0.003205 | 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 | 1 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
4547e6bcdb29f652198235c9fc8271e10d92d051 | 117 | py | Python | BasicConcepts/SyntaxErrors/Volume1_Chapter6_SyntaxErrors_Fixed.py | jpike/PythonProgrammingForKids | 79a36d6db525d39f78e33b6f7b2d0da0d65a073c | [
"Unlicense"
] | null | null | null | BasicConcepts/SyntaxErrors/Volume1_Chapter6_SyntaxErrors_Fixed.py | jpike/PythonProgrammingForKids | 79a36d6db525d39f78e33b6f7b2d0da0d65a073c | [
"Unlicense"
] | null | null | null | BasicConcepts/SyntaxErrors/Volume1_Chapter6_SyntaxErrors_Fixed.py | jpike/PythonProgrammingForKids | 79a36d6db525d39f78e33b6f7b2d0da0d65a073c | [
"Unlicense"
] | null | null | null | # Commenting syntax errors.
print("Printing out a message!") # This is a comment.
floating_point_number = 1.5 * 2.7
| 29.25 | 54 | 0.726496 | 19 | 117 | 4.368421 | 0.947368 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.040816 | 0.162393 | 117 | 3 | 55 | 39 | 0.806122 | 0.376068 | 0 | 0 | 0 | 0 | 0.328571 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.5 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
4559e964e50001ba3247b35781b62b682a586366 | 2,247 | py | Python | app/ml.py | JeffreyAsuncion/fastapi_test | 384a4bbb5fd283f55f34cd036905d9fb8d3314ab | [
"MIT"
] | null | null | null | app/ml.py | JeffreyAsuncion/fastapi_test | 384a4bbb5fd283f55f34cd036905d9fb8d3314ab | [
"MIT"
] | null | null | null | app/ml.py | JeffreyAsuncion/fastapi_test | 384a4bbb5fd283f55f34cd036905d9fb8d3314ab | [
"MIT"
] | null | null | null | """Machine learning functions"""
from fastapi import APIRouter
from sklearn.neighbors import NearestNeighbors
import pandas as pd
from joblib import load
import pickle
from app.city_state_json import city_state_2_id_num
router = APIRouter()
# filename = 'app/recommend/recommendation_model.sav'
# model_file = open(filename, 'rb')
# loaded_model = pickle.load(model_file)
# states_pkl = pd.read_pickle('app/recommend/states_dataset.pkl')
# @router.get('/recommend')
# async def suggest_state_ids(city_state : str):
# '''Returns the list of 10 city_states with features
# for a given city_state, i.e., "Newark, New Jersey"
# This is a sample response of 2 recommended city_states
# [
# [
# {
# "city_state": "Newark, New Jersey",
# "id_num": 17089,
# "population": 283945,
# "crime_rate": 27.4,
# "rental_rate": 1466.89,
# "walk_score": 79
# }
# ],
# [
# {
# "city_state": "Chula Vista, California",
# "id_num": 3151,
# "population": 280863,
# "crime_rate": 16.2,
# "rental_rate": 2477.6,
# "walk_score": 43
# }
# ]
# ]
# NOTE: This route will return 10 recommmended city_states
# '''
# # use dictionary to find state_id
# state_id = city_state_2_id_num[city_state]
# # pass state_id to model
# state_index = states_pkl.index[states_pkl['id_num'] == state_id]
# # use 'state_id' to find state_features
# state_features = states_pkl.iloc[state_index, 2:].to_numpy()
# # load pkl NearestNeighbors Model
# dist, indices = loaded_model.kneighbors(state_features)
# # list of 10 recommended state_id
# recommended_list = list(states_pkl.loc[indices[0], 'id_num'])
# # list of state_id with respective state feature
# results = []
# for i in range(len(recommended_list)):
# r_list = states_pkl[states_pkl['id_num']==recommended_list[i]]
# r = r_list.to_dict('records')
# results.append(r)
# return results
| 29.565789 | 82 | 0.581219 | 266 | 2,247 | 4.669173 | 0.424812 | 0.057971 | 0.016103 | 0.019324 | 0.024155 | 0 | 0 | 0 | 0 | 0 | 0 | 0.034018 | 0.306631 | 2,247 | 76 | 83 | 29.565789 | 0.763158 | 0.835781 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.857143 | 0 | 0.857143 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
455c8ff0c603475739ee650d803fb990973e2d71 | 115 | py | Python | abc110_c.py | hythof/atc | 12cb94ebe693e1f469ce0d982bc2924b586552cd | [
"CC0-1.0"
] | null | null | null | abc110_c.py | hythof/atc | 12cb94ebe693e1f469ce0d982bc2924b586552cd | [
"CC0-1.0"
] | null | null | null | abc110_c.py | hythof/atc | 12cb94ebe693e1f469ce0d982bc2924b586552cd | [
"CC0-1.0"
] | null | null | null | s=input()
t=input()
ss=sorted(map(s.count,set(s)))
tt=sorted(map(t.count,set(t)))
print('Yes' if ss==tt else 'No')
| 19.166667 | 32 | 0.643478 | 25 | 115 | 2.96 | 0.56 | 0.243243 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.078261 | 115 | 5 | 33 | 23 | 0.698113 | 0 | 0 | 0 | 0 | 0 | 0.043478 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.2 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
455ec14366cbca1ad699f01e8d919c9468857541 | 126 | py | Python | setup.py | HDembinski/bibtools | 1dcc9b2ad19c11e01848a2d9a26bcad7f20e9141 | [
"BSD-3-Clause"
] | null | null | null | setup.py | HDembinski/bibtools | 1dcc9b2ad19c11e01848a2d9a26bcad7f20e9141 | [
"BSD-3-Clause"
] | null | null | null | setup.py | HDembinski/bibtools | 1dcc9b2ad19c11e01848a2d9a26bcad7f20e9141 | [
"BSD-3-Clause"
] | null | null | null | from setuptools import setup
from glob import glob
setup(
name='bibtools',
version='0.0.1',
scripts=glob('src/*.py'),
) | 15.75 | 28 | 0.68254 | 19 | 126 | 4.526316 | 0.684211 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.028037 | 0.150794 | 126 | 8 | 29 | 15.75 | 0.775701 | 0 | 0 | 0 | 0 | 0 | 0.165354 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.285714 | 0 | 0.285714 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
45633fd4e855086655acb3712ae36101ef73aca3 | 1,097 | py | Python | tests/test_tokenizer.py | AlessandroVol23/DEMorphy | a19532a21ac0ce7334ba3203274dc28ba95075d3 | [
"MIT"
] | 43 | 2018-03-07T11:05:00.000Z | 2022-01-28T06:44:01.000Z | tests/test_tokenizer.py | AlessandroVol23/DEMorphy | a19532a21ac0ce7334ba3203274dc28ba95075d3 | [
"MIT"
] | 6 | 2018-04-06T09:40:32.000Z | 2019-12-30T08:08:57.000Z | tests/test_tokenizer.py | AlessandroVol23/DEMorphy | a19532a21ac0ce7334ba3203274dc28ba95075d3 | [
"MIT"
] | 13 | 2018-03-20T09:22:53.000Z | 2021-11-12T13:33:23.000Z | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import pytest
from demorphy.tokenizer import tokenize
class TestTokenizer:
def test_split_simple(self):
assert tokenize(u"Ich bin krank") == [u"Ich", u"bin", u"krank"]
def test_split_hypen(self):
assert tokenize(u"Wir können uns auf der U-Bahn treffen") == [u'Wir', u'können', u'uns', u'auf', u'der', u'U-Bahn', u'treffen.']
def test_split_email(self):
assert tokenize(u"Bitte schreiben Sie an duygu@iam.uni-bonn.de ") == [u"Bitte", u"schreiben", u"Sie", u"an", u"duygu@iam.uni-bonn.de"]
def test_split_url(self):
assert tokenize(u"www.akbank.com.tr ich du Sie bahn.de") == [u'www.akbank.com.tr', u'ich', u'du', u'Sie', u'bahn.de']
def test_split_punct(self):
assert tokenize(u"Ich bin krank, sie auch; ich auch") == [u'Ich', u'bin', u'krank', u'sie', u'auch', u'ich', u'auch']
def test_split_abbrev(self):
assert tokenize(u"ggf. kommen wir auf Ihr Angebot zurück") == [u'ggf.', u'kommen', u'wir', u'auf', u'Ihr', u'Angebot', u'zurück']
| 43.88 | 142 | 0.64722 | 187 | 1,097 | 3.700535 | 0.304813 | 0.060694 | 0.104046 | 0.16474 | 0.219653 | 0.127168 | 0.086705 | 0 | 0 | 0 | 0 | 0.001103 | 0.1732 | 1,097 | 24 | 143 | 45.708333 | 0.761852 | 0.019143 | 0 | 0 | 0 | 0 | 0.348231 | 0.039106 | 0 | 0 | 0 | 0 | 0.375 | 1 | 0.375 | false | 0 | 0.1875 | 0 | 0.625 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
4566f1df5335aa685d6a7563d2d07326d10dd71f | 911 | py | Python | melange/event_serializer.py | Rydra/melange | 5de67dd4eab506353ea05f30df6d250997e3c97f | [
"MIT"
] | 7 | 2017-11-22T15:52:46.000Z | 2022-01-17T23:01:24.000Z | melange/event_serializer.py | Rydra/melange | 5de67dd4eab506353ea05f30df6d250997e3c97f | [
"MIT"
] | 1 | 2017-11-30T16:13:52.000Z | 2019-02-12T14:51:54.000Z | melange/event_serializer.py | Rydra/melange | 5de67dd4eab506353ea05f30df6d250997e3c97f | [
"MIT"
] | 3 | 2017-11-15T16:34:20.000Z | 2022-01-24T11:05:54.000Z | import json
from typing import Generic, Dict, Optional
from melange.helpers.typing import T
class MessageSerializer(Generic[T]):
"""
You need to provide a way to convert a message from your sqs
into something meaningful for your domain (e.g. into a Domain Event)
"""
def manifest(self, data: T) -> str:
return ""
def deserialize(self, data: str, manifest: Optional[str] = None) -> str:
pass
def serialize(self, data: T) -> str:
"""
Serializes and object to a string representation
"""
pass
class JsonSQSSerializer(MessageSerializer[Dict]):
def manifest(self, data: Dict):
return "json"
def deserialize(self, serialized_data: str, manifest: Optional[str] = None) -> str:
data = json.loads(serialized_data)
return data
def serialize(self, data: Dict) -> str:
return json.dumps(data)
| 25.305556 | 87 | 0.641054 | 114 | 911 | 5.105263 | 0.429825 | 0.068729 | 0.051546 | 0.065292 | 0.113402 | 0.113402 | 0.113402 | 0 | 0 | 0 | 0 | 0 | 0.259056 | 911 | 35 | 88 | 26.028571 | 0.862222 | 0.19539 | 0 | 0.111111 | 0 | 0 | 0.005797 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0.111111 | 0.166667 | 0.166667 | 0.833333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 3 |
4571f5ea9930c1e8a75a9d3d4c06b5bd761edd2d | 4,058 | py | Python | src/ebonite/ext/numpy/dataset.py | geffy/ebonite | 2d85eeca44ac1799e743bafe333887712e325060 | [
"Apache-2.0"
] | 1 | 2019-11-27T14:33:45.000Z | 2019-11-27T14:33:45.000Z | src/ebonite/ext/numpy/dataset.py | geffy/ebonite | 2d85eeca44ac1799e743bafe333887712e325060 | [
"Apache-2.0"
] | null | null | null | src/ebonite/ext/numpy/dataset.py | geffy/ebonite | 2d85eeca44ac1799e743bafe333887712e325060 | [
"Apache-2.0"
] | null | null | null | from typing import Tuple, Type
import numpy as np
from pyjackson.core import ArgList, Field
from pyjackson.generics import Serializer
from ebonite.core.analyzer.base import CanIsAMustHookMixin, TypeHookMixin
from ebonite.core.analyzer.dataset import DatasetHook
from ebonite.core.objects.dataset_type import DatasetType
from ebonite.runtime.interface.typing import ListTypeWithSpec, SizedTypedListType
def _python_type_from_np_string_repr(string_repr: str) -> type:
np_type = _np_type_from_string(string_repr)
return _python_type_from_np_type(np_type)
def _python_type_from_np_type(np_type: Type):
value = np_type()
if np_type.__module__ == 'numpy':
value = value.item()
return type(value)
def _np_type_from_string(string_repr):
try:
return getattr(np, string_repr)
except AttributeError:
raise ValueError('Unknown numpy type {}'.format(string_repr))
class NumpyNumberDatasetType(DatasetType):
"""
:class:`.DatasetType` implementation for `numpy.number` objects which
converts them to built-in Python numbers and vice versa.
:param dtype: `numpy.number` data type as string
"""
type = 'numpy_number'
def __init__(self, dtype: str):
self.dtype = dtype
def get_spec(self) -> ArgList:
return [Field(None, self.actual_type, False)]
def deserialize(self, obj: dict) -> object:
return self.actual_type(obj)
def serialize(self, instance: np.number) -> object:
return instance.item()
@property
def actual_type(self):
return _np_type_from_string(self.dtype)
class NumpyNumberHook(CanIsAMustHookMixin, DatasetHook):
"""
:class:`.DatasetHook` implementation for `numpy.number` objects which uses :class:`NumpyNumberDatasetType`.
"""
def must_process(self, obj) -> bool:
return isinstance(obj, np.number)
def process(self, obj: np.number) -> DatasetType:
return NumpyNumberDatasetType(obj.dtype.name)
class NumpyNdarrayHook(TypeHookMixin, DatasetHook):
"""
:class:`.DatasetHook` implementation for `np.ndarray` objects which uses :class:`NumpyNdarrayDatasetType`
"""
valid_types = [np.ndarray]
def process(self, obj) -> DatasetType:
return NumpyNdarrayDatasetType(obj.shape, obj.dtype.name)
class NumpyDTypeSerializer(Serializer):
"""
PyJackson :class:`.Serializer` for `numpy` data types: stores types in JSON as their names.
"""
def deserialize(self, obj: str):
return getattr(np, obj)
def serialize(self, instance) -> str:
return str(instance)
class NumpyNdarrayDatasetType(DatasetType, ListTypeWithSpec):
"""
:class:`.DatasetType` implementation for `np.ndarray` objects
which converts them to built-in Python lists and vice versa.
:param shape: shape of `numpy.ndarray` objects in dataset
:param dtype: data type of `numpy.ndarray` objects in dataset
"""
real_type = np.ndarray
type = 'numpy_ndarray'
def __init__(self, shape: Tuple[int, ...], dtype: str):
# TODO assert shape and dtypes len
self.shape = shape
self.dtype = dtype
@property
def size(self):
if len(self.shape) == 1:
return 1
else:
return self.shape[0] # TODO more dimensions
def list_size(self):
return self.shape[0]
def _get_subtype(self, shape):
if len(shape) == 0:
return _python_type_from_np_string_repr(self.dtype)
elif len(shape) == 1:
subtype = _python_type_from_np_string_repr(self.dtype)
else:
subtype = self._get_subtype(shape[1:])
return SizedTypedListType(shape[0], subtype)
def get_spec(self) -> ArgList:
return [Field(None, self._get_subtype(self.shape[1:]), False)]
def deserialize(self, obj):
return np.array(obj)
def serialize(self, instance: np.ndarray):
# if self.shape == 1:
# return [instance.tolist()] # TODO better shapes
return instance.tolist()
| 28.985714 | 111 | 0.679645 | 492 | 4,058 | 5.443089 | 0.235772 | 0.022405 | 0.026139 | 0.029873 | 0.28342 | 0.227035 | 0.104556 | 0.085138 | 0.029873 | 0 | 0 | 0.003157 | 0.21932 | 4,058 | 139 | 112 | 29.194245 | 0.842172 | 0.210202 | 0 | 0.131579 | 0 | 0 | 0.016425 | 0 | 0 | 0 | 0 | 0.007194 | 0 | 1 | 0.263158 | false | 0 | 0.105263 | 0.171053 | 0.75 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
4586103dff65390c36a39a858fcae5341e48ccd7 | 2,777 | py | Python | app/handlers/admins/moderation.py | vitaliy-ukiru/math-bot | 72c116b4f5a4aa6a5f8eaae67ecbbf3df821f9e9 | [
"MIT"
] | 1 | 2021-12-11T07:41:38.000Z | 2021-12-11T07:41:38.000Z | app/handlers/admins/moderation.py | vitaliy-ukiru/math-bot | 72c116b4f5a4aa6a5f8eaae67ecbbf3df821f9e9 | [
"MIT"
] | 8 | 2021-05-08T21:48:34.000Z | 2022-01-20T15:42:00.000Z | app/handlers/admins/moderation.py | vitaliy-ukiru/math-bot | 72c116b4f5a4aa6a5f8eaae67ecbbf3df821f9e9 | [
"MIT"
] | null | null | null | # Source: https://github.com/aiogram/bot/blob/master/aiogram_bot/handlers/simple_admin.py
import logging
from aiogram import types
from aiogram.utils import exceptions
from babel.dates import format_timedelta
from app.loader import dp
from app.utils.timedelta import parse_timedelta_from_message
logger = logging.getLogger()
@dp.message_handler(
commands=("ro", "mute"),
commands_prefix="/!",
is_reply=True,
user_can_restrict_members=True,
bot_can_restrict_members=True,
)
async def cmd_ro(message: types.Message, reply: types.Message):
duration = await parse_timedelta_from_message(message)
if not duration:
return
try: # Apply restriction
await message.chat.restrict(
reply.from_user.id, can_send_messages=False, until_date=duration
)
logger.info(
"User {user} restricted by {admin} for {duration}".format(
user=message.reply_to_message.from_user.id,
admin=message.from_user.id,
duration=duration,
)
)
except exceptions.BadRequest as e:
logger.error("Failed to restrict chat member: {error!r}", error=e)
return False
await message.reply_to_message.answer(
"<b>Read-only</b> активирован для пользователя {user}. Длительность: {duration}".format(
user=message.reply_to_message.from_user.get_mention(),
duration=format_timedelta(
duration, locale=message.from_user.locale, granularity="seconds", format="short"
),
)
)
return True
@dp.message_handler(
commands="ban",
commands_prefix="/!",
is_reply=True,
user_can_restrict_members=True,
bot_can_restrict_members=True,
)
async def cmd_ban(message: types.Message, reply: types.Message):
duration = await parse_timedelta_from_message(message)
if not duration:
return
try: # Apply restriction
await message.bot.ban_chat_member(message.chat.id, reply.from_user.id, until_date=duration)
logger.info(
"User {user} baned by {admin} for {duration}".format(
user=message.reply_to_message.from_user.id,
admin=message.from_user.id,
duration=duration,)
)
except exceptions.BadRequest as e:
logger.error("Failed to kick chat member: {error!r}", error=e)
return False
await message.reply_to_message.answer(
"Пользователь {user} <b>забанен</b> на {duration}".format(
user=message.reply_to_message.from_user.get_mention(),
duration=format_timedelta(
duration, locale=message.from_user.locale, granularity="seconds", format="short"
),
)
)
return True
| 31.556818 | 99 | 0.657184 | 333 | 2,777 | 5.288288 | 0.276276 | 0.045429 | 0.068143 | 0.07155 | 0.700738 | 0.700738 | 0.700738 | 0.660988 | 0.660988 | 0.660988 | 0 | 0 | 0.242708 | 2,777 | 87 | 100 | 31.91954 | 0.837375 | 0.044292 | 0 | 0.555556 | 0 | 0 | 0.125283 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.083333 | 0 | 0.166667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
459b244b831dbaca46e8bc6cd6ce8c182a965598 | 75 | py | Python | icls/models/resnet/resnet_test.py | TaikiInoue/iClassification | 7045c7721c9ee86e3823b13722d22b6c0095b76a | [
"MIT"
] | null | null | null | icls/models/resnet/resnet_test.py | TaikiInoue/iClassification | 7045c7721c9ee86e3823b13722d22b6c0095b76a | [
"MIT"
] | null | null | null | icls/models/resnet/resnet_test.py | TaikiInoue/iClassification | 7045c7721c9ee86e3823b13722d22b6c0095b76a | [
"MIT"
] | null | null | null | from torchvision.models import resnet50
model = resnet50(pretrained=True)
| 18.75 | 39 | 0.826667 | 9 | 75 | 6.888889 | 0.888889 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.059701 | 0.106667 | 75 | 3 | 40 | 25 | 0.865672 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
45af30155ad4a759e535f66f6ceb28eae04047f8 | 398 | py | Python | map_the_data.py | andrewnash/Thar-She-Blows | 3019d4150c4b4763e979416c33ff62ab9dbcc306 | [
"Beerware"
] | 1 | 2021-01-16T14:16:38.000Z | 2021-01-16T14:16:38.000Z | map_the_data.py | stuckatmarine/Thar-She-Blows | 3019d4150c4b4763e979416c33ff62ab9dbcc306 | [
"Beerware"
] | null | null | null | map_the_data.py | stuckatmarine/Thar-She-Blows | 3019d4150c4b4763e979416c33ff62ab9dbcc306 | [
"Beerware"
] | 1 | 2019-01-27T20:13:40.000Z | 2019-01-27T20:13:40.000Z | def create_box(input_corners):
x = (float(input_corners[0][0]), float(input_corners[1][0]))
y = (float(input_corners[0][1]), float(input_corners[1][1]))
windmill_lats, windmill_lons = zip(*[
(max(x), max(y)),
(min(x), max(y)),
(min(x), min(y)),
(max(x), min(y)),
(max(x), max(y))
])
return windmill_lats, windmill_lons
| 26.533333 | 64 | 0.525126 | 57 | 398 | 3.491228 | 0.298246 | 0.301508 | 0.341709 | 0.180905 | 0.165829 | 0 | 0 | 0 | 0 | 0 | 0 | 0.027491 | 0.268844 | 398 | 14 | 65 | 28.428571 | 0.656357 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.090909 | false | 0 | 0 | 0 | 0.181818 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
45b69d9e8f458c8ffc0da247fee252792dcb4f07 | 1,176 | py | Python | Python/Testing/NoiseRemove.py | mishranilesh012/Natural_Language_Processing_Techniques | cb7056d07ce339929eea289cb27aff6d08850781 | [
"Apache-2.0"
] | 1 | 2019-04-02T18:15:36.000Z | 2019-04-02T18:15:36.000Z | Python/Testing/NoiseRemove.py | mishranilesh012/Natural_Language_Processing_Techniques | cb7056d07ce339929eea289cb27aff6d08850781 | [
"Apache-2.0"
] | null | null | null | Python/Testing/NoiseRemove.py | mishranilesh012/Natural_Language_Processing_Techniques | cb7056d07ce339929eea289cb27aff6d08850781 | [
"Apache-2.0"
] | null | null | null | import struct
import scipy.io.wavfile as wf
import numpy
import pydub
# for i in range(wave_file.getnframes()):
# # read a single frame and advance to next frame
# current_frame = wave_file.readframes(1)
#
# # check for silence
# silent = True
# # wave frame samples are stored in little endian**
# # this example works for a single channel 16-bit per sample encoding
# unpacked_signed_value = struct.unpack("<h", current_frame) # *
# if abs(unpacked_signed_value[0]) > 500:
# silent = False
#
# if silent:
# print("Frame %s is silent." % wave_file.tell())
# else:
# print("Frame %s is not silent." % wave_file.tell())
# rate, data = wf.read('testing.wav')
# # data0 is the data from channel 0.
# data0 = data[:, 0]
#
# print(data0)
# from pydub import AudioSegment
# from pydub.silence import detect_silence, detect_nonsilent
#
# song = AudioSegment.from_wav("soundaudio.wav")
# val = detect_silence(song)
# print(val)
from pyAudioAnalysis import audioSegmentation as aS
[flagsInd, classesAll, acc, CM] = aS.mtFileClassification("data/scottish.wav", "data/svmSM", "svm", True, 'data/scottish.segments') | 28 | 131 | 0.681122 | 160 | 1,176 | 4.91875 | 0.53125 | 0.040661 | 0.048285 | 0.033037 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.012712 | 0.197279 | 1,176 | 42 | 131 | 28 | 0.820975 | 0.72534 | 0 | 0 | 0 | 0 | 0.17931 | 0.075862 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.833333 | 0 | 0.833333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
45b6b44fc3e96a3e82849428dcf6936a0c8ee650 | 67 | py | Python | merchant-server/constants.py | googleinterns/product-catalog-builder-for-smbs | c328801df5ac5064bf62372f3d32299329c0e361 | [
"Apache-2.0"
] | 2 | 2020-05-28T05:35:37.000Z | 2020-05-29T15:49:22.000Z | merchant-server/constants.py | googleinterns/product-catalog-builder-for-smbs | c328801df5ac5064bf62372f3d32299329c0e361 | [
"Apache-2.0"
] | 13 | 2020-05-28T10:42:18.000Z | 2022-03-31T04:10:45.000Z | merchant-server/constants.py | googleinterns/product-catalog-builder-for-smbs | c328801df5ac5064bf62372f3d32299329c0e361 | [
"Apache-2.0"
] | 1 | 2020-10-18T06:23:00.000Z | 2020-10-18T06:23:00.000Z | NEW_ORDER = "NEW_ORDER"
ONGOING = "ONGOING"
PRODUCTS_PER_PAGE = 10
| 16.75 | 23 | 0.761194 | 10 | 67 | 4.7 | 0.7 | 0.340426 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.034483 | 0.134328 | 67 | 3 | 24 | 22.333333 | 0.775862 | 0 | 0 | 0 | 0 | 0 | 0.238806 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
45be19aa04aea9d081ff9b9affbf49589fe19ece | 411 | py | Python | traceml/traceml/vendor/matplotlylib/__init__.py | jinheeson1008/tensorflow-lstm-regression | f31fc1181a5696a25f5737398ee0715c24626248 | [
"Apache-2.0"
] | 4 | 2022-01-07T11:30:53.000Z | 2022-03-22T11:48:20.000Z | traceml/traceml/vendor/matplotlylib/__init__.py | jinheeson1008/tensorflow-lstm-regression | f31fc1181a5696a25f5737398ee0715c24626248 | [
"Apache-2.0"
] | 9 | 2022-01-02T08:47:28.000Z | 2022-03-18T23:18:20.000Z | traceml/traceml/vendor/matplotlylib/__init__.py | jinheeson1008/tensorflow-lstm-regression | f31fc1181a5696a25f5737398ee0715c24626248 | [
"Apache-2.0"
] | null | null | null | """
matplotlylib
============
This module converts matplotlib figure objects into JSON structures which can
be understood and visualized by Plotly.
Most of the functionality should be accessed through the parent directory's
'tools' module or 'plotly' package.
"""
from __future__ import absolute_import
from .renderer import PlotlyRenderer
from .mplexporter import Exporter
from .tools import mpl_to_plotly
| 24.176471 | 77 | 0.793187 | 54 | 411 | 5.907407 | 0.759259 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.138686 | 411 | 16 | 78 | 25.6875 | 0.90113 | 0.625304 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
45df59c4c66385bfd79fb073d750cb26999b1094 | 1,758 | py | Python | reader/common/labels.py | nicolay-r/RuSentRel | 4fc0df1580d3da21f0be1e832e403652f73caed1 | [
"MIT"
] | 5 | 2019-01-28T10:31:07.000Z | 2021-09-08T06:25:30.000Z | reader/common/labels.py | nicolay-r/RuSentRel | 4fc0df1580d3da21f0be1e832e403652f73caed1 | [
"MIT"
] | null | null | null | reader/common/labels.py | nicolay-r/RuSentRel | 4fc0df1580d3da21f0be1e832e403652f73caed1 | [
"MIT"
] | 1 | 2019-08-18T18:30:56.000Z | 2019-08-18T18:30:56.000Z |
class Label:
@staticmethod
def from_str(value):
for l in Label._get_supported_labels():
if l.to_str() == value:
return l
raise Exception("Label by value '{}' doesn't supported".format(value))
@staticmethod
def from_int(value):
assert(isinstance(value, int))
for l in Label._get_supported_labels():
if l.to_int() == value:
return l
raise Exception("Label by value '{}' doesn't supported".format(value))
@staticmethod
def from_uint(value):
assert(isinstance(value, int) and value >= 0)
for l in Label._get_supported_labels():
if l.to_uint() == value:
return l
raise Exception("Label by unsigned value '{}' doesn't supported".format(value))
@staticmethod
def _get_supported_labels():
supported_labels = [
PositiveLabel(),
NegativeLabel()
]
return supported_labels
def to_str(self):
raise NotImplementedError()
def to_int(self):
raise NotImplementedError()
def to_uint(self):
raise Exception("Not implemented exception")
def __eq__(self, other):
assert(isinstance(other, Label))
return self.to_int() == other.to_int()
def __ne__(self, other):
assert(isinstance(other, Label))
return self.to_int() != other.to_int()
class PositiveLabel(Label):
def to_str(self):
return 'pos'
def to_int(self):
return int(1)
def to_uint(self):
return int(1)
class NegativeLabel(Label):
def to_str(self):
return 'neg'
def to_int(self):
return int(-1)
def to_uint(self):
return int(2)
| 22.831169 | 87 | 0.584187 | 210 | 1,758 | 4.695238 | 0.2 | 0.045639 | 0.073022 | 0.033469 | 0.735294 | 0.609533 | 0.56288 | 0.529412 | 0.482759 | 0.482759 | 0 | 0.004105 | 0.307167 | 1,758 | 76 | 88 | 23.131579 | 0.805419 | 0 | 0 | 0.5 | 0 | 0 | 0.08604 | 0 | 0 | 0 | 0 | 0 | 0.074074 | 1 | 0.277778 | false | 0 | 0 | 0.111111 | 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 | 1 | 0 | 0 | 3 |
45e649838e23cf031bb5255dcfd4e23a12c7bf08 | 551 | py | Python | events/tracon2022/urls.py | con2/kompassi | 4938059b8f239ad5ecf06a526adf8b62bce52263 | [
"CC-BY-3.0"
] | 13 | 2015-11-29T12:19:12.000Z | 2021-02-21T15:42:11.000Z | events/tracon2022/urls.py | con2/kompassi | 4938059b8f239ad5ecf06a526adf8b62bce52263 | [
"CC-BY-3.0"
] | 23 | 2015-04-29T19:43:34.000Z | 2021-02-10T05:50:17.000Z | events/tracon2022/urls.py | con2/kompassi | 4938059b8f239ad5ecf06a526adf8b62bce52263 | [
"CC-BY-3.0"
] | 11 | 2015-09-20T18:59:00.000Z | 2020-02-07T08:47:34.000Z | from django.conf.urls import url
from .views import tracon2022_afterparty_participants_view, tracon2022_afterparty_summary_view
urlpatterns = [
url(
r'^events/(?P<event_slug>tracon2022)/labour/surveys/kaatoilmo/results.xlsx$',
tracon2022_afterparty_participants_view,
name='tracon2022_afterparty_participants_view',
),
url(
r'^events/(?P<event_slug>tracon2022)/labour/surveys/kaatoilmo/summary/?$',
tracon2022_afterparty_summary_view,
name='tracon2022_afterparty_summary_view',
),
]
| 29 | 94 | 0.733212 | 59 | 551 | 6.508475 | 0.40678 | 0.3125 | 0.25 | 0.28125 | 0.270833 | 0.270833 | 0.270833 | 0.270833 | 0.270833 | 0.270833 | 0 | 0.069565 | 0.165154 | 551 | 18 | 95 | 30.611111 | 0.765217 | 0 | 0 | 0.285714 | 0 | 0 | 0.392015 | 0.392015 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.142857 | 0 | 0.142857 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
aff371e591da00d7135ed8ebb4ce8865d7e19a6f | 1,183 | py | Python | vavs_project/fbdata/generic.py | valuesandvalue/valuesandvalue | 7d7602d0b620b38dcb761c63e74077a00bae891f | [
"MIT"
] | 1 | 2016-03-17T10:00:28.000Z | 2016-03-17T10:00:28.000Z | vavs_project/fbdata/generic.py | valuesandvalue/valuesandvalue | 7d7602d0b620b38dcb761c63e74077a00bae891f | [
"MIT"
] | null | null | null | vavs_project/fbdata/generic.py | valuesandvalue/valuesandvalue | 7d7602d0b620b38dcb761c63e74077a00bae891f | [
"MIT"
] | null | null | null | # fbdata.generic
# FBDATA
from .models import (
FBAlbum,
FBEvent,
FBLink,
FBPhoto,
FBStatus,
FBVideo,
StreamPost
)
_FB_CLASSES = {
'album': FBAlbum,
'event': FBEvent,
'link': FBLink,
'photo': FBPhoto,
'status': FBStatus,
'video': FBVideo,
'post': StreamPost
}
def class_for_type(object_type):
return _FB_CLASSES.get(object_type, None)
def album_exists(user, object_id):
return FBAlbum.objects.filter(user=user, object_id=object_id).exists()
def event_exists(user, object_id):
return FBEvent.objects.filter(user=user, event_id=object_id).exists()
def link_exists(user, link_id):
return FBLink.objects.filter(user=user, link_id=link_id).exists()
def post_exists(user, post_id):
return StreamPost.objects.filter(user=user, post_id=post_id).exists()
def photo_exists(user, object_id):
return FBPhoto.objects.filter(user=user, object_id=object_id).exists()
def status_exists(user, status_id):
return FBStatus.objects.filter(user=user, status_id=status_id).exists()
def video_exists(user, video_id):
return FBVideo.objects.filter(user=user, video_id=video_id).exists()
| 25.170213 | 75 | 0.705833 | 161 | 1,183 | 4.962733 | 0.21118 | 0.0801 | 0.148936 | 0.18398 | 0.229036 | 0.115144 | 0.115144 | 0.115144 | 0.115144 | 0.115144 | 0 | 0 | 0.169907 | 1,183 | 46 | 76 | 25.717391 | 0.813646 | 0.017751 | 0 | 0 | 0 | 0 | 0.029336 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.235294 | false | 0 | 0.029412 | 0.235294 | 0.5 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 3 |
b304511c23a05e5c02a15ade41a42766675c4bda | 242 | py | Python | ikologikapi/domain/AbstractIkologikCustomerObject.py | Ikologik/ikologik-api-python | 5bf32d7dde3366110c6fde4fc76d74fb461eb8b5 | [
"MIT"
] | null | null | null | ikologikapi/domain/AbstractIkologikCustomerObject.py | Ikologik/ikologik-api-python | 5bf32d7dde3366110c6fde4fc76d74fb461eb8b5 | [
"MIT"
] | null | null | null | ikologikapi/domain/AbstractIkologikCustomerObject.py | Ikologik/ikologik-api-python | 5bf32d7dde3366110c6fde4fc76d74fb461eb8b5 | [
"MIT"
] | null | null | null | from ikologikapi.domain.AbstractIkologikObject import AbstractIkologikObject
class AbstractIkologikCustomerObject(AbstractIkologikObject):
def __init__(self, customer: str):
super().__init__()
self.customer = customer
| 24.2 | 76 | 0.772727 | 19 | 242 | 9.421053 | 0.684211 | 0.089385 | 0.178771 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.157025 | 242 | 9 | 77 | 26.888889 | 0.877451 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.2 | 0 | 0.6 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
b3071a1b815f8d4b62fc6b810125289866f9f503 | 180 | py | Python | portal/serializers.py | Radek198/Food-Co-op | eee5077d9cd9f5f9b71a649e7fb086f5e04d3f83 | [
"MIT"
] | null | null | null | portal/serializers.py | Radek198/Food-Co-op | eee5077d9cd9f5f9b71a649e7fb086f5e04d3f83 | [
"MIT"
] | null | null | null | portal/serializers.py | Radek198/Food-Co-op | eee5077d9cd9f5f9b71a649e7fb086f5e04d3f83 | [
"MIT"
] | null | null | null | from rest_framework import serializers
class ProductSerializer(serializers.Serializer):
product = serializers.ListField(
child=serializers.CharField(max_length=200))
| 25.714286 | 52 | 0.794444 | 18 | 180 | 7.833333 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.019231 | 0.133333 | 180 | 6 | 53 | 30 | 0.884615 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.75 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
b31ad98a0700b36b49c1882b67967d373ee628c9 | 2,625 | py | Python | app/auth/forms.py | karomag/microblog | 7511dbd99c4fec6558fd4a94249622ebffdf52ac | [
"MIT"
] | null | null | null | app/auth/forms.py | karomag/microblog | 7511dbd99c4fec6558fd4a94249622ebffdf52ac | [
"MIT"
] | null | null | null | app/auth/forms.py | karomag/microblog | 7511dbd99c4fec6558fd4a94249622ebffdf52ac | [
"MIT"
] | null | null | null | # -*- coding:utf-8 -*-
"""Forms auth."""
from flask_babel import _
from flask_babel import lazy_gettext as _l
from flask_wtf import FlaskForm
from wtforms import (
BooleanField,
PasswordField,
StringField,
SubmitField,
)
from wtforms.validators import (
DataRequired,
Email,
EqualTo,
ValidationError,
)
from app.models import User
class LoginForm(FlaskForm):
"""Login form.
Args:
FlaskForm (class): Flask-specific subclass of WTForms
"""
username = StringField(_l('Username'), validators=[DataRequired()])
password = PasswordField(_l('Password'), validators=[DataRequired()])
remember_me = BooleanField(_l('Remember me'))
submit = SubmitField(_l('Sigh In'))
class RegistrationForm(FlaskForm):
"""Registration form.
Args:
FlaskForm (class): Flask-specific subclass of WTForms
"""
username = StringField(_l('Username'), validators=[DataRequired()])
email = StringField(_l('Email'), validators=[DataRequired(), Email()])
password = PasswordField(_l('Password'), validators=[DataRequired()])
password2 = PasswordField(
_l('Repeat Password'), validators=[DataRequired(), EqualTo('password')],
)
submit = SubmitField(_l('Register'))
# TODO: Method 'validate_username' may be 'static'
def validate_username(self, username):
"""Checks the username field's data for uniqueness.
Args:
username: Username field data
Raises:
ValidationError, if the username is not unique
"""
user = User.query.filter_by(username=username.data).first()
if user is not None:
raise ValidationError(_('Please use a different username.'))
# TODO: Fix function.
def validate_email(self, email):
"""Checks the email field's data for uniqueness.
Args:
email: Email field data
Raises:
ValidationError, if an email is not unique
"""
user = User.query.filter_by(email=email.data).first()
if user is not None:
raise ValidationError(_('Please use a different email address.'))
class ResetPasswordRequestForm(FlaskForm):
email = StringField(_l('Email'), validators=[DataRequired(), Email()])
submit = SubmitField(_l('Request Password Reset'))
class ResetPasswordForm(FlaskForm):
password = PasswordField(_l('Password'), validators=[DataRequired()])
password2 = PasswordField(
_l('Repeat Password'),
validators=[DataRequired(), EqualTo('password')],
)
submit = SubmitField(_l('Request Password Reset'))
| 28.225806 | 80 | 0.656 | 268 | 2,625 | 6.320896 | 0.320896 | 0.116883 | 0.088548 | 0.053129 | 0.595041 | 0.557261 | 0.460449 | 0.402597 | 0.364817 | 0.364817 | 0 | 0.001474 | 0.224762 | 2,625 | 92 | 81 | 28.532609 | 0.830958 | 0.209524 | 0 | 0.276596 | 0 | 0 | 0.121196 | 0 | 0 | 0 | 0 | 0.021739 | 0 | 1 | 0.042553 | false | 0.276596 | 0.12766 | 0 | 0.553191 | 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 | 1 | 0 | 0 | 3 |
b31e1295214eda15108196ecd3b6619c813ed189 | 5,473 | py | Python | guess_movie/quizz/models.py | tanguyesteoule/movizz | 1b3bc00fcdd6f0c566fdffabf56c4117fa790b02 | [
"MIT"
] | 1 | 2022-01-29T20:14:28.000Z | 2022-01-29T20:14:28.000Z | guess_movie/quizz/models.py | renauddahou/movizz | 1b3bc00fcdd6f0c566fdffabf56c4117fa790b02 | [
"MIT"
] | null | null | null | guess_movie/quizz/models.py | renauddahou/movizz | 1b3bc00fcdd6f0c566fdffabf56c4117fa790b02 | [
"MIT"
] | 1 | 2022-01-16T13:45:40.000Z | 2022-01-16T13:45:40.000Z | from django.db import models
# class Game(models.Model):
# name = models.CharField(max_length=200)
#
# def __str__(self):
# return self.name
class Movie(models.Model):
imdb_id = models.CharField(max_length=200, null=True, blank=True)
name = models.CharField(max_length=200, null=True, blank=True)
director = models.CharField(max_length=200, null=True, blank=True)
year = models.IntegerField(null=True, blank=True)
popularity = models.FloatField(null=True, blank=True)
# summary = models.TextField(null=True, blank=True)
image = models.ImageField(upload_to='covers', null=True, blank=True)
has_quote = models.BooleanField(null=True, blank=True)
has_image = models.BooleanField(default=0, null=True, blank=True)
def __str__(self):
return self.name
class Quote(models.Model):
movie = models.ForeignKey(Movie, on_delete=models.CASCADE)
quote_text = models.TextField(null=True, blank=True)
def __str__(self):
return self.quote_text
class Screenshot(models.Model):
movie = models.ForeignKey(Movie, on_delete=models.CASCADE)
image = models.ImageField(upload_to='screenshot', null=True, blank=True)
# quote_text = models.TextField(null=True, blank=True)
class Game(models.Model):
name = models.CharField(max_length=200, null=True, blank=True)
timestamp = models.DateTimeField(auto_now_add=True)
current_q = models.IntegerField(null=True, blank=True)
nb_q = models.IntegerField(null=True, blank=True)
host = models.CharField(max_length=200, null=True, blank=True)
mode = models.CharField(default="quote", max_length=200, null=True, blank=True)
# "quote" ou "image"
game_mode = models.CharField(max_length=200, null=True, blank=True)
# 'chill' ou int
game_mode_debrief = models.CharField(max_length=200, null=True, blank=True)
# 'chill' ou int
def __str__(self):
return self.name
class Question(models.Model):
movie1 = models.ForeignKey(Movie, on_delete=models.CASCADE, related_name='m1')
movie2 = models.ForeignKey(Movie, on_delete=models.CASCADE, related_name='m2')
movie3 = models.ForeignKey(Movie, on_delete=models.CASCADE, related_name='m3')
movie_guessed = models.ForeignKey(Movie, on_delete=models.CASCADE, related_name='mg')
quote = models.ForeignKey(Quote, on_delete=models.CASCADE)
game = models.ForeignKey(Game, on_delete=models.CASCADE, blank=True, null=True)
def __str__(self):
return f'{self.movie1.id}_{self.movie2.id}_{self.movie3.id}_{self.quote.id}_{self.movie_guessed.id}'
class QuestionImage(models.Model):
movie1 = models.ForeignKey(Movie, on_delete=models.CASCADE, related_name='mi1')
movie2 = models.ForeignKey(Movie, on_delete=models.CASCADE, related_name='mi2')
movie3 = models.ForeignKey(Movie, on_delete=models.CASCADE, related_name='mi3')
movie_guessed = models.ForeignKey(Movie, on_delete=models.CASCADE, related_name='mig')
list_image_id = models.TextField(null=True, blank=True)
game = models.ForeignKey(Game, on_delete=models.CASCADE, blank=True, null=True)
def __str__(self):
return f'{self.game}_{self.movie_guessed.id}'
class Answer(models.Model):
user_id = models.CharField(max_length=200, null=True, blank=True)
question = models.ForeignKey(Question, on_delete=models.CASCADE)
movie_prop = models.ForeignKey(Movie, on_delete=models.CASCADE)
def __str__(self):
return f'{self.user_id}_{self.question}_{self.movie_prop}'
class AnswerImage(models.Model):
user_id = models.CharField(max_length=200, null=True, blank=True)
questionimage = models.ForeignKey(QuestionImage, on_delete=models.CASCADE)
movie_prop = models.ForeignKey(Movie, on_delete=models.CASCADE)
score = models.IntegerField(null=True, blank=True)
def __str__(self):
return f'{self.user_id}_{self.questionimage}_{self.movie_prop}'
class Genre(models.Model):
name = models.CharField(max_length=200, null=True, blank=True)
def __str__(self):
return self.name
class Country(models.Model):
name = models.CharField(max_length=200, null=True, blank=True)
def __str__(self):
return self.name
class Player(models.Model):
user_id = models.CharField(max_length=200, null=True, blank=True)
user_name = models.CharField(max_length=200, null=True, blank=True)
def __str__(self):
return self.user_name
class Preselect(models.Model):
name = models.CharField(max_length=200, null=True, blank=True)
list_movie = models.TextField(null=True, blank=True)
timestamp = models.DateTimeField(auto_now_add=True)
author = models.CharField(max_length=200, null=True, blank=True)
def __str__(self):
return self.name
class MovieGenre(models.Model):
movie = models.ForeignKey(Movie, on_delete=models.CASCADE)
genre = models.ForeignKey(Genre, on_delete=models.CASCADE)
def __str__(self):
return f'{self.movie.id}_{self.genre.id}'
class GamePlayer(models.Model):
game = models.ForeignKey(Game, on_delete=models.CASCADE)
player = models.ForeignKey(Player, on_delete=models.CASCADE)
def __str__(self):
return f'{self.game.id}_{self.player.id}'
class MovieCountry(models.Model):
movie = models.ForeignKey(Movie, on_delete=models.CASCADE)
country = models.ForeignKey(Country, on_delete=models.CASCADE)
def __str__(self):
return f'{self.movie.id}_{self.country.id}'
| 36.731544 | 108 | 0.723004 | 744 | 5,473 | 5.110215 | 0.120968 | 0.067333 | 0.102578 | 0.13414 | 0.789584 | 0.745923 | 0.711205 | 0.66728 | 0.633877 | 0.590216 | 0 | 0.014415 | 0.15074 | 5,473 | 148 | 109 | 36.97973 | 0.803571 | 0.04915 | 0 | 0.381443 | 0 | 0.010309 | 0.069709 | 0.061814 | 0 | 0 | 0 | 0 | 0 | 1 | 0.14433 | false | 0 | 0.010309 | 0.14433 | 1 | 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 | 1 | 0 | 0 | 0 | 3 |
b32342c6d36a233f788e221c35a9371d05ba8ac7 | 76 | py | Python | exercicios/Curso_Udemy_Python/sec3_aula66.py | IgoPereiraBarros/maratona-data-science-brasil | cc07476579134a2764f00d229d415657555dcdd1 | [
"MIT"
] | null | null | null | exercicios/Curso_Udemy_Python/sec3_aula66.py | IgoPereiraBarros/maratona-data-science-brasil | cc07476579134a2764f00d229d415657555dcdd1 | [
"MIT"
] | null | null | null | exercicios/Curso_Udemy_Python/sec3_aula66.py | IgoPereiraBarros/maratona-data-science-brasil | cc07476579134a2764f00d229d415657555dcdd1 | [
"MIT"
] | null | null | null | lista = ['python', 'c', 'c++', 'ruby', 'php']
print(sorted(lista, key=len)) | 25.333333 | 45 | 0.552632 | 11 | 76 | 3.818182 | 0.818182 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.118421 | 76 | 3 | 46 | 25.333333 | 0.626866 | 0 | 0 | 0 | 0 | 0 | 0.220779 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.5 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
b33850aba2836a183da06d1f438221c324a27842 | 172 | py | Python | seniorproject/preprocessing/preprocess_sample.py | teammanicotti/writingstyle | 001fecf34ed3db3699b53a586e5078dbf190a72f | [
"MIT"
] | null | null | null | seniorproject/preprocessing/preprocess_sample.py | teammanicotti/writingstyle | 001fecf34ed3db3699b53a586e5078dbf190a72f | [
"MIT"
] | 4 | 2020-11-13T18:49:50.000Z | 2022-02-10T01:26:11.000Z | seniorproject/preprocessing/preprocess_sample.py | teammanicotti/writingstyle | 001fecf34ed3db3699b53a586e5078dbf190a72f | [
"MIT"
] | null | null | null | """Preprocessing Sample."""
__author__ = 'Devon Welcheck'
def preprocess(req, resp, resource, params): # pylint: disable=unused-argument
"""Preprocess skeleton."""
| 21.5 | 79 | 0.703488 | 17 | 172 | 6.882353 | 0.941176 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.139535 | 172 | 7 | 80 | 24.571429 | 0.790541 | 0.436047 | 0 | 0 | 0 | 0 | 0.162791 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.5 | false | 0 | 0 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
b3459b788b9b0f9bc1d67f711ca82a899ecdbfb0 | 9,008 | py | Python | source/rttov_test/profile-datasets-py/div52/011.py | bucricket/projectMAScorrection | 89489026c8e247ec7c364e537798e766331fe569 | [
"BSD-3-Clause"
] | null | null | null | source/rttov_test/profile-datasets-py/div52/011.py | bucricket/projectMAScorrection | 89489026c8e247ec7c364e537798e766331fe569 | [
"BSD-3-Clause"
] | 1 | 2022-03-12T12:19:59.000Z | 2022-03-12T12:19:59.000Z | source/rttov_test/profile-datasets-py/div52/011.py | bucricket/projectMAScorrection | 89489026c8e247ec7c364e537798e766331fe569 | [
"BSD-3-Clause"
] | null | null | null | """
Profile ../profile-datasets-py/div52/011.py
file automaticaly created by prof_gen.py script
"""
self["ID"] = "../profile-datasets-py/div52/011.py"
self["Q"] = numpy.array([ 1.60776800e+00, 5.75602400e+00, 7.00189400e+00,
7.33717600e+00, 6.76175900e+00, 8.41951900e+00,
6.54641500e+00, 8.55272200e+00, 6.77920300e+00,
7.25516400e+00, 7.37081000e+00, 5.92257200e+00,
6.50599600e+00, 6.64283300e+00, 6.28100600e+00,
5.43963200e+00, 5.08957400e+00, 5.38038600e+00,
5.50633800e+00, 5.62897900e+00, 5.19042900e+00,
4.84112700e+00, 4.63224600e+00, 4.76220200e+00,
4.69470800e+00, 4.51451000e+00, 4.58671400e+00,
4.67290700e+00, 4.57081400e+00, 4.47585900e+00,
4.42605100e+00, 4.37786600e+00, 4.38445800e+00,
4.39293100e+00, 4.40466700e+00, 4.41761000e+00,
4.37084000e+00, 4.20133400e+00, 4.03640900e+00,
3.99758200e+00, 3.97225900e+00, 3.89513500e+00,
3.76079000e+00, 3.63594700e+00, 3.81527700e+00,
3.99037900e+00, 4.23041800e+00, 4.51608500e+00,
4.76413100e+00, 4.79784600e+00, 4.83083700e+00,
6.93679600e+00, 9.88992600e+00, 1.41402000e+01,
2.17185200e+01, 2.91457900e+01, 3.96929600e+01,
5.04349000e+01, 6.08671100e+01, 7.10095300e+01,
8.43479200e+01, 1.11923300e+02, 1.38998100e+02,
1.94360100e+02, 2.52783000e+02, 3.20280200e+02,
3.93544100e+02, 4.69894600e+02, 5.53426000e+02,
6.41501600e+02, 7.71092500e+02, 8.98548200e+02,
1.06642900e+03, 1.23389900e+03, 1.45307300e+03,
1.68006300e+03, 2.07637800e+03, 2.51954400e+03,
3.27713300e+03, 4.12034400e+03, 5.07040900e+03,
6.02835400e+03, 6.34354100e+03, 6.44987700e+03,
5.89160400e+03, 5.06925600e+03, 4.04401800e+03,
3.04533400e+03, 2.16305800e+03, 1.42927300e+03,
9.42830700e+02, 8.61332300e+02, 9.09295200e+02,
1.23575300e+03, 1.77325600e+03, 3.36407200e+03,
5.26097100e+03, 5.71855000e+03, 5.98901400e+03,
5.82855400e+03, 5.67443100e+03])
self["P"] = numpy.array([ 5.00000000e-03, 1.61000000e-02, 3.84000000e-02,
7.69000000e-02, 1.37000000e-01, 2.24400000e-01,
3.45400000e-01, 5.06400000e-01, 7.14000000e-01,
9.75300000e-01, 1.29720000e+00, 1.68720000e+00,
2.15260000e+00, 2.70090000e+00, 3.33980000e+00,
4.07700000e+00, 4.92040000e+00, 5.87760000e+00,
6.95670000e+00, 8.16550000e+00, 9.51190000e+00,
1.10038000e+01, 1.26492000e+01, 1.44559000e+01,
1.64318000e+01, 1.85847000e+01, 2.09224000e+01,
2.34526000e+01, 2.61829000e+01, 2.91210000e+01,
3.22744000e+01, 3.56504000e+01, 3.92566000e+01,
4.31001000e+01, 4.71882000e+01, 5.15278000e+01,
5.61259000e+01, 6.09895000e+01, 6.61252000e+01,
7.15398000e+01, 7.72395000e+01, 8.32310000e+01,
8.95203000e+01, 9.61138000e+01, 1.03017000e+02,
1.10237000e+02, 1.17777000e+02, 1.25646000e+02,
1.33846000e+02, 1.42385000e+02, 1.51266000e+02,
1.60496000e+02, 1.70078000e+02, 1.80018000e+02,
1.90320000e+02, 2.00989000e+02, 2.12028000e+02,
2.23441000e+02, 2.35234000e+02, 2.47408000e+02,
2.59969000e+02, 2.72919000e+02, 2.86262000e+02,
3.00000000e+02, 3.14137000e+02, 3.28675000e+02,
3.43618000e+02, 3.58966000e+02, 3.74724000e+02,
3.90892000e+02, 4.07474000e+02, 4.24470000e+02,
4.41882000e+02, 4.59712000e+02, 4.77961000e+02,
4.96630000e+02, 5.15720000e+02, 5.35232000e+02,
5.55167000e+02, 5.75525000e+02, 5.96306000e+02,
6.17511000e+02, 6.39140000e+02, 6.61192000e+02,
6.83667000e+02, 7.06565000e+02, 7.29886000e+02,
7.53627000e+02, 7.77789000e+02, 8.02371000e+02,
8.27371000e+02, 8.52788000e+02, 8.78620000e+02,
9.04866000e+02, 9.31523000e+02, 9.58591000e+02,
9.86066000e+02, 1.01395000e+03, 1.04223000e+03,
1.07092000e+03, 1.10000000e+03])
self["CO2"] = numpy.array([ 311.3895, 311.3882, 311.3878, 311.3877, 311.3879, 311.3874,
311.388 , 311.3873, 311.3879, 311.3877, 311.3877, 311.3882,
311.388 , 311.3879, 311.388 , 311.3883, 311.3884, 311.3883,
311.3883, 311.3882, 311.3884, 311.3885, 311.3886, 311.3885,
311.3885, 311.3886, 311.3886, 311.3885, 311.3886, 311.3886,
311.3886, 311.3886, 311.3886, 311.3886, 311.3886, 311.3886,
311.3886, 311.3887, 311.3887, 311.3888, 311.3888, 311.3888,
311.8368, 312.3079, 312.7998, 313.3147, 313.8527, 314.4136,
314.9985, 315.6075, 316.2405, 316.8978, 317.5809, 318.2885,
319.0201, 319.7787, 320.5633, 321.3738, 321.3704, 321.3672,
321.3629, 321.354 , 321.3453, 321.3275, 321.3088, 321.2871,
321.2635, 321.239 , 321.2121, 321.1838, 321.1422, 321.1012,
321.0473, 320.9934, 320.923 , 320.85 , 320.7227, 320.5802,
320.3368, 320.0658, 319.7604, 319.4525, 319.3512, 319.3171,
319.4965, 319.7608, 320.0903, 320.4113, 320.6948, 320.9306,
321.087 , 321.1132, 321.0978, 320.9928, 320.8201, 320.3088,
319.6992, 319.5521, 319.4652, 319.5168, 319.5663])
self["T"] = numpy.array([ 170.672, 167.1 , 177.713, 195.506, 207.725, 218.427,
235.452, 261.271, 286.139, 302.526, 307.761, 299.105,
277.321, 254.123, 242.604, 242.111, 244.188, 247.235,
249.79 , 251.021, 249.495, 247.35 , 245.156, 243.382,
241.117, 238.603, 237.177, 235.891, 234.271, 232.728,
231.48 , 230.272, 230.403, 230.58 , 230.857, 231.173,
231.319, 231.125, 230.936, 230.468, 229.983, 229.041,
227.593, 226.199, 225.705, 225.223, 225.188, 225.476,
225.743, 225.913, 226.079, 225.665, 225.013, 224.05 ,
222.293, 220.571, 219.676, 218.897, 218.878, 219.527,
220.435, 222.487, 224.501, 226.873, 229.258, 231.594,
233.885, 236.173, 238.493, 240.796, 243.218, 245.601,
248.126, 250.621, 253.108, 255.562, 257.808, 259.968,
261.977, 263.921, 265.771, 267.581, 269.295, 270.928,
272.357, 273.557, 274.577, 275.147, 275.554, 275.814,
276.066, 276.464, 277.23 , 278.183, 278.559, 276.474,
273.474, 274.53 , 274.81 , 274.81 , 274.81 ])
self["O3"] = numpy.array([ 0.2033725 , 0.2424187 , 0.3208637 , 0.4562969 , 0.736027 ,
1.047125 , 1.27765 , 1.424369 , 1.592244 , 1.945423 ,
2.494494 , 3.276502 , 4.362954 , 5.659009 , 6.054292 ,
6.016611 , 5.807721 , 5.465095 , 5.068172 , 4.685214 ,
4.427215 , 4.293835 , 4.20855 , 4.135007 , 4.034985 ,
3.921192 , 3.781656 , 3.644418 , 3.521658 , 3.404957 ,
3.31342 , 3.224845 , 3.115542 , 3.008671 , 2.838926 ,
2.645074 , 2.436685 , 2.192161 , 1.954276 , 1.756302 ,
1.566934 , 1.406719 , 1.277961 , 1.153048 , 1.06527 ,
0.9795561 , 0.90675 , 0.8436835 , 0.7768094 , 0.6765951 ,
0.5785423 , 0.4980748 , 0.4259511 , 0.3548743 , 0.284146 ,
0.2148278 , 0.170396 , 0.1296997 , 0.09665075, 0.07037028,
0.04774848, 0.0390997 , 0.03060822, 0.02923244, 0.02885916,
0.02934259, 0.03040131, 0.03152678, 0.03279865, 0.03412979,
0.03602205, 0.0378829 , 0.03856705, 0.03917781, 0.03968628,
0.04016728, 0.04066729, 0.04116737, 0.04188355, 0.04265563,
0.04372776, 0.04484095, 0.0448461 , 0.04464854, 0.0438066 ,
0.04338835, 0.04330029, 0.04399183, 0.04493602, 0.0461 ,
0.04719323, 0.04845931, 0.05025693, 0.05333931, 0.05646073,
0.05959075, 0.06483308, 0.05655864, 0.0507791 , 0.05078729,
0.05079517])
self["CTP"] = 500.0
self["CFRACTION"] = 0.0
self["IDG"] = 0
self["ISH"] = 0
self["ELEVATION"] = 0.0
self["S2M"]["T"] = 274.81
self["S2M"]["Q"] = 6138.87608117
self["S2M"]["O"] = 0.0507714396589
self["S2M"]["P"] = 1016.79
self["S2M"]["U"] = 8.31799
self["S2M"]["V"] = -1.2184
self["S2M"]["WFETC"] = 100000.0
self["SKIN"]["SURFTYPE"] = 1
self["SKIN"]["WATERTYPE"] = 1
self["SKIN"]["T"] = 272.988
self["SKIN"]["SALINITY"] = 35.0
self["SKIN"]["FOAM_FRACTION"] = 0.0
self["SKIN"]["FASTEM"] = numpy.array([ 3. , 5. , 15. , 0.1, 0.3])
self["ZENANGLE"] = 0.0
self["AZANGLE"] = 0.0
self["SUNZENANGLE"] = 0.0
self["SUNAZANGLE"] = 0.0
self["LATITUDE"] = 80.1708
self["GAS_UNITS"] = 2
self["BE"] = 0.0
self["COSBK"] = 0.0
self["DATE"] = numpy.array([1992, 7, 15])
self["TIME"] = numpy.array([18, 0, 0])
| 54.26506 | 92 | 0.571603 | 1,390 | 9,008 | 3.702158 | 0.435971 | 0.014574 | 0.023319 | 0.024485 | 0.037505 | 0.02876 | 0.018267 | 0.012826 | 0.012826 | 0.012826 | 0 | 0.665269 | 0.25877 | 9,008 | 165 | 93 | 54.593939 | 0.105437 | 0.010546 | 0 | 0 | 0 | 0 | 0.027088 | 0.003934 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0 | 0 | 0 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
2fa4bb5e606b31eeef997386be13e4aa1bf047f9 | 1,239 | py | Python | src/waldur_core/core/api_groups_mapping.py | ahti87/waldur-mastermind | 772268e62dfd8eadb387b2ec3789785817a6e621 | [
"MIT"
] | null | null | null | src/waldur_core/core/api_groups_mapping.py | ahti87/waldur-mastermind | 772268e62dfd8eadb387b2ec3789785817a6e621 | [
"MIT"
] | null | null | null | src/waldur_core/core/api_groups_mapping.py | ahti87/waldur-mastermind | 772268e62dfd8eadb387b2ec3789785817a6e621 | [
"MIT"
] | null | null | null | API_GROUPS = {
'authentication': ['/api-auth/', '/api/auth-valimo/',],
'user': ['/api/users/', '/api/user-invitations/', '/api/user-counters/',],
'organization': [
'/api/customers/',
'/api/customer-permissions-log/',
'/api/customer-permissions-reviews/',
'/api/customer-permissions/',
],
'marketplace': [
'/api/marketplace-bookings/',
'/api/marketplace-cart-items/',
'/api/marketplace-categories/',
'/api/marketplace-category-component-usages/',
'/api/marketplace-checklists-categories/',
'/api/marketplace-checklists/',
'/api/marketplace-component-usages/',
'/api/marketplace-offering-files/',
'/api/marketplace-offerings/',
'/api/marketplace-order-items/',
'/api/marketplace-orders/',
'/api/marketplace-plans/',
'/api/marketplace-plugins/',
'/api/marketplace-public-api/',
'/api/marketplace-resource-offerings/',
'/api/marketplace-resources/',
'/api/marketplace-screenshots/',
'/api/marketplace-service-providers/',
],
'reporting': [
'/api/support-feedback-average-report/',
'/api/support-feedback-report/',
],
}
| 35.4 | 78 | 0.583535 | 106 | 1,239 | 6.811321 | 0.396226 | 0.34903 | 0.091413 | 0.080332 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.216303 | 1,239 | 34 | 79 | 36.441176 | 0.743563 | 0 | 0 | 0.088235 | 0 | 0 | 0.678773 | 0.580307 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 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 | 1 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
2fa4e15f7417a6448e8ac7c6f3304b5c54934d36 | 1,758 | py | Python | python/345.py | kylekanos/project-euler-1 | af7089356a4cea90f8ef331cfdc65e696def6140 | [
"BSD-2-Clause-FreeBSD"
] | null | null | null | python/345.py | kylekanos/project-euler-1 | af7089356a4cea90f8ef331cfdc65e696def6140 | [
"BSD-2-Clause-FreeBSD"
] | null | null | null | python/345.py | kylekanos/project-euler-1 | af7089356a4cea90f8ef331cfdc65e696def6140 | [
"BSD-2-Clause-FreeBSD"
] | 1 | 2019-09-17T00:55:58.000Z | 2019-09-17T00:55:58.000Z | #!/usr/bin/env python
s="""
7 53 183 439 863 497 383 563 79 973 287 63 343 169 583
627 343 773 959 943 767 473 103 699 303 957 703 583 639 913
447 283 463 29 23 487 463 993 119 883 327 493 423 159 743
217 623 3 399 853 407 103 983 89 463 290 516 212 462 350
960 376 682 962 300 780 486 502 912 800 250 346 172 812 350
870 456 192 162 593 473 915 45 989 873 823 965 425 329 803
973 965 905 919 133 673 665 235 509 613 673 815 165 992 326
322 148 972 962 286 255 941 541 265 323 925 281 601 95 973
445 721 11 525 473 65 511 164 138 672 18 428 154 448 848
414 456 310 312 798 104 566 520 302 248 694 976 430 392 198
184 829 373 181 631 101 969 613 840 740 778 458 284 760 390
821 461 843 513 17 901 711 993 293 157 274 94 192 156 574
34 124 4 878 450 476 712 914 838 669 875 299 823 329 699
815 559 813 459 522 788 168 586 966 232 308 833 251 631 107
813 883 451 509 615 77 281 613 459 205 380 274 302 35 805
"""
arr = []
sarr = s.split('\n')
for i in xrange(1,16):
arr.append([])
sarr2 = sarr[i].split(' ')
for j in xrange(15):
arr[i-1].append(int(sarr2[j]))
maxsum = [0]*15
prev = 0
for j in xrange(14,-1,-1):
big = 0
for i in xrange(15):
big = max(big,arr[i][j])
maxsum[j] = prev+big
prev=maxsum[j]
maxsum.append(0)
#print maxsum
#def calcmins(marr, iarr):
# prev=0
# for j in xrange(14,-1,-1):
# iarr[j] = prev+arr[j][marr[j]]
# prev = iarr[j]
best=0
def recurse(j, tot, s, row):
if j==15:
global best
best = max(best, tot)
for i in xrange(15):
if (s>>i)&1 or tot+arr[i][j]+maxsum[j+1] < best: continue
row[j]=i
recurse(j+1,tot+arr[i][j],s|(1<<i),row)
#if j==1 or j==2: print j,i
rowuse = [0]*15
recurse(0,0,0,rowuse)
print best
| 28.354839 | 65 | 0.632537 | 388 | 1,758 | 2.865979 | 0.608247 | 0.043165 | 0.016187 | 0.032374 | 0.084532 | 0.03777 | 0.03777 | 0.03777 | 0.03777 | 0 | 0 | 0.535852 | 0.26223 | 1,758 | 61 | 66 | 28.819672 | 0.321511 | 0.104096 | 0 | 0.044444 | 0 | 0 | 0.562859 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0.022222 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
2fbcd6e97434f0c483e0b9f7376b9e31fd73e295 | 569 | py | Python | faddr/database.py | kido5217/faddr | 116c789ac3985cc3f461203e249d8043dcb73428 | [
"MIT"
] | 1 | 2022-03-10T17:52:13.000Z | 2022-03-10T17:52:13.000Z | faddr/database.py | kido5217/faddr | 116c789ac3985cc3f461203e249d8043dcb73428 | [
"MIT"
] | 45 | 2021-08-08T15:23:42.000Z | 2022-03-28T20:23:57.000Z | faddr/database.py | kido5217/faddr | 116c789ac3985cc3f461203e249d8043dcb73428 | [
"MIT"
] | 1 | 2021-10-22T00:46:35.000Z | 2021-10-22T00:46:35.000Z | from tinydb import TinyDB
# TODO: redo this, maybe use SQL
class Database:
def __init__(self, db_file):
"""Create database file, erase previous one if exists."""
self.db = TinyDB(db_file)
# TODO: implement db files rotation, for now just replace all data
self.db.truncate()
# self.db_path = pathlib.Path(db_file)
# self.db_file_name = self.db_path.name
# self.db_dir = self.db_path.parent
def __db_path_is_writable(self, db_file):
pass
def insert(self, data):
self.db.insert(data)
| 28.45 | 74 | 0.643234 | 83 | 569 | 4.180723 | 0.493976 | 0.172911 | 0.086455 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.260105 | 569 | 19 | 75 | 29.947368 | 0.824228 | 0.45167 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.052632 | 0 | 1 | 0.333333 | false | 0.111111 | 0.111111 | 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 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
2fcf3382e080f3b77010b56e004724a5a0e7a4f8 | 1,806 | py | Python | models/peak.py | anva-kn/ramanflow | 0a8852a0a8d57d97e5ccd011bc6bc8659ecd666c | [
"MIT"
] | null | null | null | models/peak.py | anva-kn/ramanflow | 0a8852a0a8d57d97e5ccd011bc6bc8659ecd666c | [
"MIT"
] | 1 | 2021-12-05T06:40:27.000Z | 2021-12-07T07:18:18.000Z | models/peak.py | anva-kn/ramanflow | 0a8852a0a8d57d97e5ccd011bc6bc8659ecd666c | [
"MIT"
] | null | null | null | import numpy as np
from dataclasses import dataclass, field
from spectrum_component import SpectrumComponent
from scipy.optimize import minimize
from typing import List, Optional
@dataclass
class Peak(SpectrumComponent):
__beta_fit: np.ndarray = field(init=False)
__yhat_fit: np.ndarray = field(init=False)
def fit(self, x_data, y_data, range_of_indices=None):
"""
Parameters
----------
x_data
y_data
Returns
-------
"""
# find the coefficients beta that best fit the function
# TODO: add verbose option
if range_of_indices is not None:
peak_pos = list(range(range_of_indices[0], range_of_indices[1], 1))
result = minimize(self.loss_fit_beta, self.get_beta_init(), args=(x_data[peak_pos], y_data[peak_pos]),
method='Nelder-Mead',
tol=1e-12)
else:
result = minimize(self.loss_fit_beta, self.get_beta_init(), args=(x_data, y_data),
method='Nelder-Mead',
tol=1e-12)
# params, params_covariance = curve_fit(self.fit_fun, x_data, y_rec, p0=self.__beta_init)
self.__beta_fit = result.x
self.__loss_fit = result.fun
self.__yhat_fit = self.fit_fun(x_data, self.__beta_fit)
return self.__yhat_fit
def get_beta_init(self):
return super().get_beta_init()
def get_beta_size(self):
return super().get_beta_size()
def get_beta_fit(self):
return self.__beta_fit
def get_loss_fit(self):
return self.__loss_fit
def get_yhat_fit(self):
return self.__yhat_fit
def reset(self):
self.__beta_fit = np.zeros(1)
self.__yhat_fit = np.zeros(1) | 30.1 | 114 | 0.611849 | 242 | 1,806 | 4.202479 | 0.305785 | 0.048181 | 0.023599 | 0.029499 | 0.318584 | 0.235988 | 0.104228 | 0.104228 | 0.104228 | 0.104228 | 0 | 0.00936 | 0.290144 | 1,806 | 60 | 115 | 30.1 | 0.783931 | 0.121816 | 0 | 0.166667 | 0 | 0 | 0.014483 | 0 | 0 | 0 | 0 | 0.016667 | 0 | 1 | 0.194444 | false | 0 | 0.138889 | 0.138889 | 0.583333 | 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 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
2fd57e4ea7c49631ccd30b28d1e5572f8c08ea1c | 537 | py | Python | 2020/examples-in-class-2020-10-22/list_vs_dictionary1.py | ati-ozgur/course-python | 38237d120043c07230658b56dc3aeb01c3364933 | [
"Apache-2.0"
] | 1 | 2021-02-04T16:59:11.000Z | 2021-02-04T16:59:11.000Z | 2020/examples-in-class-2020-10-22/list_vs_dictionary1.py | ati-ozgur/course-python | 38237d120043c07230658b56dc3aeb01c3364933 | [
"Apache-2.0"
] | null | null | null | 2020/examples-in-class-2020-10-22/list_vs_dictionary1.py | ati-ozgur/course-python | 38237d120043c07230658b56dc3aeb01c3364933 | [
"Apache-2.0"
] | 1 | 2019-10-30T14:37:48.000Z | 2019-10-30T14:37:48.000Z | # Ask user to enter their country name.
# print out their phone code.
l_country_phone_code = ["China","86","Germany","49","Turkey","90"]
def country_name_to_phone_code_list(country_name):
for index in range(len(l_country_phone_code)):
if l_country_phone_code[index] == country_name:
return l_country_phone_code[index+1]
def country_name_to_phone_code_dict(country_name):
pass
print(country_name_to_phone_code_list("Turkey"))
print(country_name_to_phone_code_list("Germany"))
print(country_name_to_phone_code_list("China")) | 26.85 | 66 | 0.795158 | 89 | 537 | 4.348315 | 0.337079 | 0.232558 | 0.167959 | 0.232558 | 0.49354 | 0.379845 | 0.24031 | 0 | 0 | 0 | 0 | 0.014344 | 0.091248 | 537 | 20 | 67 | 26.85 | 0.778689 | 0.121043 | 0 | 0 | 0 | 0 | 0.089362 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0.1 | 0 | 0 | 0.3 | 0.3 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
2fe1655ebd31d04947a0a2208508011d402682bf | 204 | py | Python | app/__init__.py | jesiqueira/work | 4baf5277af4ca0537fca9ba8eeec45d4281ef76d | [
"MIT"
] | null | null | null | app/__init__.py | jesiqueira/work | 4baf5277af4ca0537fca9ba8eeec45d4281ef76d | [
"MIT"
] | null | null | null | app/__init__.py | jesiqueira/work | 4baf5277af4ca0537fca9ba8eeec45d4281ef76d | [
"MIT"
] | null | null | null | from flask import Flask
def create_app():
app = Flask(__name__)
#Rotas
from app.controllers.main.rotas import main
#Registrar Blueprint
app.register_blueprint(main)
return app
| 15.692308 | 47 | 0.70098 | 26 | 204 | 5.269231 | 0.538462 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.230392 | 204 | 12 | 48 | 17 | 0.872611 | 0.117647 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.333333 | 0 | 0.666667 | 0.166667 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
2fe1e63f271fbc465668c88a0d44f3a5739d9e29 | 10,050 | py | Python | risk_register/rules.py | justin441/risk_management | 2f5f0f62aae34998db7cf4155297ce4f6a8d774e | [
"MIT"
] | null | null | null | risk_register/rules.py | justin441/risk_management | 2f5f0f62aae34998db7cf4155297ce4f6a8d774e | [
"MIT"
] | null | null | null | risk_register/rules.py | justin441/risk_management | 2f5f0f62aae34998db7cf4155297ce4f6a8d774e | [
"MIT"
] | null | null | null | import rules
# ------------predicates------------
# Processus
@rules.predicate
def is_process_manager(user, processus):
return processus.proc_manager == user
@rules.predicate
def is_process_upper_mgt(user, processus):
bu = processus.business_unit
return bu.bu_manager == user
# Activités
@rules.predicate
def is_activity_owner(user, activite):
return activite.responsable == user
@rules.predicate
def is_activity_supervisor(user, activite):
processus = activite.processus
return processus.proc_manager == user
@rules.predicate
def is_activity_upper_mgt(user, activite):
processus = activite.processus
bu = processus.business_unit
return bu.bu_manager == user
# Risques des activités
@rules.predicate
def is_activity_risk_reporter(user, activiterisque):
return activiterisque.soumis_par == user
@rules.predicate
def is_activity_risk_owner(user, activiterisque):
return activiterisque.proprietaire == user
@rules.predicate
def is_activity_risk_monitor(user, activiterisque):
activite = activiterisque.activite
return activite.responsable == user
@rules.predicate
def is_activity_risk_supervisor(user, activiterisque):
processus = activiterisque.activite.processus
return processus.proc_manager == user
@rules.predicate
def is_activity_risk_upper_mgt(user, activiterisque):
processus = activiterisque.activite.processus
bu = processus.business_unit
return bu.bu_manager == user
# Risques des processus
@rules.predicate
def is_process_risk_reporter(user, processusrisque):
if processusrisque.soumis_par:
return processusrisque.soumis_par == user
return False
@rules.predicate
def is_process_risk_owner(user, processusrisque):
return processusrisque.proprietaire == user
@rules.predicate
def is_process_risk_monitor(user, processusrisque):
processus = processusrisque.processus
return processus.proc_manager == user
@rules.predicate
def is_process_risk_upper_mgt(user, processusrisque):
bu = processusrisque.processus.business_unit
return bu.bu_manager == user
# Estimations
@rules.predicate
def is_estimation_monitor(user, estimation):
try:
return estimation.content_object.activite.processus.proc_manager == user
except AttributeError:
return estimation.content_object.processus.proc_manager == user
# Contrôles
@rules.predicate
def is_controle_creator(user, controle):
return controle.cree_par == user
@rules.predicate
def is_controle_owner(user, controle):
if controle.assigne_a:
return controle.assigne_a == user
return False
@rules.predicate
def is_controle_reviewer(user, controle):
try:
return controle.content_object.activite.processus.proc_manager == user
except AttributeError:
return controle.content_object.processus.proc_manager == user
# Risques
@rules.predicate
def is_risk_creator(user, risque):
return risque.cree_par == user
# Identification Risques
@rules.predicate
def is_risk_verifier(user, identificationrisque):
if identificationrisque.get_class == 'ProcessusRisque':
return is_process_risk_monitor(user, identificationrisque) \
or is_process_risk_upper_mgt(user, identificationrisque)
elif identificationrisque.get_class == 'ActiviteRisque':
return is_activity_risk_monitor(user, identificationrisque) \
or is_activity_risk_supervisor(user, identificationrisque) \
or is_activity_risk_upper_mgt(user, identificationrisque)
# ------------rules------------
# Risques
rules.add_rule('change_risque', is_risk_creator)
# Identification Risques
rules.add_rule('verify_risk', is_risk_verifier)
# Processus
rules.add_rule('change_processus', is_process_upper_mgt)
rules.add_rule('delete_processus', is_process_upper_mgt)
rules.add_rule('add_activity_to_process', is_process_manager | is_process_upper_mgt)
rules.add_rule('add_process_data', is_process_manager | is_process_upper_mgt)
rules.add_rule('add_process_risk', rules.is_authenticated)
# Activités
rules.add_rule('change_activite', is_activity_supervisor | is_activity_upper_mgt)
rules.add_rule('delete_activite', is_activity_supervisor | is_activity_upper_mgt)
rules.add_rule('add_activity_risk', rules.is_authenticated)
rules.add_rule('complete_activity', is_activity_owner)
# Risques des activités
rules.add_rule('set_seuil_activity_risk', is_activity_risk_supervisor | is_activity_risk_upper_mgt)
rules.add_rule('set_review_date_activity_risk', is_activity_risk_supervisor | is_activity_risk_upper_mgt)
rules.add_rule('add_control_activity_risk', is_activity_risk_reporter | is_activity_risk_monitor |
is_activity_risk_owner | is_activity_risk_supervisor | is_activity_risk_upper_mgt)
rules.add_rule('assign_activity_risk', is_activity_risk_supervisor | is_activity_risk_upper_mgt)
rules.add_rule('estimate_activity_risk', is_activity_risk_supervisor | is_activity_risk_upper_mgt)
rules.add_rule('change_activiterisque', is_activity_risk_supervisor |
is_activity_risk_upper_mgt | is_activity_risk_reporter)
rules.add_rule('delete_activiterisque', is_activity_risk_supervisor | is_activity_risk_upper_mgt)
# Risques des processus
rules.add_rule('set_seuil_process_risk', is_process_risk_monitor | is_process_risk_upper_mgt)
rules.add_rule('set_review_date_process_risk', is_process_risk_upper_mgt | is_process_risk_monitor)
rules.add_rule('add_control_process_risk', is_process_risk_owner | is_process_risk_monitor | is_process_risk_upper_mgt
| is_activity_risk_reporter)
rules.add_rule('assign_process_risk', is_process_risk_monitor | is_process_risk_upper_mgt)
rules.add_rule('estimate_process_risk', is_process_risk_upper_mgt | is_process_risk_monitor)
rules.add_rule('change_processusrisque', is_process_risk_upper_mgt |
is_process_risk_monitor | is_process_risk_reporter)
rules.add_rule('delete_processusrisque', is_process_risk_monitor | is_process_risk_upper_mgt)
# Estimations
rules.add_rule('set_estimation_review_date', is_estimation_monitor)
# Contrôles
rules.add_rule('assign_control', is_controle_reviewer)
rules.add_rule('complete_control', is_controle_owner)
rules.add_rule('change_controle', is_controle_reviewer | is_controle_creator)
rules.add_rule('delete_controle', is_controle_creator | is_controle_reviewer)
rules.add_rule('approve_controle', is_controle_reviewer)
rules.add_rule('validate_controle_completion', is_controle_reviewer | is_controle_creator)
# ------------permissions------------
# Risques
rules.add_perm('risk_register.change_risque', is_risk_creator)
# Identification Risques
rules.add_perm('risk_register.verify_risque', is_risk_verifier)
# Processus
rules.add_perm('risk_register.change_processus', is_process_upper_mgt)
rules.add_perm('risk_register.delete_processus', is_process_upper_mgt)
rules.add_perm('risk_register.add_activity_to_process', is_process_manager | is_process_upper_mgt)
rules.add_perm('risk_register.add_process_data', is_process_manager | is_process_upper_mgt)
rules.add_perm('risk_register.add_process_risk', rules.is_authenticated)
# Activités
rules.add_perm('risk_register.change_activite', is_activity_supervisor | is_activity_upper_mgt)
rules.add_perm('risk_register.delete_activite', is_activity_supervisor | is_activity_upper_mgt)
rules.add_perm('risk_register.add_activity_risk', rules.is_authenticated)
rules.add_perm('risk_register_complete_activity', is_activity_owner)
# Risques des activités
rules.add_perm('risk_register.set_seuil_activity_risk', is_activity_risk_supervisor | is_activity_risk_upper_mgt)
rules.add_perm('risk_register.set_review_date_activity_risk', is_activity_risk_supervisor | is_activity_risk_upper_mgt)
rules.add_perm('risk_register.add_control_activity_risk', is_activity_risk_reporter | is_activity_risk_monitor |
is_activity_risk_owner | is_activity_risk_supervisor | is_activity_risk_upper_mgt)
rules.add_perm('risk_register.assign_activity_risk', is_activity_risk_supervisor | is_activity_risk_upper_mgt)
rules.add_perm('risk_register.estimate_activity_risk',
is_activity_risk_supervisor | is_activity_risk_upper_mgt | is_activity_risk_reporter)
rules.add_perm('risk_register.change_activiterisque', is_activity_risk_supervisor |
is_activity_risk_upper_mgt | is_activity_risk_reporter)
rules.add_perm('risk_register.delete_activiterisque', is_activity_risk_supervisor | is_activity_risk_upper_mgt)
# Risques des processus
rules.add_perm('risk_register.set_seuil_process_risk', is_process_risk_monitor | is_process_risk_upper_mgt)
rules.add_perm('risk_register.set_review_date_process_risk', is_process_risk_upper_mgt | is_process_risk_monitor)
rules.add_perm('risk_register.add_control_process_risk', is_process_risk_owner | is_process_risk_monitor |
is_process_risk_upper_mgt | is_process_risk_reporter)
rules.add_perm('risk_register.assign_process_risk', is_process_risk_monitor | is_process_risk_upper_mgt)
rules.add_perm('risk_register.estimate_process_risk', is_process_risk_upper_mgt | is_process_risk_monitor |
is_process_risk_owner | is_process_risk_reporter)
rules.add_perm('risk_register.change_processusrisque', is_process_risk_upper_mgt |
is_process_risk_monitor | is_process_risk_reporter)
rules.add_perm('risk_register.delete_processusrisque', is_process_risk_monitor | is_process_risk_upper_mgt)
# Estimations
rules.add_perm('risk_register.set_estimation_review_date', is_estimation_monitor)
# Contrôles
rules.add_perm('risk_register.assign_control', is_controle_reviewer)
rules.add_perm('risk_register.complete_control', is_controle_owner)
rules.add_perm('risk_register.change_controle', is_controle_reviewer | is_controle_creator)
rules.add_perm('risk_register.delete_controle', is_controle_creator | is_controle_reviewer)
rules.add_perm('risk_register.approve_controle', is_controle_reviewer)
rules.add_perm('risk_register.validate_controle_completion', is_controle_reviewer | is_controle_creator)
| 40.361446 | 119 | 0.816816 | 1,352 | 10,050 | 5.578402 | 0.058432 | 0.067887 | 0.085388 | 0.067887 | 0.878414 | 0.852692 | 0.739724 | 0.683903 | 0.641872 | 0.585256 | 0 | 0 | 0.100498 | 10,050 | 248 | 120 | 40.524194 | 0.834292 | 0.044876 | 0 | 0.304348 | 0 | 0 | 0.180441 | 0.149514 | 0 | 0 | 0 | 0 | 0 | 1 | 0.124224 | false | 0 | 0.006211 | 0.043478 | 0.285714 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
2fe6856451079b7092c8013f6dea797816021d81 | 263 | py | Python | dotplug/__init__.py | arubertoson/dotplug | c95e06add33864a43e4934e1c5e54f90eb5e262d | [
"MIT"
] | null | null | null | dotplug/__init__.py | arubertoson/dotplug | c95e06add33864a43e4934e1c5e54f90eb5e262d | [
"MIT"
] | 1 | 2018-07-24T07:47:08.000Z | 2018-07-24T07:47:08.000Z | dotplug/__init__.py | arubertoson/dotplug | c95e06add33864a43e4934e1c5e54f90eb5e262d | [
"MIT"
] | null | null | null | """
Entry Point
"""
import asyncio
from dotplug.main import main
from dotplug.console import ncurses
def _main():
import uvloop
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
with ncurses():
asyncio.run(main())
input("")
| 14.611111 | 59 | 0.676806 | 31 | 263 | 5.612903 | 0.612903 | 0.126437 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.212928 | 263 | 17 | 60 | 15.470588 | 0.84058 | 0.041825 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.111111 | true | 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 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
2ffa77f1e40ba05e4e11e3418487de31ab281199 | 679 | py | Python | stubs.min/System/Runtime/InteropServices/__init___parts/GuidAttribute.py | denfromufa/ironpython-stubs | 4d2b405eda3ceed186e8adca55dd97c332c6f49d | [
"MIT"
] | 1 | 2017-07-07T11:15:45.000Z | 2017-07-07T11:15:45.000Z | stubs.min/System/Runtime/InteropServices/__init___parts/GuidAttribute.py | hdm-dt-fb/ironpython-stubs | 4d2b405eda3ceed186e8adca55dd97c332c6f49d | [
"MIT"
] | null | null | null | stubs.min/System/Runtime/InteropServices/__init___parts/GuidAttribute.py | hdm-dt-fb/ironpython-stubs | 4d2b405eda3ceed186e8adca55dd97c332c6f49d | [
"MIT"
] | null | null | null | class GuidAttribute(Attribute,_Attribute):
"""
Supplies an explicit System.Guid when an automatic GUID is undesirable.
GuidAttribute(guid: str)
"""
def __init__(self,*args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x.__class__.__doc__ for signature """
pass
@staticmethod
def __new__(self,guid):
""" __new__(cls: type,guid: str) """
pass
Value=property(lambda self: object(),lambda self,v: None,lambda self: None)
"""Gets the System.Guid of the class.
Get: Value(self: GuidAttribute) -> str
"""
| 30.863636 | 215 | 0.687776 | 86 | 679 | 4.860465 | 0.453488 | 0.107656 | 0.114833 | 0.136364 | 0.270335 | 0.270335 | 0.270335 | 0.270335 | 0.270335 | 0.270335 | 0 | 0 | 0.173785 | 679 | 21 | 216 | 32.333333 | 0.745098 | 0.4919 | 0 | 0.285714 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.285714 | false | 0.285714 | 0 | 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 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
640924f10b1d56697c6fdd50eb6f54c032ea499e | 308 | py | Python | services/web/server/src/simcore_service_webserver/session.py | oetiker/osparc-simcore | 00918bf8f000840cc70cc49458780a55858d52ea | [
"MIT"
] | null | null | null | services/web/server/src/simcore_service_webserver/session.py | oetiker/osparc-simcore | 00918bf8f000840cc70cc49458780a55858d52ea | [
"MIT"
] | 2 | 2018-05-13T09:10:57.000Z | 2019-03-06T08:10:40.000Z | services/web/server/src/simcore_service_webserver/session.py | oetiker/osparc-simcore | 00918bf8f000840cc70cc49458780a55858d52ea | [
"MIT"
] | null | null | null | """ Session submodule
"""
from aiohttp import web
from servicelib.session import get_session
from servicelib.session import setup_session as do_setup_session
def setup(app: web.Application):
do_setup_session(app)
# alias
setup_session = setup
__all__ = (
"setup_session",
"get_session",
)
| 14.666667 | 64 | 0.746753 | 40 | 308 | 5.425 | 0.4 | 0.276498 | 0.193548 | 0.248848 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.168831 | 308 | 20 | 65 | 15.4 | 0.847656 | 0.077922 | 0 | 0 | 0 | 0 | 0.087273 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.1 | false | 0 | 0.3 | 0 | 0.4 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
640a9d4160e1e902532bad6cb3c3e5185242dc67 | 11,852 | py | Python | photometa/forms.py | Flantropy/photometalizer | 3ccfba4a8783f310a33d28c614252cb07bc48536 | [
"MIT"
] | null | null | null | photometa/forms.py | Flantropy/photometalizer | 3ccfba4a8783f310a33d28c614252cb07bc48536 | [
"MIT"
] | null | null | null | photometa/forms.py | Flantropy/photometalizer | 3ccfba4a8783f310a33d28c614252cb07bc48536 | [
"MIT"
] | null | null | null | from django.core.exceptions import ValidationError
from django.core.validators import FileExtensionValidator
from django.core.files.uploadedfile import InMemoryUploadedFile
from django.forms import Form, ModelForm, FileInput
from django.forms.fields import *
from captcha.fields import CaptchaField
from .models import Image
from exif import (
WhiteBalance,
ColorSpace,
ExposureMode,
SceneCaptureType,
SensingMethod,
MeteringMode,
)
def validate_image_size(image: InMemoryUploadedFile):
print(image.size)
file_size = image.size
limit = 10 * 1024 * 1024 # 10M
if file_size > limit:
raise ValidationError(f'Максимальный размер файла {limit // (1024 * 1024)}M')
class ImageUploadForm(ModelForm):
ALLOWED_EXTENSIONS = ['jpg', 'jpeg']
captcha = CaptchaField(label='')
img = ImageField(
label='Фото',
widget=FileInput(attrs={'multiple': True}),
validators=[
FileExtensionValidator(allowed_extensions=ALLOWED_EXTENSIONS),
validate_image_size
],
help_text=f'Доступные расщирения: {ALLOWED_EXTENSIONS}',
)
class Meta:
model = Image
fields = ['img']
class ExifEditorForm(Form):
make = CharField(help_text='Hint', required=False)
white_balance = TypedChoiceField(
coerce=int,
choices=[(x.value, x.name) for x in WhiteBalance],
help_text='Баланс белого',
required=False)
model = CharField(help_text='Hint', required=False)
software = CharField(help_text='Hint', required=False)
focal_length = FloatField(help_text='Фокусное расстояние', required=False)
color_space = TypedChoiceField(
coerce=int,
choices=[(x.value, x.name) for x in ColorSpace],
help_text='Hint',
required=False)
exposure_mode = TypedChoiceField(
coerce=int,
choices=[(x.value, x.name) for x in ExposureMode],
help_text='Hint',
required=False)
scene_capture_type = TypedChoiceField(
coerce=int,
choices=[(x.value, x.name) for x in SceneCaptureType],
help_text='Hint',
required=False)
x_resolution = FloatField(help_text='Hint', required=False)
y_resolution = FloatField(help_text='Hint', required=False)
digital_zoom_ratio = FloatField(help_text='Hint', required=False)
custom_rendered = IntegerField(help_text='Hint', required=False)
sensing_method = TypedChoiceField(
coerce=int,
choices=[(x.value, x.name) for x in SensingMethod],
help_text='Hint',
required=False)
metering_mode = TypedChoiceField(
coerce=int,
choices=[(x.value, x.name) for x in MeteringMode],
help_text='Hint',
required=False)
compressed_bits_per_pixel = FloatField(help_text='Hint', required=False)
shutter_speed_value = FloatField(help_text='Hint', required=False)
aperture_value = FloatField(help_text='Hint', required=False)
brightness_value = FloatField(help_text='Hint', required=False, initial=1.0)
exposure_bias_value = FloatField(help_text='Hint', required=False)
max_aperture_value = FloatField(help_text='Hint', required=False)
datetime = CharField(help_text='YYYY:MM:DD HH:MM:SS', required=False)
datetime_original = CharField(help_text='YYYY:MM:DD HH:MM:SS', required=False)
datetime_digitized = CharField(help_text='YYYY:MM:DD HH:MM:SS', required=False)
# image_width = IntegerField(help_text='ширина изображения', required=False)
# image_height = IntegerField(help_text='высота изображиния', required=False)
# bits_per_sample = CharField(help_text='Hint', required=False)
# compression = CharField(help_text='Hint', required=False)
# photometric_interpretation = CharField(help_text='Hint', required=False)
# orientation = CharField(help_text='Hint', required=False)
# samples_per_pixel = CharField(help_text='Hint', required=False)
# planar_configuration = CharField(help_text='Hint', required=False)
# subsampling_ratio_of_y_to_c = CharField(help_text='Hint', required=False)
# y_and_c_positioning = CharField(help_text='Hint', required=False)
# resolution_unit = CharField(help_text='Hint', required=False)
# strip_offsets = CharField(help_text='Hint', required=False)
# rows_per_strip = CharField(help_text='Hint', required=False)
# strip_byte_counts = CharField(help_text='Hint', required=False)
# jpeg_interchange_format = CharField(help_text='Hint', required=False)
# jpeg_interchange_format_length = CharField(help_text='Hint', required=False)
# transfer_function = CharField(help_text='Hint', required=False)
# white_point = CharField(help_text='Hint', required=False)
# primary_chromaticities = CharField(help_text='Hint', required=False)
# matrix_coefficients = CharField(help_text='Hint', required=False)
# reference_black_white = CharField(help_text='Hint', required=False)
# image_description = CharField(help_text='Hint', required=False)
# artist = CharField(help_text='Hint', required=False)
# copyright = CharField(help_text='Hint', required=False)
# exposure_time = CharField(help_text='Hint', required=False)
# f_number = CharField(help_text='Hint', required=False)
# exposure_program = CharField(help_text='Hint', required=False)
# spectral_sensitivity = CharField(help_text='Hint', required=False)
# photographic_sensitivity = CharField(help_text='Hint', required=False)
# oecf = CharField(help_text='Hint', required=False)
# sensitivity_type = CharField(help_text='Hint', required=False)
# standard_output_sensitivity = CharField(help_text='Hint', required=False)
# recommended_exposure_index = CharField(help_text='Hint', required=False)
# iso_speed = CharField(help_text='Hint', required=False)
# iso_speed_latitude_yyy = CharField(help_text='Hint', required=False)
# iso_speed_latitude_zzz = CharField(help_text='Hint', required=False)
# exif_version = CharField(help_text='Hint', required=False)
# offset_time = CharField(help_text='Hint', required=False)
# offset_time_original = CharField(help_text='Hint', required=False)
# offset_time_digitized = CharField(help_text='Hint', required=False)
# components_configuration = CharField(help_text='Hint', required=False)
# subject_distance = CharField(help_text='Hint', required=False)
# light_source = CharField(help_text='Hint', required=False)
# flash = CharField(help_text='Hint', required=False)
# subject_area = CharField(help_text='Hint', required=False)
# maker_note = CharField(help_text='Hint', required=False)
# user_comment = CharField(help_text='Hint', required=False)
# subsec_time = CharField(help_text='Hint', required=False)
# subsec_time_original = CharField(help_text='Hint', required=False)
# subsec_time_digitized = CharField(help_text='Hint', required=False)
# temperature = CharField(help_text='Hint', required=False)
# humidity = CharField(help_text='Hint', required=False)
# pressure = CharField(help_text='Hint', required=False)
# water_depth = CharField(help_text='Hint', required=False)
# acceleration = CharField(help_text='Hint', required=False)
# camera_elevation_angle = CharField(help_text='Hint', required=False)
# xp_title = CharField(help_text='Hint', required=False)
# xp_comment = CharField(help_text='Hint', required=False)
# xp_author = CharField(help_text='Hint', required=False)
# xp_keywords = CharField(help_text='Hint', required=False)
# xp_subject = CharField(help_text='Hint', required=False)
# flashpix_version = CharField(help_text='Hint', required=False)
# pixel_x_dimension = CharField(help_text='Hint', required=False)
# pixel_y_dimension = CharField(help_text='Hint', required=False)
# related_sound_file = CharField(help_text='Hint', required=False)
# flash_energy = CharField(help_text='Hint', required=False)
# spatial_frequency_response = CharField(help_text='Hint', required=False)
# focal_plane_x_resolution = CharField(help_text='Hint', required=False)
# focal_plane_y_resolution = CharField(help_text='Hint', required=False)
# focal_plane_resolution_unit = CharField(help_text='Hint', required=False)
# subject_location = CharField(help_text='Hint', required=False)
# exposure_index = CharField(help_text='Hint', required=False)
# file_source = CharField(help_text='Hint', required=False)
# scene_type = CharField(help_text='Hint', required=False)
# cfa_pattern = CharField(help_text='Hint', required=False)
# focal_length_in_35mm_film = CharField(help_text='Hint', required=False)
# gain_control = CharField(help_text='Hint', required=False)
# contrast = CharField(help_text='Hint', required=False)
# saturation = CharField(help_text='Hint', required=False)
# sharpness = CharField(help_text='Hint', required=False)
# device_setting_description = CharField(help_text='Hint', required=False)
# subject_distance_range = CharField(help_text='Hint', required=False)
# image_unique_id = CharField(help_text='Hint', required=False)
# camera_owner_name = CharField(help_text='Hint', required=False)
# body_serial_number = CharField(help_text='Hint', required=False)
# lens_specification = CharField(help_text='Hint', required=False)
# lens_make = CharField(help_text='Hint', required=False)
# lens_model = CharField(help_text='Hint', required=False)
# lens_serial_number = CharField(help_text='Hint', required=False)
# gamma = CharField(help_text='Hint', required=False)
# gps_version_id = CharField(help_text='Hint', required=False)
# gps_latitude_ref = CharField(help_text='Hint', required=False)
# gps_latitude = CharField(help_text='Hint', required=False)
# gps_longitude_ref = CharField(help_text='Hint', required=False)
# gps_longitude = CharField(help_text='Hint', required=False)
# gps_altitude_ref = CharField(help_text='Hint', required=False)
# gps_altitude = CharField(help_text='Hint', required=False)
# gps_timestamp = CharField(help_text='Hint', required=False)
# gps_satellites = CharField(help_text='Hint', required=False)
# gps_status = CharField(help_text='Hint', required=False)
# gps_measure_mode = CharField(help_text='Hint', required=False)
# gps_dop = CharField(help_text='Hint', required=False)
# gps_speed_ref = CharField(help_text='Hint', required=False)
# gps_speed = CharField(help_text='Hint', required=False)
# gps_track_ref = CharField(help_text='Hint', required=False)
# gps_track = CharField(help_text='Hint', required=False)
# gps_img_direction_ref = CharField(help_text='Hint', required=False)
# gps_img_direction = CharField(help_text='Hint', required=False)
# gps_map_datum = CharField(help_text='Hint', required=False)
# gps_dest_latitude_ref = CharField(help_text='Hint', required=False)
# gps_dest_latitude = CharField(help_text='Hint', required=False)
# gps_dest_longitude_ref = CharField(help_text='Hint', required=False)
# gps_dest_longitude = CharField(help_text='Hint', required=False)
# gps_dest_bearing_ref = CharField(help_text='Hint', required=False)
# gps_dest_bearing = CharField(help_text='Hint', required=False)
# gps_dest_distance_ref = CharField(help_text='Hint', required=False)
# gps_dest_distance = CharField(help_text='Hint', required=False)
# gps_processing_method = CharField(help_text='Hint', required=False)
# gps_area_information = CharField(help_text='Hint', required=False)
# gps_datestamp = CharField(help_text='Hint', required=False)
# gps_differential = CharField(help_text='Hint', required=False)
# gps_horizontal_positioning_error = CharField(help_text='Hint', required=False)
| 54.118721 | 85 | 0.724435 | 1,433 | 11,852 | 5.739707 | 0.181438 | 0.142006 | 0.201337 | 0.335562 | 0.747356 | 0.735198 | 0.59003 | 0.329726 | 0.166201 | 0.054711 | 0 | 0.002386 | 0.151451 | 11,852 | 218 | 86 | 54.366972 | 0.815452 | 0.648161 | 0 | 0.202381 | 0 | 0 | 0.068216 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.011905 | false | 0 | 0.095238 | 0 | 0.452381 | 0.011905 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
6427067cb0803864cbac859e6090f9b18cef3bcf | 1,090 | py | Python | engine/vector.py | dbrizov/PyTetris | f783526a37944452607d86c5def28dbaf3cd4481 | [
"MIT"
] | 3 | 2018-07-19T11:59:02.000Z | 2021-12-19T15:05:02.000Z | engine/vector.py | dbrizov/PyTetris | f783526a37944452607d86c5def28dbaf3cd4481 | [
"MIT"
] | null | null | null | engine/vector.py | dbrizov/PyTetris | f783526a37944452607d86c5def28dbaf3cd4481 | [
"MIT"
] | null | null | null | import math
class Vector2(tuple):
def __new__(cls, x, y):
return tuple.__new__(cls, (x, y))
@property
def x(self):
return self[0]
@property
def y(self):
return self[1]
def __add__(self, vector):
return Vector2(self.x + vector.x, self.y + vector.y)
def __sub__(self, vector):
return Vector2(self.x - vector.x, self.y - vector.y)
def __mul__(self, scalar):
return Vector2(self.x * scalar, self.y * scalar)
def __truediv__(self, scalar):
return Vector2(self.x / scalar, self.y / scalar)
def __eq__(self, other):
return self.x == other.x and self.y == other.y
def __str__(self):
return "({0:.2f}, {1:.2f})".format(self.x, self.y)
@property
def magnitude(self):
return math.sqrt(self.x * self.x + self.y * self.y)
@property
def magnitude_sqr(self):
return self.x * self.x + self.y * self.y
@property
def normalized(self):
return Vector2(self.x / self.magnitude, self.y / self.magnitude)
Vector2.ZERO = Vector2(0, 0)
| 22.708333 | 72 | 0.590826 | 157 | 1,090 | 3.89172 | 0.203822 | 0.090016 | 0.08838 | 0.1473 | 0.477905 | 0.422259 | 0.422259 | 0.422259 | 0.422259 | 0.422259 | 0 | 0.020101 | 0.269725 | 1,090 | 47 | 73 | 23.191489 | 0.747487 | 0 | 0 | 0.15625 | 0 | 0 | 0.016514 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.375 | false | 0 | 0.03125 | 0.375 | 0.8125 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
644292c4d61839088d132ddd059480c729616e9c | 2,604 | py | Python | RL.py | apurva-rai/Reinforcement_Learning | 9b979b9dd1f63cb966be3230f1aab494d0d477cb | [
"MIT"
] | null | null | null | RL.py | apurva-rai/Reinforcement_Learning | 9b979b9dd1f63cb966be3230f1aab494d0d477cb | [
"MIT"
] | null | null | null | RL.py | apurva-rai/Reinforcement_Learning | 9b979b9dd1f63cb966be3230f1aab494d0d477cb | [
"MIT"
] | null | null | null | import numpy as np
#SARSA class that has function to train and test simple treasure finding path
class SARSA:
def __init__(self,a,r,action,reward,Q):
if a is None:
self.a = 0.5
if r is None:
self.r = 0.75
self.a = a
self.r = r
self.action = action
self.reward = reward
self.Q = Q
def trainer(self,i):
for j in range(i):
state = np.random.randint(0,int(len(self.Q)))
currentActions = []
for k in range(int(len(self.Q))):
if 0 <= self.reward[state,k]:
currentActions.append(k)
next = int(np.random.choice(currentActions,1))
nextActions = []
for act,val in enumerate(self.Q[next,]):
if 0 < val:
nextActions.append(act)
nextAction = int(np.random.choice(nextActions,1))
timeDiff = self.reward[state,next] + self.r * self.Q[next,nextAction] - self.Q[state,next]
self.Q[state,next] += self.a * timeDiff
def tester(self,start,end):
state = start
path = [state]
while state != end:
nextActions = []
for act,val in enumerate(self.Q[state,]):
if 0 < val:
nextActions.append(act)
next = int(np.random.choice(nextActions,1))
path.append(next)
state = next
return path
#Q-Learning class that has functions to train and test simple treasure finding path
class QL:
def __init__(self, a, r, action, reward, Q):
if a is None:
self.a = 0.5
if r is None:
self.r = 0.75
self.a = a
self.r = r
self.action = action
self.reward = reward
self.Q = Q
def trainer(self, i):
for j in range(i):
state = np.random.randint(0, int(len(self.Q)))
currentActions = []
for k in range(int(len(self.Q))):
if 0 <= self.reward[state,k]:
currentActions.append(k)
nextState = int(np.random.choice(currentActions,1))
timeDiff = self.reward[state,nextState] + self.r * self.Q[nextState,np.argmax(self.Q[nextState,])] - self.Q[state,nextState]
self.Q[state,nextState] += self.a * timeDiff
def tester(self,start,end):
state = start
path = [state]
while state != end:
next = np.argmax(self.Q[state,])
path.append(next)
state = next
return path
| 27.702128 | 136 | 0.519585 | 335 | 2,604 | 4.014925 | 0.191045 | 0.05948 | 0.04461 | 0.032714 | 0.854275 | 0.793309 | 0.628996 | 0.579926 | 0.526394 | 0.460967 | 0 | 0.012129 | 0.366743 | 2,604 | 93 | 137 | 28 | 0.803517 | 0.060676 | 0 | 0.794118 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.088235 | false | 0 | 0.014706 | 0 | 0.161765 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
ff56d4da695b936f27e4f59c482e9fc6e6d38fb1 | 1,202 | py | Python | ServerPackage/Game.py | PaulieC/rls | fbff3a303a981a65069c9dc679c15d61056b88f1 | [
"Apache-2.0"
] | null | null | null | ServerPackage/Game.py | PaulieC/rls | fbff3a303a981a65069c9dc679c15d61056b88f1 | [
"Apache-2.0"
] | null | null | null | ServerPackage/Game.py | PaulieC/rls | fbff3a303a981a65069c9dc679c15d61056b88f1 | [
"Apache-2.0"
] | null | null | null | __author__ = "Paul Council, Joseph Gonzoph, Anand Patel"
__version__ = "sprint1"
__credits__ = ["Matt Martorana, Justin Read"]
# imports
from ServerPackage import Observer
class Game(Observer.Observer):
name = None
@staticmethod
def num_players_per_game():
"""
Number of players in a game. Default setting is two-player games
:return: the number of players this game will support
:rtype: int
"""
return 2
def get_result(self, moves):
"""
Computes the result for the given moves.
child of this class will have to figure out how win/loss/tie
is determined moves
Don't forget an elimination process if move is illegal
:param moves: A list containing the moves made by the players
:type moves: list
:return: a list containing the result for the players
"""
pass
def is_legal(self, move):
"""
Checks if a given move is legal
:param move: given move
:type move: int
:return: True if the move is legal, false otherwise
:rtype: bool
"""
pass
def get_name(self):
return self.name
| 26.711111 | 72 | 0.616473 | 156 | 1,202 | 4.634615 | 0.544872 | 0.024896 | 0.041494 | 0.041494 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.002439 | 0.317804 | 1,202 | 44 | 73 | 27.318182 | 0.879268 | 0.488353 | 0 | 0.133333 | 0 | 0 | 0.167038 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.266667 | false | 0.133333 | 0.066667 | 0.066667 | 0.6 | 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 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
ff5986eb7d80707f56a8beab2a20415bc7fe42b3 | 23,051 | py | Python | Kevin/4.py | kevin-ci/advent-of-code-2020 | 697dd3d2639e30e59b228fa417ca5a76cd94f9e5 | [
"MIT"
] | null | null | null | Kevin/4.py | kevin-ci/advent-of-code-2020 | 697dd3d2639e30e59b228fa417ca5a76cd94f9e5 | [
"MIT"
] | null | null | null | Kevin/4.py | kevin-ci/advent-of-code-2020 | 697dd3d2639e30e59b228fa417ca5a76cd94f9e5 | [
"MIT"
] | null | null | null | import re
input = """iyr:2010 ecl:gry hgt:181cm
pid:591597745 byr:1920 hcl:#6b5442 eyr:2029 cid:123
cid:223 byr:1927
hgt:177cm hcl:#602927 iyr:2016 pid:404183620
ecl:amb
eyr:2020
byr:1998
ecl:hzl
cid:178 hcl:#a97842 iyr:2014 hgt:166cm pid:594143498 eyr:2030
ecl:hzl
pid:795349208 iyr:2018
eyr:2024 hcl:#de745c hgt:157cm
hgt:159cm pid:364060467 eyr:2025 byr:1978 iyr:2018 cid:117
ecl:hzl
hcl:#18171d
hcl:#cfa07d
ecl:amb iyr:2012
hgt:182cm cid:338
eyr:2020
pid:374679609 byr:1925
eyr:2021 byr:1981
hcl:#623a2f cid:195 iyr:2010
pid:579769934 ecl:grn hgt:192cm
byr:1970
ecl:oth
eyr:2025
pid:409994798 iyr:2018 hgt:189cm
hgt:153cm pid:817651329 iyr:2019
eyr:2029
hcl:#623a2f byr:1920
ecl:gry
iyr:2011 ecl:amb hcl:#a97842 byr:1965 pid:648375525 eyr:2028 hgt:177cm cid:287
iyr:2012 pid:369979235 hcl:#c0946f
ecl:amb hgt:178cm
byr:1927 ecl:brn hgt:178cm eyr:2026 hcl:#efcc98
iyr:2011 pid:770851101
eyr:2028
ecl:oth cid:298
byr:1943
hgt:168cm iyr:2018 hcl:#ceb3a1 pid:116783406
eyr:2027 hgt:175cm hcl:#733820
ecl:gry cid:349 iyr:2017 byr:1960
pid:257797292
cid:66 ecl:amb
eyr:2030
iyr:2026 byr:2024
hcl:a22966 hgt:179cm pid:155cm
eyr:2023 hcl:#c0946f pid:081232570 ecl:hzl
iyr:2010 hgt:158cm byr:1969
byr:1958
ecl:grn hcl:#ceb3a1
hgt:173cm
pid:600039004
cid:107 iyr:2012 eyr:2027
ecl:amb pid:021066381
hcl:#ceb3a1 byr:1982 iyr:2017
hgt:167cm eyr:2025 cid:61
hcl:#341e13
cid:268
pid:358390884 hgt:188cm byr:1961 iyr:2014 eyr:2027 ecl:blu
ecl:brn eyr:2020
pid:607203641
hcl:#fffffd iyr:2011
byr:1962
hgt:156cm
iyr:2018
hcl:#b6652a
byr:1942 ecl:blu eyr:2029 hgt:154cm pid:649263319
ecl:oth hgt:73in iyr:2012 hcl:#888785 eyr:2020
pid:147939289
byr:1961
ecl:oth iyr:2015
hgt:189cm hcl:#341e13 pid:686943691 eyr:2023 byr:1987
pid:568844323
eyr:2023 byr:1921 hgt:167cm cid:154 hcl:#b6652a
ecl:gry iyr:2020
eyr:2023 byr:1994
iyr:1937 hgt:177cm hcl:#c0946f pid:686240814 cid:231 ecl:#a8ba32
hcl:#b6652a
byr:1946 pid:543383899 iyr:2013 hgt:153cm ecl:hzl cid:238 eyr:2023
eyr:2028 ecl:blu
hgt:154cm cid:252
pid:196374590
byr:1987 iyr:2011
hcl:#7d3b0c
iyr:2013
ecl:amb cid:187
hgt:187cm pid:593027548 byr:1963
eyr:2024 hcl:#fffffd
pid:588211492 hgt:156cm
iyr:2021 eyr:2021 ecl:gry hcl:z byr:1928
ecl:amb hcl:#888785 hgt:180cm eyr:2022 byr:1923 pid:490291639 cid:173 iyr:2015
iyr:2014 cid:211 pid:404157420 hcl:#602927
ecl:oth byr:1946 eyr:2030 hgt:175cm
hcl:z byr:2026
pid:61805448
hgt:125 iyr:2025
eyr:2028
hgt:156cm
hcl:#341e13 cid:103 ecl:amb iyr:2017 byr:1937 pid:320691739
hgt:185cm
pid:440489464 byr:1929 ecl:amb iyr:2011 eyr:2021 cid:327 hcl:#341e13
byr:1988 ecl:grn
pid:062728732 iyr:2013
hgt:181cm
hcl:#18171d
eyr:2026
pid:000647617
eyr:2029 byr:1937
ecl:gry hcl:#e8eff3 hgt:164cm cid:151
iyr:2016
hgt:179cm
byr:1949
eyr:2029 pid:459190453
ecl:grn iyr:2020 hcl:#c0946f
hgt:160cm pid:476613532 cid:190 iyr:2016 hcl:#4657e5
byr:1929
eyr:2028
ecl:grn
eyr:2027 byr:1982
hcl:#18171d
pid:630408328
cid:65 iyr:2020
hgt:161cm
pid:752776254
hcl:#888785
hgt:189cm
eyr:2027 iyr:2020 ecl:hzl
cid:194 byr:1934
iyr:2015 hgt:167cm byr:1977
eyr:2021 hcl:#14564f pid:504471386 ecl:oth
hgt:84 pid:168cm
hcl:8532fb eyr:2023
iyr:2012 ecl:xry byr:2008 cid:288
cid:323 eyr:2024
iyr:2019
pid:495737304 byr:1966 hcl:#7d3b0c ecl:hzl
hgt:73in
iyr:2020 byr:1953 ecl:hzl hcl:#efcc98 hgt:174cm eyr:2026 pid:546906638
pid:839249028
hcl:z byr:2024
hgt:145 eyr:2034 iyr:2021 ecl:#891c47
eyr:2036
ecl:#89d2ae
cid:183 byr:2014
hcl:b3af0f
pid:12086913 iyr:1981
hgt:61cm
ecl:brn eyr:2030 pid:083487445 byr:1929 hcl:z iyr:2021
hgt:182 cid:318
eyr:2020
pid:188609216 hcl:#341e13
iyr:2012 hgt:179cm
eyr:2029
hcl:#888785 pid:704026565 hgt:173cm iyr:2020 ecl:blu byr:1950 cid:237
ecl:grn
eyr:2030
byr:1961 pid:695808266
iyr:2012 cid:56
hgt:155cm
iyr:2011 ecl:amb
byr:1986 pid:243061330 hgt:163cm eyr:2021
eyr:2030 hcl:#623a2f hgt:170cm ecl:hzl
pid:694575319 iyr:2011
byr:1939
iyr:2014 pid:184152121
hcl:#c0946f hgt:163cm
eyr:2028 byr:1992 cid:114
ecl:hzl
hgt:75in cid:233
hcl:#866857 pid:269157261 iyr:2020
byr:1973 eyr:2029
hgt:174cm
hcl:#f86751 iyr:2016
pid:904779190
ecl:brn eyr:2024 byr:1950
cid:123 iyr:2019
eyr:2030 pid:402585706
ecl:brn byr:1995 hcl:#4ff7fa
hgt:65in
ecl:grn eyr:2029
pid:083364259 iyr:2013 cid:50 byr:1938 hgt:187cm
hcl:#a97842
hcl:#6b5442 cid:101 iyr:2011
ecl:amb eyr:2029 byr:1963 pid:664573740
eyr:2025 hcl:#602927
hgt:188cm
iyr:2019
pid:521514539 byr:1940 ecl:gry
hcl:dc0449 eyr:1981 pid:188cm
cid:151 iyr:1979 hgt:61cm ecl:dne
byr:2028
iyr:2017 byr:1924
hgt:163cm eyr:2024 hcl:#ceb3a1 pid:424127124
ecl:amb
eyr:2039 pid:7837217107 hcl:z byr:2005
iyr:1989 ecl:#d95f4d hgt:190in
ecl:#329eb1 cid:178 hgt:192
eyr:2020 iyr:2012
hcl:#602927
byr:2028 pid:7175349420
ecl:gry byr:1931
hgt:162cm iyr:2014
eyr:2030 cid:50
hcl:#cfa07d pid:653585396
eyr:2025 hgt:177cm
ecl:gry hcl:#efcc98
iyr:2015
byr:1942
pid:388475446
hcl:#efcc98 ecl:grn
hgt:185cm
byr:1921 pid:253592171
eyr:2031 cid:220 iyr:2024
byr:1950
hgt:158cm ecl:gry iyr:2015 hcl:#18171d
eyr:2023
pid:151cm
byr:1957
hcl:z
eyr:2026
ecl:grn
iyr:1971 hgt:192in pid:5479810865
hgt:161cm pid:473851111 iyr:2018
ecl:brn byr:1982
eyr:2029
pid:136216608 byr:1958
cid:226 eyr:2023 hcl:#866857 iyr:2017 ecl:hzl hgt:159cm
byr:1993 hcl:#866857 hgt:169cm pid:488392920
cid:109 iyr:2017 ecl:oth eyr:2029
cid:248 ecl:amb eyr:2025 iyr:2017 byr:1951 hcl:#ceb3a1 pid:731763175 hgt:162cm
hcl:#835e79
eyr:2021
ecl:oth pid:617055193 byr:1997 iyr:2010
hgt:173cm
eyr:2024 pid:257895944
hcl:#ceb3a1
hgt:165cm
ecl:oth iyr:2020
byr:1958
pid:438580092
ecl:grt byr:2025
hcl:z iyr:2000 eyr:1952
cid:271 hgt:170in
iyr:2010 hcl:#6b5442 hgt:156cm
eyr:2026 ecl:grn pid:409793041 byr:1941
pid:076486440
hgt:177cm hcl:#888785 ecl:blu iyr:2017 eyr:2029
eyr:2028 ecl:amb hgt:186cm hcl:#1d5836 pid:563307670 iyr:2019 byr:1950
byr:1939 ecl:hzl hgt:193cm pid:329759796
hcl:#cfa07d eyr:2025 iyr:2011 cid:73
byr:1995
hgt:188cm eyr:2028
ecl:blu
iyr:2016 hcl:#888785 pid:459613739 cid:115
hcl:#623a2f
eyr:2021 cid:197 hgt:187cm ecl:oth
byr:1969
iyr:2010 pid:385660251
hgt:192cm cid:143 byr:1995 hcl:#fffffd
iyr:2017 ecl:oth
eyr:2020 pid:087661720
ecl:oth
byr:1994 hgt:183cm
eyr:2020 iyr:2020 pid:448389966 cid:92 hcl:#866857
pid:088166852 hgt:155cm cid:307 byr:1940
hcl:#7d3b0c
ecl:#af542f eyr:2023 iyr:2014
byr:2026 eyr:2039 hcl:5449b3
ecl:hzl hgt:176in
iyr:1962 pid:177cm
iyr:2020 ecl:amb hgt:164cm hcl:#c0946f
pid:931543453 eyr:2024 byr:2001
iyr:2010 eyr:2023 hgt:188cm
hcl:#866857 ecl:hzl pid:866631112 byr:1997
byr:1958 hgt:184cm
cid:117 hcl:#7d3b0c iyr:2019 pid:615734013 eyr:2028 ecl:gry
hgt:86 iyr:1935 ecl:grt pid:#af8e67 eyr:2031
byr:2018 hcl:6a2940
hgt:73in eyr:2022 pid:580461358 byr:1962
cid:129 iyr:2015 hcl:#7d3b0c
iyr:2019 hcl:#b6652a hgt:172cm ecl:blu pid:077121198 eyr:2021
byr:1995
hcl:#ceb3a1 cid:253
iyr:2015 hgt:177cm byr:1973
ecl:hzl pid:311289324 eyr:2025
iyr:2017 hcl:#efcc98
cid:57 byr:1940 ecl:blu
eyr:2025 hgt:157cm pid:827480048
eyr:2028 hgt:189cm
iyr:2016 byr:1978 ecl:hzl pid:127497651 cid:87
hcl:#623a2f
hcl:#341e13 byr:2015
ecl:brn hgt:187in
pid:82075551
eyr:1936
cid:200
iyr:1939
ecl:grn byr:1962
iyr:2011 hgt:169cm
pid:661559147
hcl:#623a2f eyr:2023
ecl:gry
hcl:#efcc98 eyr:2009 byr:2028
hgt:170in
cid:129 pid:161cm iyr:2018
pid:098090405 hcl:#623a2f byr:1943 ecl:hzl
hgt:152cm iyr:2013 eyr:2029
pid:495271053 iyr:2011 ecl:gry hcl:#623a2f cid:285
byr:1925 eyr:2024 hgt:187cm
cid:306
hgt:73in
iyr:2010 hcl:#448fd7
byr:1946
ecl:grn pid:137146932 eyr:2021
eyr:2020 hgt:159cm cid:90 iyr:2010 ecl:brn hcl:#341e13 byr:1955
hcl:#18171d iyr:2017 ecl:amb
pid:168517472
eyr:2021 hgt:181cm byr:1942
cid:325 eyr:2022 pid:947158470 byr:1994 iyr:2019 ecl:grn hgt:172cm hcl:#ec63ce
iyr:2011
pid:243339529
ecl:amb
hgt:169cm
byr:1967
eyr:2025 hcl:#b6652a
pid:664966826 eyr:2036 iyr:2015 byr:1972 hgt:68in
hcl:z
ecl:#038105
eyr:2021 pid:236054221
hgt:179cm
hcl:#b6652a iyr:2020 ecl:blu
ecl:grn
iyr:2010
pid:870519416 byr:1945 hcl:#a97842
hgt:176cm eyr:2030
hcl:#3318db eyr:2022
byr:1966
ecl:grn iyr:2013
cid:349
hgt:168cm pid:827688488
pid:124116963
hcl:#866857 eyr:2026
iyr:2013 ecl:grn byr:1983 hgt:183cm
iyr:2017 byr:1993
hcl:#18171d ecl:utc hgt:68in cid:168 eyr:2030 pid:#2fd9f2
ecl:blu cid:134 eyr:2025 pid:588957573
iyr:2017
hgt:151cm byr:1942 hcl:#4280c1
hcl:#51b593
iyr:2013
ecl:amb pid:668244584
cid:282
byr:1936
eyr:1985 hgt:161cm
pid:494051052
hgt:185cm byr:1996 eyr:2028 iyr:2018
ecl:amb
hcl:#efcc98
ecl:brn
eyr:2025
iyr:2011
hgt:163cm hcl:#a97842
byr:1989 pid:557549000
pid:828235468 cid:55
iyr:2010 byr:1926 eyr:2029 hgt:153cm hcl:#cfa07d
ecl:blu
hgt:158cm iyr:2015 pid:957913612 ecl:grn eyr:2020 byr:1984 cid:76 hcl:#6b5442
ecl:amb eyr:2020 pid:596116320
byr:1936
hcl:#cfa07d
hgt:165cm cid:86 iyr:2014
iyr:2012
cid:278 hcl:#602927
eyr:2020 ecl:hzl
hgt:176cm byr:1987 pid:594817909
iyr:2011 byr:1929 pid:073211525 eyr:2022
hgt:188cm
ecl:blu
hcl:#733820
hcl:#602927 hgt:187cm
pid:706155322 cid:203
ecl:brn byr:1952 iyr:2017 eyr:2020
hcl:bcb5f7
byr:2002 eyr:2029 pid:850069752 iyr:2019 ecl:hzl
hgt:167cm
hcl:#b6652a hgt:72in iyr:2013
ecl:grn eyr:2024 byr:1920 cid:114
pid:983486664
byr:1931 iyr:2020 pid:182737852 hgt:162cm
ecl:grn hcl:#888785 eyr:2028
eyr:2035
byr:1962 iyr:2012 cid:120
ecl:xry
hgt:61cm hcl:ce89a8 pid:335540582
pid:#05153d iyr:1990
eyr:1927 hgt:71cm
byr:2019 cid:346 ecl:#e38688
hcl:c6abd9
ecl:#cd58d8 pid:166cm iyr:2012
hcl:0d1b02 hgt:68
eyr:1958
pid:976419172 byr:1922 cid:345 hcl:#6b5442 iyr:2010 eyr:2026
ecl:grn hgt:155cm
ecl:gry hcl:#1bbadc hgt:168cm
eyr:2028
byr:1984 cid:179 iyr:2013 pid:706186218
ecl:blu hgt:188cm
pid:764775319 byr:1936 hcl:#7d3b0c iyr:2020
hcl:#623a2f
iyr:2012
pid:382832140 ecl:gry
eyr:2026
cid:350
hgt:165cm byr:1968
hcl:0b87a1 byr:2020 pid:4365879329
cid:110 ecl:grn
eyr:2032 hgt:155cm
iyr:2018
hgt:193cm eyr:2029 hcl:#733820 pid:081071142 byr:1929 ecl:oth
ecl:brn
eyr:2023 pid:876924536 cid:165
hcl:#efcc98 hgt:151cm byr:1972
iyr:2020
hgt:186cm eyr:2022
ecl:grn
byr:1972 pid:997639611 hcl:#ceb3a1 iyr:2013
byr:1926
pid:808460262
iyr:2012 eyr:2031 hcl:#a97842 ecl:amb
hgt:190cm
hgt:163cm
hcl:#ceb3a1 eyr:2028
ecl:grn
byr:1944 pid:381144425 iyr:2012
hcl:#95a232 pid:015229624 byr:1947 iyr:2013 hgt:66cm ecl:gry eyr:2027
hcl:z byr:1965 iyr:2013 hgt:157cm ecl:#8b12fb cid:246 pid:283039791 eyr:2023
ecl:gry byr:1950
hcl:#623a2f cid:276 iyr:2013 eyr:2030 pid:798610943 hgt:189in
eyr:2030 cid:52 hcl:#fffffd pid:041625574 ecl:amb iyr:2016 byr:1944
hgt:191cm
byr:1995
iyr:2015 cid:221 pid:279080024
eyr:2022
hgt:181cm ecl:brn hcl:#888785
hcl:z
ecl:blu
iyr:1970
eyr:2022
hgt:193cm pid:#540e31 cid:95 byr:1952
hcl:z eyr:2024 ecl:hzl
byr:2028
cid:323 pid:1949331457
hgt:69
eyr:2030 hcl:#866857
cid:173 iyr:2017
hgt:190cm byr:1941
ecl:blu
pid:269015932
hcl:#b6652a
iyr:2018
eyr:2022 ecl:brn hgt:185cm pid:456195468
hcl:#6b5442 hgt:188cm
iyr:2019 byr:1966 cid:298
pid:050653473
ecl:gry eyr:2028
cid:208
ecl:amb eyr:2023 hgt:176cm byr:1971 hcl:#7d3b0c pid:650190272 iyr:2018
hgt:68in pid:615309584
iyr:2011 byr:1950
hcl:#efcc98 ecl:oth
eyr:2024
eyr:2022 iyr:2011 hcl:#623a2f ecl:amb byr:1955
hgt:190cm
pid:244918527
iyr:2013 hcl:#ceb3a1 eyr:2029 hgt:164cm
ecl:oth
byr:1928 pid:337615663
hcl:#ceb3a1 pid:#ae7eea byr:2027
cid:254
hgt:125
iyr:1940
ecl:zzz
pid:033663619 iyr:2012 byr:1989 eyr:2030 ecl:hzl
hcl:#b6652a hgt:154cm
hgt:175cm byr:1929 pid:100788192
ecl:#92b14c
iyr:1940 hcl:#ceb3a1 eyr:2033
eyr:2029
pid:357835141 ecl:oth iyr:2019 hcl:#866857 hgt:154cm byr:1954
pid:895992818 byr:1965 iyr:2017 hcl:#efcc98 ecl:amb hgt:153cm eyr:2025
byr:1928 ecl:amb hgt:168cm pid:346938111 eyr:2025 iyr:2014
hcl:#cfa07d
hcl:#b6652a pid:825661608 eyr:2020 iyr:2019 byr:1974
hgt:180cm ecl:amb
byr:1970 hgt:159cm hcl:#733820 pid:101838832 iyr:2015 eyr:2027 ecl:blu
byr:1941 ecl:amb
eyr:2024 pid:015890498
hgt:175cm
iyr:2018 hcl:#cfa07d
hgt:67in
pid:404983369 eyr:2023 iyr:2018 byr:1974 hcl:#602927
ecl:blu
byr:1957
hcl:#fcc940 pid:615831236
iyr:2018 eyr:2020 ecl:brn hgt:181cm cid:218
hcl:#fffffd ecl:grn pid:271614109
eyr:2028 hgt:184cm byr:1974 iyr:2015
ecl:#e45ee0 pid:151cm cid:127 iyr:2014 byr:2022 hcl:973bc1 eyr:2033 hgt:181in
hcl:#6b5442 pid:502739402 eyr:2020 byr:1926 ecl:brn
iyr:2010
ecl:xry hgt:169cm byr:2023
iyr:1973 pid:4137668
eyr:2037 hcl:z
ecl:#3a8c46 hcl:43730a pid:57210146 eyr:2031 cid:117 iyr:2013 byr:2010
hcl:#341e13 cid:237 hgt:150cm iyr:2016 byr:1967 ecl:blu
pid:674080319 eyr:2024
iyr:2011 hcl:#866857 pid:111247018
byr:1920 hgt:192in ecl:#8bf268 eyr:2021
iyr:2022 hcl:z ecl:gry
hgt:159cm
pid:#88e8df
byr:2026 eyr:2032 cid:221
hgt:156cm eyr:2026
ecl:blu
hcl:#192dea cid:280 pid:788808021 byr:1980
iyr:2013
hgt:156in
byr:2024 hcl:4e4dd6
eyr:2030
iyr:2028 pid:35683378
ecl:#3a9fba
pid:081236370 cid:150 hcl:d15b43 byr:2029 hgt:118 iyr:2026 eyr:2038
ecl:grt
eyr:2034 pid:186cm
ecl:utc cid:300 iyr:2009 byr:2018 hcl:163913 hgt:74cm
ecl:hzl
pid:249858519 byr:1936 hgt:182cm
cid:343 iyr:2013 eyr:2030 hcl:#7d3b0c
cid:168
ecl:hzl
hgt:174cm iyr:2020
pid:446135799 hcl:#888785
eyr:2024 byr:1998
pid:545342162
hcl:#5cd3bd cid:126
eyr:2024
iyr:2012 ecl:grn
pid:104835585
byr:1989 hcl:#733820 ecl:oth eyr:2024 iyr:2017
hgt:180cm
hgt:184cm byr:2001 pid:199216567 ecl:gry
eyr:2022
cid:185 hcl:#7d3b0c
iyr:2019
byr:1996 eyr:2022 pid:503963080 ecl:grn iyr:2010 hcl:#fffffd
eyr:2030 iyr:2017
pid:472300557 hcl:#a97842
ecl:grn hgt:190cm
byr:1994
ecl:#2a8a59
eyr:2027
iyr:2015 byr:2021 hgt:158cm pid:365979521 hcl:z cid:242
ecl:gry
iyr:2020 hcl:#866857
pid:363851353 cid:319 hgt:154cm eyr:2027
byr:1953
ecl:grn hgt:165cm eyr:2026
pid:443722683 hcl:#341e13
iyr:2018 byr:1923
byr:1920 ecl:blu
cid:193 hgt:153cm hcl:#341e13 iyr:2010 pid:934896568
eyr:2021
eyr:2025
pid:524699651 cid:92
hcl:#602927 byr:1999
iyr:2011 ecl:brn hgt:164cm
eyr:2030 pid:739947771 iyr:2018
byr:1990
hgt:185cm hcl:#602927 ecl:gry
byr:1967 ecl:amb iyr:2020 hcl:#341e13
hgt:165cm
pid:681478012 eyr:2028
pid:807715479 ecl:blu byr:1955 eyr:1972 iyr:2018 hcl:#a97842 hgt:151
pid:635008585 cid:97
hgt:186cm hcl:#b6652a iyr:2015 eyr:2020 ecl:gry byr:1959
iyr:2017
cid:155 byr:1999 pid:550276277
hcl:#18171d
eyr:2020 hgt:164cm ecl:amb
byr:1977 hcl:#6b5442 ecl:grn iyr:2012 hgt:156cm
eyr:2028 pid:125635376
hgt:65in pid:042700658 byr:1962 iyr:2020
hcl:#888785 eyr:2021 ecl:gry
ecl:blu iyr:2017 hcl:#efcc98 pid:447451869 hgt:176cm
byr:1958
eyr:2024
ecl:amb hgt:155cm eyr:2022 hcl:#efcc98
pid:614496034 byr:1957
iyr:2016
cid:99
eyr:2020
ecl:amb iyr:2017
hgt:163cm pid:128207503 byr:1977
hcl:#866857
ecl:amb cid:342 eyr:2026 hgt:172cm pid:317675262
byr:1942 hcl:#a97842 iyr:2010
ecl:grn pid:077163993
hgt:187cm hcl:#341e13 iyr:2012 byr:1934 eyr:2024
pid:423538706 hgt:156cm
ecl:oth hcl:#341e13 iyr:2016 eyr:2028
iyr:2030 ecl:#faff64
byr:2012
pid:734434105 hgt:164in hcl:z eyr:2023
hgt:150in iyr:2016 pid:173cm hcl:db675a cid:219 eyr:2032 byr:1958
ecl:xry
pid:087437383
eyr:2025 hgt:178cm ecl:gry byr:1954
cid:227 hcl:#fffffd
iyr:2018
pid:152cm
iyr:2030 eyr:2030
byr:2010 hcl:z
hgt:155cm
ecl:amb
byr:1934
hcl:#341e13 hgt:167cm
pid:#7356dd ecl:amb
iyr:2011
eyr:2030
cid:123
eyr:2027
byr:2005
hgt:173cm cid:174 hcl:#ceb3a1 iyr:2018 ecl:amb pid:179cm
iyr:2019 ecl:grn eyr:2023
hgt:162cm
pid:649681621 hcl:#4ee6d2 byr:1955
hgt:165cm byr:1929 ecl:blu pid:839016251 iyr:2017 hcl:#c0946f
eyr:2020
eyr:2020
iyr:2017 hcl:#c7ed42 ecl:blu byr:1928
hgt:74in pid:112604496
eyr:2026 hgt:184 cid:113
byr:1933
pid:952646285
iyr:2019 hcl:#fffffd ecl:gry
pid:455008820 byr:1982 eyr:2030 ecl:gry iyr:2020 cid:103 hcl:#733820 hgt:184cm
hcl:#733820 iyr:2020 hgt:182cm ecl:grn
cid:226 pid:081011361 eyr:2022 byr:1995
iyr:1999
hcl:#18171d pid:9252198900
ecl:amb byr:1999 hgt:175cm eyr:2021
iyr:2020 hgt:165cm
ecl:blu
eyr:2023 pid:760213482
byr:1968
hcl:#c0946f
pid:242381670 ecl:amb
hgt:172cm byr:1980 eyr:2020 iyr:2014 hcl:#866857
byr:2021 pid:#a94a22 hcl:#cfa07d iyr:1969 eyr:2030 ecl:zzz
hgt:76cm
ecl:oth cid:168
byr:1954 pid:079481919 eyr:2025 hcl:#c0946f hgt:172cm
hgt:171cm
eyr:2030
byr:1969 cid:170
pid:164128658 ecl:amb
hcl:#c2265e iyr:2019
byr:1983
cid:163
eyr:2020 pid:232659795 iyr:2013 hcl:#888785 hgt:162cm
ecl:blu
ecl:gry hcl:#7d3b0c
pid:001171231 eyr:2020
byr:1935 hgt:160cm
iyr:2011
iyr:2012 hcl:#a97842
eyr:2029 pid:809880438 hgt:164cm cid:83 byr:1961 ecl:hzl
cid:288 eyr:2027
hgt:181cm byr:1955
iyr:2020
ecl:oth pid:754135833 hcl:#c0946f
iyr:2012 pid:053980893
cid:54 byr:1961 ecl:gry hcl:#602927 eyr:2020 hgt:167cm
iyr:2013
eyr:2025
hgt:176cm pid:169006156 cid:270 ecl:oth byr:2001
cid:244 pid:914067457
iyr:2017 byr:1926 hcl:#733820 ecl:brn hgt:187cm
eyr:2030
ecl:oth byr:1942
hgt:176cm iyr:2020 eyr:2027
hcl:#efcc98
pid:688816242
hgt:177cm hcl:#efcc98 eyr:2030 pid:888703414
iyr:2010 byr:1973 ecl:gry
cid:257 eyr:2030
ecl:brn
pid:359774824
byr:1988 hcl:#6b5442 iyr:2013 hgt:187cm
iyr:2011 hgt:173cm cid:290 byr:2000 ecl:gry
hcl:#7d3b0c
pid:743371399 eyr:2029
cid:162
eyr:1920 byr:2010 pid:#69d6ba hgt:74 hcl:z ecl:#d256f3 iyr:1933
pid:435518624 byr:1938 eyr:2027 iyr:2016 hcl:#18171d
hgt:161cm
ecl:gry
ecl:gry eyr:2027 hcl:#7d3b0c hgt:170cm
pid:928345976 iyr:2020
hcl:#5f4023 ecl:blu
pid:024527693
eyr:1932 iyr:2023 hgt:154cm byr:1948
cid:284 iyr:2011 byr:1920 eyr:2024 ecl:blu hgt:153cm
hcl:#602927 pid:005741906
iyr:2029 hgt:108 byr:2029 hcl:c8b25d
pid:522512400 eyr:2038 ecl:zzz cid:163
pid:371295649
eyr:2022 ecl:hzl
iyr:2019 hgt:153cm byr:1961
hcl:z
eyr:2027 iyr:2020 pid:619653661 byr:1968 hcl:#b6652a cid:62 ecl:hzl
hgt:186cm
iyr:1931
pid:565552342 ecl:#af97bb hcl:c92cd6 eyr:1931 byr:2025 hgt:184in
hgt:187cm
ecl:grn
byr:1954 cid:145
iyr:2016
hcl:#efcc98 eyr:2030 pid:202254357
cid:177
iyr:2013 byr:1926 hcl:#efcc98
pid:298693475 hgt:181cm eyr:2023 ecl:dne
byr:2014
cid:255
iyr:1951 hgt:72in
hcl:#efcc98 eyr:2039 pid:135688013
ecl:grn
byr:2019 eyr:1971 pid:#a95cb4
hcl:#ceb3a1 ecl:#6f919c
hgt:193cm iyr:2012
pid:497726268
ecl:grn
eyr:2025 hcl:#efcc98 iyr:2019 hgt:170cm byr:1970
byr:1939 hcl:#18171d cid:250
iyr:2011 ecl:blu pid:216607711
hgt:158cm eyr:2029
byr:1937
eyr:1931
hcl:#5ee898
pid:#876b1a hgt:190cm
cid:277 ecl:#5f0f80 iyr:2013
ecl:oth hgt:191cm eyr:2025 byr:1978 pid:271136754 hcl:#888785
iyr:2012
hcl:#6b5442
iyr:2015 byr:1958 pid:510020331 hgt:158cm eyr:2024 ecl:blu
byr:1998 cid:142 eyr:2026 iyr:2015 hcl:#733820
pid:671943334 hgt:186cm ecl:oth
eyr:2025 ecl:brn hcl:#7d3b0c pid:000803215
byr:1947
iyr:2017 hgt:168cm cid:230
pid:612432109 hgt:186cm byr:1963 ecl:hzl iyr:2019 eyr:2027
hcl:#efcc98
cid:148
hcl:#c0946f pid:846986027 eyr:2025 byr:1941
cid:154 hgt:158cm iyr:2012
ecl:brn
ecl:gry hgt:186cm
iyr:2015 hcl:#602927 byr:1923 eyr:2023
pid:48544569
pid:857428120 hgt:158cm hcl:#e4a267 iyr:2014 eyr:2020 byr:1975 ecl:blu
ecl:blu pid:559783197 byr:1935 cid:119 iyr:2017 hgt:157cm hcl:#6b5442 eyr:2020
ecl:oth pid:724332293 hcl:#602927
cid:77 iyr:2019
byr:2001 hgt:192cm eyr:2024
ecl:hzl eyr:2031
hcl:#efcc98 byr:2011 cid:280 iyr:2017
pid:377875085
hgt:172cm
byr:1947 hgt:174cm ecl:amb iyr:2018 cid:94 hcl:#a97842 eyr:2026 pid:286225332
hgt:85 ecl:xry eyr:2033 iyr:1952 pid:92902290
hcl:a6f86d
byr:2013
byr:1935 hcl:#c0946f pid:368741489 ecl:blu
eyr:2020 hgt:164cm
iyr:2018
cid:196
pid:718568707
ecl:oth byr:2003 hcl:#a97842 iyr:2010 hgt:168cm eyr:2025 cid:261
hcl:#6b5442
pid:675429853
hgt:62in ecl:grn iyr:2016
eyr:2027 byr:1932
byr:1978
pid:080846464 hcl:#ceb3a1 ecl:gry iyr:2015 hgt:190cm eyr:2029
pid:1756319674
iyr:2010 byr:1998 hcl:#866857 cid:259
eyr:2025 hgt:73in ecl:hzl
eyr:2035
hcl:z hgt:61cm
pid:3267812127
cid:230
byr:2029 iyr:2028 ecl:lzr
hgt:161cm ecl:hzl byr:1934 iyr:2011 eyr:2025 hcl:#cfa07d pid:354474868
pid:727482965
hcl:#623a2f iyr:2010 hgt:156cm eyr:2020 cid:68 ecl:grn byr:1950
pid:040800697 hgt:186cm
hcl:#341e13 iyr:2030 ecl:hzl
byr:1937 eyr:2020
iyr:2013 byr:1928 pid:752644096 eyr:2030 hgt:191cm ecl:hzl
cid:93 hcl:#a97842
pid:022267155 hcl:#cfa07d eyr:2026
ecl:hzl
hgt:187cm iyr:2014 cid:347
hgt:73in
eyr:2021 pid:054367702 ecl:amb hcl:#18171d byr:1965
iyr:2020 cid:267
eyr:2022
cid:140 pid:189859171 byr:1984 iyr:2020 ecl:brn hgt:166cm hcl:#623a2f
byr:1971 iyr:2015
hgt:168cm
eyr:2020 pid:650970816 hcl:#341e13
ecl:grn
cid:168
hcl:#c0946f byr:1948 hgt:189cm
pid:868785851
cid:194 ecl:amb eyr:2024 iyr:2011
eyr:2040
byr:2030 hcl:afde59
hgt:172cm pid:72468598 iyr:1990 cid:165 ecl:#896a8e
iyr:2009 hcl:#6b5442
eyr:2028
cid:53 ecl:hzl
hgt:165cm byr:1999 pid:844037301
cid:281 eyr:2022
iyr:2020 byr:1976 hgt:176cm hcl:#6b5442 ecl:amb pid:755280305
hgt:154cm iyr:2013
pid:059284139 byr:1992
cid:215 ecl:blu eyr:2025 hcl:#b6652a
ecl:grn
cid:308
hgt:187cm pid:009080324 eyr:2027
iyr:2012 byr:1955
pid:083241291 hcl:#7c1810 eyr:2030 iyr:2019 byr:1950 ecl:brn hgt:72in
cid:148 byr:1953 hcl:#623a2f
pid:076848285 hgt:175cm iyr:2017
eyr:2022
ecl:oth
iyr:2020
hgt:160cm
eyr:2028 cid:312 ecl:brn hcl:#888785 pid:681067688 byr:1986
iyr:1972 cid:170 eyr:2023
pid:21811501 ecl:#17c6e8
hgt:158in byr:2015 hcl:5b7956
pid:720571739 cid:304 byr:1951 hgt:191cm
eyr:2025 hcl:#341e13
iyr:2011
eyr:2020 ecl:blu hcl:#cfa07d pid:097863725
hgt:150cm
byr:1951
cid:143 iyr:2013
eyr:2027 iyr:2019 ecl:#a0eeca hcl:#c0946f pid:724783488 byr:1943 cid:282 hgt:124
byr:2012
iyr:2013 eyr:2036 hcl:z hgt:97
pid:#677847 ecl:dne
pid:341708492 hgt:190cm
byr:1988 hcl:#888785
ecl:hzl
iyr:2015 eyr:2029
iyr:2020 byr:1968
ecl:gry
eyr:2030 hcl:#1976b0
cid:127 pid:701862616
hgt:161cm"""
inputs = [i for i in input.split("\n\n")]
"""one"""
requirements = ['ecl', 'pid', 'eyr', 'hcl', 'byr', 'iyr', 'hgt']
total = len(inputs)
valid = [] #tacked on for part 2
for i in inputs:
for r in requirements:
if r not in i:
total -= 1
break
elif r == requirements[-1]: #tacked on for part 2
valid.append(i)
print(total)
"""two"""
eye_colours = ['amb', 'blu', 'brn', 'gry', 'grn', 'hzl', 'oth']
valid_count = 0
def is_valid(entry):
e_dict = {}
for e in entry:
e = e.split(':')
e_dict[e[0]] = e[1]
if all(keys in e_dict for keys in requirements):
if int(e_dict['byr']) < 1920 or int(e_dict['byr']) > 2002:
return False
if int(e_dict['iyr']) < 2010 or int(e_dict['iyr']) > 2020:
return False
if int(e_dict['eyr']) < 2020 or int(e_dict['eyr']) > 2030:
return False
if 'cm' in e_dict["hgt"]:
hgt = int(e_dict["hgt"].replace('cm', ''))
if hgt < 150 or hgt > 193:
return False
elif 'in' in e_dict["hgt"]:
hgt = int(e_dict["hgt"].replace('in', ''))
if hgt < 59 or hgt > 76:
return False
else:
return False
if not re.match('#[0-9a-f]{6}$', e_dict["hcl"]):
return False
if e_dict["ecl"] not in eye_colours:
return False
if not re.match('[0-9]{9}$', e_dict["pid"]):
return False
return True
return False
for v in valid:
v = v.replace(' ', '\n')
v = v.split('\n')
if is_valid(v):
valid_count += 1
print(valid_count)
| 18.817143 | 80 | 0.753633 | 4,514 | 23,051 | 3.843376 | 0.16903 | 0.015217 | 0.006225 | 0.002248 | 0.02248 | 0.008761 | 0.00634 | 0.003574 | 0.003574 | 0.003574 | 0 | 0.410835 | 0.129582 | 23,051 | 1,224 | 81 | 18.832516 | 0.453848 | 0.001735 | 0 | 0.207568 | 0 | 0.036757 | 0.934192 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.001081 | false | 0 | 0.001081 | 0 | 0.014054 | 0.002162 | 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 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
ff645fb0b531eb78c5209f67de47acd24606ce15 | 407 | py | Python | teeport/__init__.py | SPEAR3-ML/teeport-client-python | cb0a81e9a8e111bf4116484bbe496252aa8d9edc | [
"MIT"
] | null | null | null | teeport/__init__.py | SPEAR3-ML/teeport-client-python | cb0a81e9a8e111bf4116484bbe496252aa8d9edc | [
"MIT"
] | null | null | null | teeport/__init__.py | SPEAR3-ML/teeport-client-python | cb0a81e9a8e111bf4116484bbe496252aa8d9edc | [
"MIT"
] | null | null | null | # Copyright (c) 2019-2020, SPEAR3 authors (see AUTHORS.txt).
# Licensed under the BSD 3-clause license (see LICENSE.txt)
# The reason we need nest_asyncio is that we run multiple event loops in a
# single thread, that's not allowed. The future work should be create a new
# thread for each event loop so we can get rid of nest_asyncio
import nest_asyncio
nest_asyncio.apply()
from .teeport import Teeport
| 37 | 75 | 0.773956 | 71 | 407 | 4.380282 | 0.71831 | 0.141479 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.029499 | 0.167076 | 407 | 10 | 76 | 40.7 | 0.887906 | 0.796069 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.666667 | 0 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
ff67664ebb9e9ff9a5a17938e52f47a51c7667d5 | 75 | py | Python | Hacker_Rank/Python: Division.py | Jai-kishan/Practice-Questions | cf3a3eb5c2e930fcfcb762d822430060bb5deb2d | [
"Apache-2.0"
] | 1 | 2019-05-04T09:21:00.000Z | 2019-05-04T09:21:00.000Z | Hacker_Rank/Python: Division.py | Jai-kishan/Practice-Questions | cf3a3eb5c2e930fcfcb762d822430060bb5deb2d | [
"Apache-2.0"
] | null | null | null | Hacker_Rank/Python: Division.py | Jai-kishan/Practice-Questions | cf3a3eb5c2e930fcfcb762d822430060bb5deb2d | [
"Apache-2.0"
] | null | null | null | a=int(input())
b=int(input())
print (a/b)
a=float(a)
b=float(b)
print (a/b) | 12.5 | 14 | 0.613333 | 18 | 75 | 2.555556 | 0.333333 | 0.130435 | 0.304348 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.093333 | 75 | 6 | 15 | 12.5 | 0.676471 | 0 | 0 | 0.333333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.333333 | 1 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
ff83e388de90ffa2ddc5c91abc3eff56e6220ae3 | 1,170 | py | Python | pyvims/planets/__type__.py | seignovert/pyvims | a70b5b9b8bc5c37fa43b7db4d15407f312a31849 | [
"BSD-3-Clause"
] | 4 | 2019-09-16T15:50:22.000Z | 2021-04-08T15:32:48.000Z | pyvims/planets/__type__.py | seignovert/pyvims | a70b5b9b8bc5c37fa43b7db4d15407f312a31849 | [
"BSD-3-Clause"
] | 3 | 2018-05-04T09:28:24.000Z | 2018-12-03T09:00:31.000Z | pyvims/planets/__type__.py | seignovert/pyvims | a70b5b9b8bc5c37fa43b7db4d15407f312a31849 | [
"BSD-3-Clause"
] | 1 | 2020-10-12T15:14:17.000Z | 2020-10-12T15:14:17.000Z | """Abstract planet type."""
class Planet(type):
"""Abstract Planet object."""
MEAN_RADIUS = (None, None) # [km] ± err [km]
RADII = ((None, None), (None, None), (None, None)) # [km] ± err [km]
def __str__(cls):
return cls.__name__
def __repr__(cls):
return f'<{cls.__class__.__name__}> {cls}'
def __eq__(cls, other):
return str(cls).lower() == other.lower()
@property
def radius(cls):
"""Mean radius [km]."""
return cls.MEAN_RADIUS[0]
@property
def r(cls):
"""Mean radius (shortcut) [km]."""
return cls.radius
@property
def radii(cls):
"""Planet RADII (a, b, c) [km]."""
return tuple([abc[0] for abc in cls.RADII])
@property
def a(cls):
"""Planet a-axis radius [km]."""
return cls.RADII[0][0]
@property
def b(cls):
"""Planet b-axis radius [km]."""
return cls.RADII[1][0]
@property
def c(cls):
"""Planet c-axis radius [km]."""
return cls.RADII[2][0]
def lower(cls):
"""Planet name in lowercase."""
return str(cls).lower()
| 22.941176 | 73 | 0.513675 | 148 | 1,170 | 3.898649 | 0.25 | 0.083189 | 0.095321 | 0.117851 | 0.218371 | 0.190641 | 0 | 0 | 0 | 0 | 0 | 0.009913 | 0.310256 | 1,170 | 50 | 74 | 23.4 | 0.702602 | 0.223077 | 0 | 0.206897 | 0 | 0 | 0.037123 | 0.030162 | 0 | 0 | 0 | 0 | 0 | 1 | 0.344828 | false | 0 | 0 | 0.103448 | 0.793103 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 3 |
ffba6d1b0d4c9fc9bf206561d7474e75ff42b979 | 343 | py | Python | pushit/backends/mpns.py | rhblind/django-pushit | 491ab14b7b1004eb73420d23bcc2b74fafaaf7a3 | [
"MIT"
] | null | null | null | pushit/backends/mpns.py | rhblind/django-pushit | 491ab14b7b1004eb73420d23bcc2b74fafaaf7a3 | [
"MIT"
] | null | null | null | pushit/backends/mpns.py | rhblind/django-pushit | 491ab14b7b1004eb73420d23bcc2b74fafaaf7a3 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from pushit.backends import PushBackend
class MPNSPushBackend(PushBackend):
"""
"""
def __init__(self, connection_alias, **options):
super(MPNSPushBackend, self).__init__(connection_alias, **options)
raise NotImplementedError()
| 21.4375 | 74 | 0.71137 | 33 | 343 | 6.909091 | 0.69697 | 0.131579 | 0.192982 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.003546 | 0.177843 | 343 | 15 | 75 | 22.866667 | 0.804965 | 0.061224 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.333333 | 0 | 0.666667 | 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 | 1 | 0 | 0 | 3 |
440da21df1681ee860c03c4cbe74d77afefdd093 | 253 | py | Python | tests/examples/simple.py | Tiendil/coulson | 6ce12f10731930bf6931f73b752976aeda839cc4 | [
"BSD-3-Clause"
] | null | null | null | tests/examples/simple.py | Tiendil/coulson | 6ce12f10731930bf6931f73b752976aeda839cc4 | [
"BSD-3-Clause"
] | null | null | null | tests/examples/simple.py | Tiendil/coulson | 6ce12f10731930bf6931f73b752976aeda839cc4 | [
"BSD-3-Clause"
] | null | null | null |
def assigned_type_mismatch():
x = 666
x = '666'
return x
def annotation_type_mismatch(x: int = '666'):
return x
def assigned_type_mismatch_between_calls(case):
if case:
x = 666
else:
x = '666'
return x
| 12.65 | 47 | 0.588933 | 35 | 253 | 4.028571 | 0.4 | 0.113475 | 0.212766 | 0.326241 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.087209 | 0.320158 | 253 | 19 | 48 | 13.315789 | 0.732558 | 0 | 0 | 0.583333 | 0 | 0 | 0.035857 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0 | 0.083333 | 0.5 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
4447797a9aae9e4e0e21cce2510d72157327de0f | 255 | py | Python | neos/secrets.py | mralext20/neos.py | 5e83a868969a9782ddfc7eba023108290ccda97c | [
"MIT"
] | 2 | 2021-03-30T16:24:19.000Z | 2021-04-06T08:20:55.000Z | neos/secrets.py | mralext20/neos.py | 5e83a868969a9782ddfc7eba023108290ccda97c | [
"MIT"
] | null | null | null | neos/secrets.py | mralext20/neos.py | 5e83a868969a9782ddfc7eba023108290ccda97c | [
"MIT"
] | null | null | null | import random
import string
def generate() -> str:
"""
direct reimpl of secretID.js from account.neosvr.com
"""
length = 12
valid_chars = string.ascii_letters + string.digits
return "".join(random.choices(valid_chars, k=length))
| 21.25 | 57 | 0.678431 | 33 | 255 | 5.151515 | 0.787879 | 0.117647 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.009901 | 0.207843 | 255 | 11 | 58 | 23.181818 | 0.831683 | 0.203922 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 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 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
44762645211964973e9a09e8d66e0bf5a566fa40 | 189 | py | Python | mysite/documents/urls.py | JarvisDong/Project-CGD | e499e13f358629583faf2778d8ba55852cf4cecf | [
"MIT"
] | null | null | null | mysite/documents/urls.py | JarvisDong/Project-CGD | e499e13f358629583faf2778d8ba55852cf4cecf | [
"MIT"
] | null | null | null | mysite/documents/urls.py | JarvisDong/Project-CGD | e499e13f358629583faf2778d8ba55852cf4cecf | [
"MIT"
] | null | null | null | # URLconf: map the index view in view.py to a URL
from django.conf.urls import url
from . import views
from django.views.generic import TemplateView
app_name = 'documents'
urlpatterns = [] | 27 | 49 | 0.772487 | 30 | 189 | 4.833333 | 0.733333 | 0.096552 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.153439 | 189 | 7 | 50 | 27 | 0.90625 | 0.248677 | 0 | 0 | 0 | 0 | 0.06383 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
4492b8f104d0fabe71c89becba245f5e4644669e | 228 | py | Python | src/Brain/Functions/Analyzer.py | SidisLiveYT/Discord-AI | b321856266740304b70ab63bbfcdb5285854aa7d | [
"MIT"
] | null | null | null | src/Brain/Functions/Analyzer.py | SidisLiveYT/Discord-AI | b321856266740304b70ab63bbfcdb5285854aa7d | [
"MIT"
] | null | null | null | src/Brain/Functions/Analyzer.py | SidisLiveYT/Discord-AI | b321856266740304b70ab63bbfcdb5285854aa7d | [
"MIT"
] | null | null | null | from Resources.StorageGround import Greetings
print(Greetings);
def Analyzer_Text_Department(RawString):
#Taking List of Words to Analyze Indiviually
SplitSting = RawString.split()
#for word in SplitSting:
| 25.333333 | 48 | 0.75 | 26 | 228 | 6.5 | 0.884615 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.188596 | 228 | 8 | 49 | 28.5 | 0.913514 | 0.289474 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.25 | 0 | 0.5 | 0.25 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
922fa3dca598bcb019c6f728700b805a4c18143d | 2,744 | py | Python | tests/test_eos_token_seq_length.py | v0lta/tfkaldi | 4772e881cc168439723c19f69a2425588f661060 | [
"MIT"
] | 57 | 2017-01-19T15:58:46.000Z | 2021-01-12T17:57:31.000Z | tests/test_eos_token_seq_length.py | v0lta/tfkaldi | 4772e881cc168439723c19f69a2425588f661060 | [
"MIT"
] | null | null | null | tests/test_eos_token_seq_length.py | v0lta/tfkaldi | 4772e881cc168439723c19f69a2425588f661060 | [
"MIT"
] | 15 | 2017-02-25T17:44:35.000Z | 2019-09-23T14:03:18.000Z | from __future__ import absolute_import, division, print_function
import numpy as np
import tensorflow as tf
from IPython.core.debugger import Tracer; debug_here = Tracer();
batch_size = 5
max_it = tf.constant(6)
char_mat_1 = [[0.0, 0.0, 0.0, 0.9, 0.0, 0.0],
[0.0, 0.0, 0.0, 0.9, 0.0, 0.0],
[0.0, 0.0, 0.0, 0.9, 0.0, 0.0],
[0.0, 0.0, 0.0, 0.9, 0.0, 0.0],
[0.0, 0.0, 0.0, 0.9, 0.0, 0.0]]
char_mat_2 = [[0.0, 0.0, 0.0, 1.0, 0.0, 0.0],
[1.0, 0.0, 0.0, 0.0, 0.0, 0.0],
[0.0, 0.0, 0.0, 1.0, 0.0, 0.0],
[0.0, 0.0, 0.0, 1.0, 0.0, 0.0],
[0.0, 0.0, 0.0, 1.0, 0.0, 0.0]]
char_mat_3 = [[0.0, 0.0, 0.0, 0.1, 0.0, 0.0],
[1.0, 0.0, 0.0, 0.0, 0.0, 0.0],
[1.0, 0.0, 0.0, 0.0, 0.0, 0.0],
[0.0, 0.0, 0.0, 1.0, 0.0, 0.0],
[0.0, 0.0, 0.0, 1.0, 0.0, 0.0]]
char_mat_4 = [[0.0, 0.0, 0.0, 0.1, 0.0, 0.0],
[0.0, 0.0, 0.0, 0.0, 1.0, 0.0],
[1.0, 0.0, 0.0, 0.0, 0.0, 0.0],
[0.0, 0.0, 0.0, 1.0, 0.0, 0.0],
[1.0, 0.0, 0.0, 0.0, 0.0, 0.0]]
char_mat_5 = [[1.0, 0.0, 0.0, 1.0, 0.0, 0.0],
[1.0, 0.0, 0.0, 0.0, 0.0, 0.0],
[1.0, 0.0, 0.0, 0.0, 0.0, 0.0],
[1.0, 0.0, 0.0, 1.0, 0.0, 0.0],
[1.0, 0.0, 0.0, 0.0, 0.0, 0.0]]
#expected output: [5, 2, 4, 5, 4]
char_lst = [char_mat_1, char_mat_2, char_mat_3,
char_mat_4, char_mat_5]
np_char_tensor = np.array(char_lst)
char_prob = tf.constant(np.array(np_char_tensor), tf.float64)
char_prob = tf.transpose(char_prob, [1, 0, 2])
print(tf.Tensor.get_shape(char_prob))
sequence_length_lst = [1, 1, 1, 1, 1]
sequence_length = tf.constant(sequence_length_lst)
done_mask = tf.cast(tf.zeros(batch_size), tf.bool)
for time in range(0, 5):
print(time)
current_date = char_prob[:, time, :]
max_vals = tf.argmax(current_date, 1)
mask = tf.equal(max_vals, tf.constant(0, tf.int64))
current_mask = tf.logical_and(mask, tf.logical_not(done_mask))
done_mask = tf.logical_or(mask, done_mask)
time_vec = tf.ones(batch_size, tf.int32)*(time+2)
sequence_length = tf.select(done_mask, sequence_length, time_vec, name=None)
not_done_no = tf.reduce_sum(tf.cast(tf.logical_not(done_mask), tf.int32))
all_eos = tf.equal(not_done_no, tf.constant(0))
stop_loop = tf.logical_or(all_eos, tf.greater(time, max_it))
keep_working = tf.logical_not(stop_loop)
sess = tf.Session()
with sess.as_default():
tf.initialize_all_variables().run()
#print(char_prob.eval())
print(max_vals.eval())
print(mask.eval())
print(done_mask.eval())
print(sequence_length.eval())
print(keep_working.eval())
| 34.3 | 80 | 0.543367 | 581 | 2,744 | 2.414802 | 0.151463 | 0.344975 | 0.451176 | 0.513186 | 0.263008 | 0.234498 | 0.229508 | 0.224519 | 0.223806 | 0.223806 | 0 | 0.164165 | 0.247449 | 2,744 | 79 | 81 | 34.734177 | 0.515254 | 0.020044 | 0 | 0.278689 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.065574 | 0 | 0.065574 | 0.131148 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
923c4e2cb4ba7cdc78f566b0f424d01000307fda | 1,213 | py | Python | static/src/srcjpy.py | JoshuaOndieki/oneforma-fashion-attribute | 00aaea0e964adbe7b33e5e51cd8eabb42817dec7 | [
"MIT"
] | null | null | null | static/src/srcjpy.py | JoshuaOndieki/oneforma-fashion-attribute | 00aaea0e964adbe7b33e5e51cd8eabb42817dec7 | [
"MIT"
] | null | null | null | static/src/srcjpy.py | JoshuaOndieki/oneforma-fashion-attribute | 00aaea0e964adbe7b33e5e51cd8eabb42817dec7 | [
"MIT"
] | null | null | null | import json
def restructure_category_data():
with open('categoryimages.json', 'r') as jfile:
new_data = json.load(jfile)
with open('category.json') as jfile:
data = json.load(jfile)
with open('category.json', 'w') as jfile:
for item in data:
item['IMAGES'] = new_data[item['NAME']]
json.dump(data, jfile, sort_keys=True, indent=4)
def restructure_part_data():
with open('partimages.json', 'r') as jfile:
new_data = json.load(jfile)
with open('part.json') as jfile:
data = json.load(jfile)
with open('part.json', 'w') as jfile:
for item in data:
item['IMAGES'] = new_data[item['PART']]
json.dump(data, jfile, sort_keys=True, indent=4)
def restructure_texture_data():
with open('textureimages.json', 'r') as jfile:
new_data = json.load(jfile)
with open('texture.json') as jfile:
data = json.load(jfile)
with open('texture.json', 'w') as jfile:
for item in data:
item['IMAGES'] = new_data[item['TEXTURE']]
json.dump(data, jfile, sort_keys=True, indent=4)
restructure_category_data()
restructure_part_data()
restructure_texture_data()
| 26.369565 | 56 | 0.623248 | 167 | 1,213 | 4.401198 | 0.179641 | 0.097959 | 0.097959 | 0.138776 | 0.734694 | 0.734694 | 0.734694 | 0.734694 | 0.682993 | 0.487075 | 0 | 0.003236 | 0.235779 | 1,213 | 45 | 57 | 26.955556 | 0.789644 | 0 | 0 | 0.387097 | 0 | 0 | 0.13108 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.096774 | false | 0 | 0.032258 | 0 | 0.129032 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
923fbcda3f989955bd68ae7294e1df2739368dbf | 1,792 | py | Python | test/detect_os.py | ThunderSoft123/mbed-ls | bf2750e2da4649591fcbb8047e0926ae4d6c74fd | [
"Apache-2.0"
] | null | null | null | test/detect_os.py | ThunderSoft123/mbed-ls | bf2750e2da4649591fcbb8047e0926ae4d6c74fd | [
"Apache-2.0"
] | null | null | null | test/detect_os.py | ThunderSoft123/mbed-ls | bf2750e2da4649591fcbb8047e0926ae4d6c74fd | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
"""
mbed SDK
Copyright (c) 2011-2015 ARM Limited
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 unittest
import os
import sys
import errno
import logging
import platform
from mbed_lstools.main import create
from mbed_lstools.main import mbed_os_support
from mbed_lstools.main import mbed_lstools_os_info
class DetectOSTestCase(unittest.TestCase):
""" Test cases for host OS related functionality. Helpful during porting
"""
def setUp(self):
pass
def tearDown(self):
pass
def test_porting_mbed_lstools_os_info(self):
self.assertNotEqual(None, mbed_lstools_os_info())
def test_porting_mbed_os_support(self):
self.assertNotEqual(None, mbed_os_support())
def test_porting_create(self):
self.assertNotEqual(None, create())
def test_supported_os_name(self):
os_names = ['Windows7', 'Ubuntu', 'LinuxGeneric', 'Darwin']
self.assertIn(mbed_os_support(), os_names)
def test_detect_os_support_ext(self):
os_info = (os.name,
platform.system(),
platform.release(),
platform.version(),
sys.platform)
self.assertEqual(os_info, mbed_lstools_os_info())
if __name__ == '__main__':
unittest.main()
| 27.151515 | 76 | 0.708147 | 243 | 1,792 | 5.024691 | 0.477366 | 0.063063 | 0.042588 | 0.055692 | 0.117117 | 0.047502 | 0 | 0 | 0 | 0 | 0 | 0.009207 | 0.212054 | 1,792 | 65 | 77 | 27.569231 | 0.855524 | 0.370536 | 0 | 0.0625 | 0 | 0 | 0.035907 | 0 | 0 | 0 | 0 | 0 | 0.15625 | 1 | 0.21875 | false | 0.0625 | 0.28125 | 0 | 0.53125 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
926e172260da95c8e0bed936db852d904ce5ea3f | 6,249 | py | Python | datamine/loaders/liqtool.py | Saran33/datamine_python | 396a01883fe98f31e32d506d50e4eeaa2de06466 | [
"BSD-3-Clause"
] | 39 | 2019-05-15T19:22:03.000Z | 2022-03-08T08:54:51.000Z | datamine/loaders/liqtool.py | Saran33/datamine_python | 396a01883fe98f31e32d506d50e4eeaa2de06466 | [
"BSD-3-Clause"
] | 9 | 2019-02-26T03:50:27.000Z | 2021-07-24T15:31:38.000Z | datamine/loaders/liqtool.py | Saran33/datamine_python | 396a01883fe98f31e32d506d50e4eeaa2de06466 | [
"BSD-3-Clause"
] | 11 | 2019-04-16T12:32:29.000Z | 2021-08-28T15:09:51.000Z | from . import Loader
import pandas as pd
from datetime import datetime, timedelta
start = datetime(1970, 1, 1) # Unix epoch start time
class LiqLoader(Loader):
dataset = 'LIQTOOL'
fileglob = 'LIQTOOL_*.csv.gz'
index = 'tradedate'
dtypes = {'category': ('symbol', 'time_zone'),
'int64': ('lot_1_size', 'lot_2_size', 'lot_3_size', 'lot_4_size', 'lot_5_size',
'lot_6_size', 'lot_7_size', 'lot_8_size', 'lot_9_size', 'lot_10_size',
'lot_11_size', 'lot_12_size', 'lot_13_size', 'lot_14_size', 'lot_15_size',
'lot_16_size', 'lot_17_size', 'lot_18_size', 'lot_19_size', 'lot_20_size',
'lot_21_size', 'lot_22_size', 'lot_23_size', 'lot_24_size', 'lot_25_size', 'frontmonth'),
'float': ('avg_level_1_spread', 'avg_level_1_midprice', 'avg_level_1_weightedprice', 'avg_level_1_ask_price', 'avg_level_1_bid_price', 'avg_level_1_ask_quantity', 'avg_level_1_bid_quantity', 'avg_level_1_ask_orders', 'avg_level_1_bid_orders',
'avg_level_2_spread', 'avg_level_2_midprice', 'avg_level_2_weightedprice', 'avg_level_2_ask_price', 'avg_level_2_bid_price', 'avg_level_2_ask_quantity', 'avg_level_2_bid_quantity', 'avg_level_2_ask_orders', 'avg_level_2_bid_orders',
'avg_level_3_spread', 'avg_level_3_midprice', 'avg_level_3_weightedprice', 'avg_level_3_ask_price', 'avg_level_3_bid_price', 'avg_level_3_ask_quantity', 'avg_level_3_bid_quantity', 'avg_level_3_ask_orders', 'avg_level_3_bid_orders',
'avg_level_4_spread', 'avg_level_4_midprice', 'avg_level_4_weightedprice', 'avg_level_4_ask_price', 'avg_level_4_bid_price', 'avg_level_4_ask_quantity', 'avg_level_4_bid_quantity', 'avg_level_4_ask_orders', 'avg_level_4_bid_orders',
'avg_level_5_spread', 'avg_level_5_midprice', 'avg_level_5_weightedprice', 'avg_level_5_ask_price', 'avg_level_5_bid_price', 'avg_level_5_ask_quantity', 'avg_level_5_bid_quantity', 'avg_level_5_ask_orders', 'avg_level_5_bid_orders',
'avg_level_6_spread', 'avg_level_6_midprice', 'avg_level_6_weightedprice', 'avg_level_6_ask_price', 'avg_level_6_bid_price', 'avg_level_6_ask_quantity', 'avg_level_6_bid_quantity', 'avg_level_6_ask_orders', 'avg_level_6_bid_orders',
'avg_level_7_spread', 'avg_level_7_midprice', 'avg_level_7_weightedprice', 'avg_level_7_ask_price', 'avg_level_7_bid_price', 'avg_level_7_ask_quantity', 'avg_level_7_bid_quantity', 'avg_level_7_ask_orders', 'avg_level_7_bid_orders',
'avg_level_8_spread', 'avg_level_8_midprice', 'avg_level_8_weightedprice', 'avg_level_8_ask_price', 'avg_level_8_bid_price', 'avg_level_8_ask_quantity', 'avg_level_8_bid_quantity', 'avg_level_8_ask_orders', 'avg_level_8_bid_orders',
'avg_level_9_spread', 'avg_level_9_midprice', 'avg_level_9_weightedprice', 'avg_level_9_ask_price', 'avg_level_9_bid_price', 'avg_level_9_ask_quantity', 'avg_level_9_bid_quantity', 'avg_level_9_ask_orders', 'avg_level_9_bid_orders',
'avg_level_10_spread', 'avg_level_10_midprice', 'avg_level_10_weightedprice', 'avg_level_10_ask_price', 'avg_level_10_bid_price', 'avg_level_10_ask_quantity', 'avg_level_10_bid_quantity', 'avg_level_10_ask_orders', 'avg_level_10_bid_orders',
'lot_1_buy_ctt', 'lot_1_sell_ctt', 'lot_1_buy_depth', 'lot_1_sell_depth',
'lot_2_buy_ctt', 'lot_2_sell_ctt', 'lot_2_buy_depth', 'lot_2_sell_depth',
'lot_3_buy_ctt', 'lot_3_sell_ctt', 'lot_3_buy_depth', 'lot_3_sell_depth',
'lot_4_buy_ctt', 'lot_4_sell_ctt', 'lot_4_buy_depth', 'lot_4_sell_depth',
'lot_5_buy_ctt', 'lot_5_sell_ctt', 'lot_5_buy_depth', 'lot_5_sell_depth',
'lot_6_buy_ctt', 'lot_6_sell_ctt', 'lot_6_buy_depth', 'lot_6_sell_depth',
'lot_7_buy_ctt', 'lot_7_sell_ctt', 'lot_7_buy_depth', 'lot_7_sell_depth',
'lot_8_buy_ctt', 'lot_8_sell_ctt', 'lot_8_buy_depth', 'lot_8_sell_depth',
'lot_9_buy_ctt', 'lot_9_sell_ctt', 'lot_9_buy_depth', 'lot_9_sell_depth',
'lot_10_buy_ctt', 'lot_10_sell_ctt', 'lot_10_buy_depth', 'lot_10_sell_depth',
'lot_11_buy_ctt', 'lot_11_sell_ctt', 'lot_11_buy_depth', 'lot_11_sell_depth',
'lot_12_buy_ctt', 'lot_12_sell_ctt', 'lot_12_buy_depth', 'lot_12_sell_depth',
'lot_13_buy_ctt', 'lot_13_sell_ctt', 'lot_13_buy_depth', 'lot_13_sell_depth',
'lot_14_buy_ctt', 'lot_14_sell_ctt', 'lot_14_buy_depth', 'lot_14_sell_depth',
'lot_15_buy_ctt', 'lot_15_sell_ctt', 'lot_15_buy_depth', 'lot_15_sell_depth',
'lot_16_buy_ctt', 'lot_16_sell_ctt', 'lot_16_buy_depth', 'lot_16_sell_depth',
'lot_17_buy_ctt', 'lot_17_sell_ctt', 'lot_17_buy_depth', 'lot_17_sell_depth',
'lot_18_buy_ctt', 'lot_18_sell_ctt', 'lot_18_buy_depth', 'lot_18_sell_depth',
'lot_19_buy_ctt', 'lot_19_sell_ctt', 'lot_19_buy_depth', 'lot_19_sell_depth',
'lot_20_buy_ctt', 'lot_20_sell_ctt', 'lot_20_buy_depth', 'lot_20_sell_depth',
'lot_21_buy_ctt', 'lot_21_sell_ctt', 'lot_21_buy_depth', 'lot_21_sell_depth',
'lot_22_buy_ctt', 'lot_22_sell_ctt', 'lot_22_buy_depth', 'lot_22_sell_depth',
'lot_23_buy_ctt', 'lot_23_sell_ctt', 'lot_23_buy_depth', 'lot_23_sell_depth',
'lot_24_buy_ctt', 'lot_24_sell_ctt', 'lot_24_buy_depth', 'lot_24_sell_depth',
'lot_25_buy_ctt', 'lot_25_sell_ctt', 'lot_25_buy_depth', 'lot_25_sell_depth',),
'date': ('unixtime',),
'date:%Y%m%d': ('tradedate',)}
def _load(self, file):
df = pd.read_csv(file, low_memory = False)
df['unixtime'] = df['unix_in_sec'].apply(lambda x: start + timedelta(seconds=x))
df = df.drop(['unix_in_sec'], axis=1)
return(df)
liqLoader = LiqLoader()
| 99.190476 | 265 | 0.666187 | 979 | 6,249 | 3.548519 | 0.094995 | 0.207254 | 0.064767 | 0.046056 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.063592 | 0.212354 | 6,249 | 62 | 266 | 100.790323 | 0.642219 | 0.003361 | 0 | 0 | 0 | 0 | 0.625763 | 0.259878 | 0 | 0 | 0 | 0 | 0 | 1 | 0.017544 | false | 0 | 0.052632 | 0 | 0.157895 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
927646be7e0eba265112163bf55301fe33919254 | 1,465 | py | Python | tests/tests_earthquake.py | domenicosolazzo/Earthquake | 4a9940c0f10f686bafb27521b1d9ba83a2930968 | [
"MIT"
] | null | null | null | tests/tests_earthquake.py | domenicosolazzo/Earthquake | 4a9940c0f10f686bafb27521b1d9ba83a2930968 | [
"MIT"
] | null | null | null | tests/tests_earthquake.py | domenicosolazzo/Earthquake | 4a9940c0f10f686bafb27521b1d9ba83a2930968 | [
"MIT"
] | null | null | null | import unittest
from lib.earthquake import Earthquake
class EarthquakeTestCase(unittest.TestCase):
def setUp(self):
self.earthquake = Earthquake(service="fake")
def test_refresh_exists(self):
self.assertTrue(callable(getattr(self.earthquake,"refresh")),"True")
def test_refresh_does_take_at_most_one_parameter(self):
self.assertRaises(TypeError, getattr(self.earthquake, "refresh"), *("json",2),**{})
def test_refresh_returns_a_list(self):
self.assertTrue(type(self.earthquake.refresh("list")) == type([]),"Refresh returns a list")
def test_earthquake_has_an_items_attribute(self):
self.assertFalse(callable(getattr(self.earthquake,"items")), "The object has an items attribute.")
def test_items_attribute_is_a_list(self):
self.assertTrue(type(self.earthquake.items) == type([]), "The items attribute is a list")
def test_earthquake_contains_a_manager_attribute(self):
self.assertFalse(callable(getattr(self.earthquake,"_Earthquake__manager")),"Earthquake has a manager attribute")
def test_earthquake_accepts_zero_or_one_paramenter_in_input(self):
self.assertRaises(AssertionError, self.earthquake, **{"service":"fake", "notvalid":"notvalid"})
self.assertRaises(AssertionError, self.earthquake, *["fake"],**{"service":"lalala"})
self.assertFalse(callable(getattr(self.earthquake,"_Earthquake__manager")),"Earthquake has a manager attribute")
| 63.695652 | 120 | 0.736519 | 174 | 1,465 | 5.95977 | 0.304598 | 0.135005 | 0.101254 | 0.111861 | 0.480231 | 0.322083 | 0.322083 | 0.322083 | 0.175506 | 0.175506 | 0 | 0.000786 | 0.131741 | 1,465 | 22 | 121 | 66.590909 | 0.814465 | 0 | 0 | 0.095238 | 0 | 0 | 0.185666 | 0 | 0 | 0 | 0 | 0 | 0.428571 | 1 | 0.380952 | false | 0 | 0.095238 | 0 | 0.52381 | 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 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
928b9676a71b52831a3150e851b3660ba36d9a5e | 579 | py | Python | avatar/plugins/avatar_plugin.py | gitttt/avatar-python-private | aa33ac9f37b7a1d79943ac89109f3f9e38cf3736 | [
"ECL-2.0",
"Apache-2.0"
] | 30 | 2017-09-05T18:21:57.000Z | 2022-01-13T08:23:49.000Z | avatar/plugins/avatar_plugin.py | gitttt/avatar-python-private | aa33ac9f37b7a1d79943ac89109f3f9e38cf3736 | [
"ECL-2.0",
"Apache-2.0"
] | 1 | 2016-12-08T13:17:53.000Z | 2016-12-08T13:27:36.000Z | avatar/plugins/avatar_plugin.py | K-atc/avatar-python | c6d74f85f63333e3031e1f5e208d3f90e316a9e4 | [
"ECL-2.0",
"Apache-2.0"
] | 11 | 2017-09-26T07:36:50.000Z | 2020-10-31T00:47:08.000Z | class AvatarPlugin:
"""
Abstract interface for all Avatar plugins
Upon start() and stop(), plugins are expected to register/unregister
their own event handlers by the means of :func:`System.register_event_listener`
and :func:`System.unregister_event_listener`
"""
def __init__(self, system):
self._system = system
def init(self, **kwargs):
assert(False) #Not implemented
def start(self, **kwargs):
assert(False) #Not implemented
def stop(self, **kwargs):
assert(False) #Not implemented
| 27.571429 | 83 | 0.649396 | 68 | 579 | 5.397059 | 0.529412 | 0.081744 | 0.13079 | 0.171662 | 0.302452 | 0.302452 | 0.207084 | 0 | 0 | 0 | 0 | 0 | 0.253886 | 579 | 20 | 84 | 28.95 | 0.849537 | 0.487047 | 0 | 0.333333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | 1 | 0.444444 | false | 0 | 0 | 0 | 0.555556 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
929989a699a5e40cd08c6754c513c1391f4e851e | 3,371 | py | Python | test/test_datatypes.py | panny2207/OWL-RL | 218c5779290a0fbd653e40ab377e19b4f7c394fb | [
"W3C-20150513"
] | null | null | null | test/test_datatypes.py | panny2207/OWL-RL | 218c5779290a0fbd653e40ab377e19b4f7c394fb | [
"W3C-20150513"
] | null | null | null | test/test_datatypes.py | panny2207/OWL-RL | 218c5779290a0fbd653e40ab377e19b4f7c394fb | [
"W3C-20150513"
] | null | null | null | """
Test for OWL 2 RL/RDF rules from
Table 8. The Semantics of Datatypes
https://www.w3.org/TR/owl2-profiles/#Reasoning_in_OWL_2_RL_and_RDF_Graphs_using_Rules
NOTE: The following axioms are skipped on purpose
- dt-eq
- dt-diff
"""
from rdflib import Graph, Literal, Namespace, RDF, XSD, RDFS
import owlrl
DAML = Namespace('http://www.daml.org/2002/03/agents/agent-ont#')
T = Namespace('http://test.org/')
def test_dt_type1():
"""
Test dt-type1 rule for OWL 2 RL.
"""
g = Graph()
owlrl.DeductiveClosure(owlrl.OWLRL_Semantics).expand(g)
assert (RDF.PlainLiteral, RDF.type, RDFS.Datatype) in g
assert (RDF.XMLLiteral, RDF.type, RDFS.Datatype) in g
assert (RDFS.Literal, RDF.type, RDFS.Datatype) in g
assert (XSD.decimal, RDF.type, RDFS.Datatype) in g
assert (XSD.integer, RDF.type, RDFS.Datatype) in g
assert (XSD.nonNegativeInteger, RDF.type, RDFS.Datatype) in g
assert (XSD.nonPositiveInteger, RDF.type, RDFS.Datatype) in g
assert (XSD.positiveInteger, RDF.type, RDFS.Datatype) in g
assert (XSD.negativeInteger, RDF.type, RDFS.Datatype) in g
assert (XSD.long, RDF.type, RDFS.Datatype) in g
assert (XSD.int, RDF.type, RDFS.Datatype) in g
assert (XSD.short, RDF.type, RDFS.Datatype) in g
assert (XSD.byte, RDF.type, RDFS.Datatype) in g
assert (XSD.unsignedLong, RDF.type, RDFS.Datatype) in g
assert (XSD.unsignedInt, RDF.type, RDFS.Datatype) in g
assert (XSD.unsignedShort, RDF.type, RDFS.Datatype) in g
assert (XSD.unsignedByte, RDF.type, RDFS.Datatype) in g
assert (XSD.float, RDF.type, RDFS.Datatype) in g
assert (XSD.double, RDF.type, RDFS.Datatype) in g
assert (XSD.string, RDF.type, RDFS.Datatype) in g
assert (XSD.normalizedString, RDF.type, RDFS.Datatype) in g
assert (XSD.token, RDF.type, RDFS.Datatype) in g
assert (XSD.language, RDF.type, RDFS.Datatype) in g
assert (XSD.Name, RDF.type, RDFS.Datatype) in g
assert (XSD.NCName, RDF.type, RDFS.Datatype) in g
assert (XSD.NMTOKEN, RDF.type, RDFS.Datatype) in g
assert (XSD.boolean, RDF.type, RDFS.Datatype) in g
assert (XSD.hexBinary, RDF.type, RDFS.Datatype) in g
assert (XSD.base64Binary, RDF.type, RDFS.Datatype) in g
assert (XSD.anyURI, RDF.type, RDFS.Datatype) in g
assert (XSD.dateTime, RDF.type, RDFS.Datatype) in g
assert (XSD.dateTimeStamp, RDF.type, RDFS.Datatype) in g
def test_dt_type2():
"""
Test dt-type2 rule for OWL 2 RL.
"""
p_one = Literal(1, datatype=XSD.positiveInteger)
g = Graph()
g.add((T.A, T.prop, p_one))
owlrl.DeductiveClosure(owlrl.OWLRL_Semantics).expand(g)
assert (T.A, T.prop, p_one) in g
assert (p_one, RDF.type, XSD.positiveInteger) in g
def test_dt_not_type():
"""
Test dt-not-type rule for OWL 2 RL.
"""
m_one = Literal(-1, datatype=XSD.nonNegativeInteger)
g = Graph()
g.add((T.A, T.prop, m_one))
owlrl.DeductiveClosure(owlrl.OWLRL_Semantics).expand(g)
# TODO, we know this one fails. It is not supposed to.
#assert (m_one, RDF.type, XSD.nonNegativeInteger) not in g
assert True
result = next(g.objects(predicate=DAML.error))
expected = Literal(
'Lexical value of the literal \'-1\' does not match its datatype'
' (http://www.w3.org/2001/XMLSchema#nonNegativeInteger)'
)
assert expected == result
| 35.861702 | 85 | 0.68407 | 524 | 3,371 | 4.351145 | 0.236641 | 0.107456 | 0.130263 | 0.266667 | 0.564035 | 0.518421 | 0.503509 | 0.478947 | 0 | 0 | 0 | 0.010241 | 0.188965 | 3,371 | 93 | 86 | 36.247312 | 0.823702 | 0.131415 | 0 | 0.103448 | 0 | 0 | 0.060195 | 0 | 0 | 0 | 0 | 0.010753 | 0.62069 | 1 | 0.051724 | false | 0 | 0.034483 | 0 | 0.086207 | 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 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
929dfa2e3f9cf68cb55576bcbba4406af6eaa25b | 381 | py | Python | avazu-ctr/rf.py | ldamewood/renormalization | 9dd2293f8e39fd671abae4f4f5914c9ccbcd5519 | [
"MIT"
] | 6 | 2016-11-26T02:39:27.000Z | 2018-05-11T02:02:03.000Z | avazu-ctr/rf.py | chrinide/renormalization | 9dd2293f8e39fd671abae4f4f5914c9ccbcd5519 | [
"MIT"
] | null | null | null | avazu-ctr/rf.py | chrinide/renormalization | 9dd2293f8e39fd671abae4f4f5914c9ccbcd5519 | [
"MIT"
] | 5 | 2015-01-12T20:22:56.000Z | 2018-03-22T03:38:15.000Z | #!/usr/bin/env python
from __future__ import print_function
from sklearn.feature_extraction import FeatureHasher
from sklearn.ensemble import RandomForestClassifier
from sklearn.pipeline import make_pipeline
from sklearn.metrics import log_loss
import ctr
learner = RandomForestClassifier(verbose = False, n_jobs = -1)
for ID,x,y in ctr.data(ctr.train, batchsize = 1):
pass | 27.214286 | 62 | 0.811024 | 53 | 381 | 5.660377 | 0.679245 | 0.146667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005988 | 0.12336 | 381 | 14 | 63 | 27.214286 | 0.892216 | 0.052493 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.111111 | 0.666667 | 0 | 0.666667 | 0.111111 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 3 |
92a48b86c4e76dd5956f70160e597a930611bbec | 11,633 | py | Python | scripts/flowed_plaquette_plot.py | hmvege/GluonicLQCD | 9bb7466fce408bf51cb98d65f639acd37d034d62 | [
"MIT"
] | 1 | 2019-04-12T08:12:30.000Z | 2019-04-12T08:12:30.000Z | scripts/flowed_plaquette_plot.py | hmvege/GluonicLQCD | 9bb7466fce408bf51cb98d65f639acd37d034d62 | [
"MIT"
] | 2 | 2021-03-14T12:30:39.000Z | 2021-03-14T12:33:17.000Z | scripts/flowed_plaquette_plot.py | hmvege/GluonicLQCD | 9bb7466fce408bf51cb98d65f639acd37d034d62 | [
"MIT"
] | 1 | 2020-05-14T02:12:33.000Z | 2020-05-14T02:12:33.000Z | import matplotlib.pyplot as plt, numpy as np
plaq_morningstar_ubuntu = np.array("""
0 0.61401745
1 0.62927918
2 0.64409064
3 0.65844519
4 0.67233862
5 0.68576903
6 0.69873661
7 0.71124351
8 0.72329362
9 0.73489239
10 0.74604666
11 0.75676448
12 0.76705495
13 0.77692801
14 0.78639435
15 0.79546523
16 0.80415238
17 0.81246785
18 0.82042391
19 0.82803298
20 0.83530752
21 0.84225997
22 0.84890267
23 0.85524782
24 0.86130743
25 0.86709327
26 0.87261685
27 0.87788938
28 0.88292176
29 0.88772457
30 0.89230805
31 0.89668206
32 0.90085616
33 0.90483950
34 0.90864091
35 0.91226887
36 0.91573149
37 0.91903657
38 0.92219154
39 0.92520354
40 0.92807937
41 0.93082553
42 0.93344823
43 0.93595338
44 0.93834663
45 0.94063334
46 0.94281864
47 0.94490740
48 0.94690426
49 0.94881362
50 0.95063970
51 0.95238648
52 0.95405775
53 0.95565713
54 0.95718804
55 0.95865374
56 0.96005734
57 0.96140177
58 0.96268983
59 0.96392419
60 0.96510736
61 0.96624174
62 0.96732962
63 0.96837315
64 0.96937441
65 0.97033534
66 0.97125780
67 0.97214355
68 0.97299429
69 0.97381159
70 0.97459698
71 0.97535190
72 0.97607772
73 0.97677575
74 0.97744721
75 0.97809330
76 0.97871513
77 0.97931378
78 0.97989024
79 0.98044550
80 0.98098048
81 0.98149603
82 0.98199301
83 0.98247220
84 0.98293437
85 0.98338022
86 0.98381045
87 0.98422571
88 0.98462662
89 0.98501378
90 0.98538776
91 0.98574909
92 0.98609828
93 0.98643585
94 0.98676224
95 0.98707791
96 0.98738328
97 0.98767877
98 0.98796476
99 0.98824163""".split(),dtype=float)
plaq_morningstar_mac = np.array("""
0 0.61049840
1 0.62569628
2 0.64044857
3 0.65474864
4 0.66859227
5 0.68197751
6 0.69490449
7 0.70737526
8 0.71939361
9 0.73096487
10 0.74209574
11 0.75279414
12 0.76306898
13 0.77293008
14 0.78238795
15 0.79145369
16 0.80013886
17 0.80845533
18 0.81641522
19 0.82403079
20 0.83131432
21 0.83827811
22 0.84493434
23 0.85129505
24 0.85737212
25 0.86317717
26 0.86872158
27 0.87401642
28 0.87907249
29 0.88390022
30 0.88850975
31 0.89291083
32 0.89711292
33 0.90112507
34 0.90495602
35 0.90861415
36 0.91210751
37 0.91544379
38 0.91863039
39 0.92167434
40 0.92458240
41 0.92736100
42 0.93001630
43 0.93255417
44 0.93498018
45 0.93729968
46 0.93951774
47 0.94163920
48 0.94366865
49 0.94561049
50 0.94746888
51 0.94924778
52 0.95095098
53 0.95258204
54 0.95414440
55 0.95564128
56 0.95707577
57 0.95845080
58 0.95976915
59 0.96103347
60 0.96224629
61 0.96340998
62 0.96452682
63 0.96559897
64 0.96662848
65 0.96761731
66 0.96856731
67 0.96948024
68 0.97035779
69 0.97120154
70 0.97201301
71 0.97279364
72 0.97354481
73 0.97426782
74 0.97496390
75 0.97563425
76 0.97627999
77 0.97690217
78 0.97750183
79 0.97807993
80 0.97863740
81 0.97917510
82 0.97969389
83 0.98019456
84 0.98067786
85 0.98114453
86 0.98159524
87 0.98203067
88 0.98245144
89 0.98285814
90 0.98325135
91 0.98363161
92 0.98399945
93 0.98435535
94 0.98469980
95 0.98503324
96 0.98535610
97 0.98566881
98 0.98597174
99 0.98626529""".split(),dtype=float)
plaq_luscher_mac = np.array("""
0 0.61049839
1 0.62569626
2 0.64044854
3 0.65474860
4 0.66859222
5 0.68197746
6 0.69490443
7 0.70737520
8 0.71939354
9 0.73096480
10 0.74209567
11 0.75279406
12 0.76306891
13 0.77293000
14 0.78238787
15 0.79145362
16 0.80013878
17 0.80845525
18 0.81641514
19 0.82403071
20 0.83131425
21 0.83827803
22 0.84493426
23 0.85129498
24 0.85737205
25 0.86317710
26 0.86872151
27 0.87401636
28 0.87907242
29 0.88390016
30 0.88850969
31 0.89291078
32 0.89711286
33 0.90112501
34 0.90495597
35 0.90861410
36 0.91210746
37 0.91544375
38 0.91863034
39 0.92167429
40 0.92458235
41 0.92736096
42 0.93001626
43 0.93255413
44 0.93498014
45 0.93729964
46 0.93951770
47 0.94163916
48 0.94366862
49 0.94561046
50 0.94746885
51 0.94924775
52 0.95095095
53 0.95258202
54 0.95414437
55 0.95564125
56 0.95707574
57 0.95845077
58 0.95976913
59 0.96103345
60 0.96224627
61 0.96340996
62 0.96452680
63 0.96559895
64 0.96662846
65 0.96761729
66 0.96856729
67 0.96948023
68 0.97035777
69 0.97120152
70 0.97201299
71 0.97279363
72 0.97354480
73 0.97426780
74 0.97496389
75 0.97563424
76 0.97627997
77 0.97690216
78 0.97750182
79 0.97807992
80 0.97863739
81 0.97917509
82 0.97969388
83 0.98019455
84 0.98067785
85 0.98114452
86 0.98159524
87 0.98203066
88 0.98245143
89 0.98285813
90 0.98325134
91 0.98363161
92 0.98399944
93 0.98435535
94 0.98469979
95 0.98503323
96 0.98535610
97 0.98566880
98 0.98597174
99 0.98626529""".split(),dtype=float)
plaq_taylor_mac = np.array("""
0 0.61049847
1 0.62569641
2 0.64044875
3 0.65474887
4 0.66859255
5 0.68197783
6 0.69490485
7 0.70737565
8 0.71939403
9 0.73096531
10 0.74209620
11 0.75279461
12 0.76306947
13 0.77293058
14 0.78238846
15 0.79145420
16 0.80013937
17 0.80845584
18 0.81641573
19 0.82403129
20 0.83131482
21 0.83827860
22 0.84493482
23 0.85129553
24 0.85737258
25 0.86317762
26 0.86872202
27 0.87401685
28 0.87907291
29 0.88390063
30 0.88851014
31 0.89291122
32 0.89711329
33 0.90112543
34 0.90495637
35 0.90861449
36 0.91210784
37 0.91544411
38 0.91863069
39 0.92167464
40 0.92458268
41 0.92736128
42 0.93001657
43 0.93255442
44 0.93498043
45 0.93729992
46 0.93951797
47 0.94163942
48 0.94366887
49 0.94561070
50 0.94746908
51 0.94924798
52 0.95095116
53 0.95258222
54 0.95414457
55 0.95564144
56 0.95707593
57 0.95845095
58 0.95976930
59 0.96103362
60 0.96224643
61 0.96341011
62 0.96452695
63 0.96559909
64 0.96662860
65 0.96761743
66 0.96856742
67 0.96948035
68 0.97035789
69 0.97120164
70 0.97201311
71 0.97279374
72 0.97354490
73 0.97426791
74 0.97496399
75 0.97563434
76 0.97628007
77 0.97690225
78 0.97750191
79 0.97808000
80 0.97863747
81 0.97917517
82 0.97969396
83 0.98019462
84 0.98067792
85 0.98114459
86 0.98159530
87 0.98203073
88 0.98245149
89 0.98285820
90 0.98325140
91 0.98363167
92 0.98399950
93 0.98435540
94 0.98469984
95 0.98503328
96 0.98535615
97 0.98566885
98 0.98597179
99 0.98626533""".split(),dtype=float)
plaq_taylor4_mac = np.array("""
0 0.61049840
1 0.62569628
2 0.64044857
3 0.65474864
4 0.66859227
5 0.68197751
6 0.69490449
7 0.70737526
8 0.71939361
9 0.73096487
10 0.74209574
11 0.75279414
12 0.76306898
13 0.77293008
14 0.78238795
15 0.79145369
16 0.80013886
17 0.80845533
18 0.81641522
19 0.82403079
20 0.83131432
21 0.83827811
22 0.84493434
23 0.85129505
24 0.85737212
25 0.86317717
26 0.86872158
27 0.87401642
28 0.87907249
29 0.88390022
30 0.88850975
31 0.89291083
32 0.89711292
33 0.90112507
34 0.90495602
35 0.90861415
36 0.91210751
37 0.91544379
38 0.91863039
39 0.92167434
40 0.92458240
41 0.92736100
42 0.93001630
43 0.93255417
44 0.93498018
45 0.93729968
46 0.93951774
47 0.94163920
48 0.94366865
49 0.94561049
50 0.94746888
51 0.94924778
52 0.95095098
53 0.95258204
54 0.95414440
55 0.95564128
56 0.95707577
57 0.95845080
58 0.95976915
59 0.96103347
60 0.96224629
61 0.96340998
62 0.96452682
63 0.96559897
64 0.96662848
65 0.96761731
66 0.96856731
67 0.96948024
68 0.97035779
69 0.97120154
70 0.97201301
71 0.97279364
72 0.97354481
73 0.97426782
74 0.97496390
75 0.97563425
76 0.97627999
77 0.97690217
78 0.97750183
79 0.97807993
80 0.97863740
81 0.97917510
82 0.97969389
83 0.98019456
84 0.98067786
85 0.98114453
86 0.98159524
87 0.98203067
88 0.98245144
89 0.98285814
90 0.98325135
91 0.98363161
92 0.98399945
93 0.98435535
94 0.98469980
95 0.98503324
96 0.98535610
97 0.98566881
98 0.98597174
99 0.98626529""".split(),dtype=float)
def getFlowPlaq(arr):
tflow = arr[0::2] * 0.01
plaq_flow = arr[1::2]
return tflow, plaq_flow
fig1 = plt.figure(dpi=300)
# Morningstar plot
ax1 = fig1.add_subplot(311)
t_morningstar, pf_morningstar = getFlowPlaq(plaq_morningstar_mac)
ax1.plot(t_morningstar, pf_morningstar,"-", label="Flowed Plaquette")
ax1.grid(True)
# ax.set_xlabel(r"Flow time $\tau$")
ax1.set_ylabel(r"$P_{Morningstar}$")
ax1.set_title("Flowed plaquette value with different SU3 exponentiating methods")
ax1.tick_params(axis='x',which='major',labelsize=8)
# Luscher plot
ax2 = fig1.add_subplot(312)
t_luscher, pf_luscher = getFlowPlaq(plaq_luscher_mac)
ax2.plot(t_luscher, pf_luscher,"-", label="Flowed Plaquette")
ax2.grid(True)
ax2.set_ylabel(r"$P_{Lushcer}$")
ax2.tick_params(axis='x',which='major',labelsize=8)
# Taylor plot
ax3 = fig1.add_subplot(313)
t_taylor, pf_taylor = getFlowPlaq(plaq_taylor4_mac)
ax3.plot(t_taylor, pf_luscher,"-", label="Flowed Plaquette")
ax3.grid(True)
ax3.set_ylabel(r"$P_{Taylor}$")
ax3.tick_params(axis='x',which='major',labelsize=8)
fig1.savefig("../figures/plaquette_flow.png")
#### Differences ####
fig2 = plt.figure(dpi=300)
ax4 = fig2.add_subplot(111)
pf_diff1 = np.absolute(pf_morningstar - pf_luscher)
pf_diff2 = np.absolute(pf_morningstar - pf_taylor)
pf_diff3 = np.absolute(pf_luscher - pf_taylor)
# ax4.plot(t_luscher,pf_diff1,label=r"$|P_{Morningstar} - P_{Luscher}|$")
ax4.plot(t_luscher,pf_diff2,label=r"$|P_{Morningstar} - P_{Taylor}|$")
ax4.plot(t_luscher,pf_diff3,'--',label=r"$|P_{Luscher} - P_{Taylor}|$")
ax4.set_title(r"Differences in $SU(3)$ exponentiation methods")
ax4.set_yscale("log",nonposy='clip')
ax4.set_ylabel(r"$\Delta P$")
ax4.tick_params(axis='y',which='minor',labelsize=8)
ax4.tick_params(axis='y',which='major',labelsize=8)
ax4.set_xlabel(r"Flow time $\tau$")
ax4.legend()
fig2.savefig("../figures/exponentiation_differences.png")
# ax5 = fig2.add_subplot(312)
# ax5.set_yscale("log",nonposy='clip')
# ax5.set_ylabel(r"$\Delta P$")
# ax5.tick_params(axis='y',which='minor',labelsize=8)
# ax5.tick_params(axis='y',which='major',labelsize=8)
# ax5.legend()
# ax5 = fig2.add_subplot(312)
# ax5.set_yscale("log",nonposy='clip')
# ax5.tick_params(axis='y',which='minor',labelsize=8)
# ax5.tick_params(axis='y',which='major',labelsize=8)
# ax5.legend()
| 20.022375 | 81 | 0.63423 | 1,915 | 11,633 | 3.809399 | 0.305483 | 0.012337 | 0.017272 | 0.01645 | 0.425908 | 0.385058 | 0.372173 | 0.372173 | 0.348184 | 0.348184 | 0 | 0.660948 | 0.278432 | 11,633 | 580 | 82 | 20.056897 | 0.208125 | 0.047709 | 0 | 0.377289 | 0 | 0 | 0.849272 | 0.006333 | 0 | 0 | 0 | 0 | 0 | 1 | 0.001832 | false | 0 | 0.001832 | 0 | 0.005495 | 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 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
92a9d8e5eb6b7dfd1c874a961a7ca59965c56a76 | 278 | py | Python | inner_rpc/inner_rpc/ir_exceptions.py | chenjiee815/inner_rpc | d6b4945dfb3ea7fda7a64cfe23d19f8539f988cf | [
"Apache-2.0"
] | 1 | 2015-09-17T01:22:28.000Z | 2015-09-17T01:22:28.000Z | inner_rpc/inner_rpc/ir_exceptions.py | chenjiee815/inner_rpc | d6b4945dfb3ea7fda7a64cfe23d19f8539f988cf | [
"Apache-2.0"
] | null | null | null | inner_rpc/inner_rpc/ir_exceptions.py | chenjiee815/inner_rpc | d6b4945dfb3ea7fda7a64cfe23d19f8539f988cf | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
# encoding=utf-8
"""
inner_rpc.ir_exceptions
-----------------
该模块主要包括公共的异常定义
"""
class BaseError(Exception):
pass
class SocketError(BaseError):
pass
class SocketTimeout(SocketError):
pass
class DataError(BaseError):
pass
| 12.636364 | 33 | 0.643885 | 28 | 278 | 6.321429 | 0.678571 | 0.152542 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004484 | 0.197842 | 278 | 21 | 34 | 13.238095 | 0.789238 | 0.334532 | 0 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.5 | 0 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 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 | 3 |
92ae5b5d2fee593a7d7b0979f8e6f0afa7ccd217 | 160 | py | Python | malib/value_functions/__init__.py | wwxFromTju/malib | 7cd2a4af55cf1f56da8854e26ea7a4f3782ceea2 | [
"MIT"
] | 6 | 2021-05-19T10:25:36.000Z | 2021-12-27T03:30:33.000Z | malib/value_functions/__init__.py | wwxFromTju/malib | 7cd2a4af55cf1f56da8854e26ea7a4f3782ceea2 | [
"MIT"
] | 1 | 2021-05-29T04:51:37.000Z | 2021-05-30T06:18:10.000Z | malib/value_functions/__init__.py | ying-wen/malib_deprecated | 875338b81c4d87064ad31201f461ef742db05f25 | [
"MIT"
] | 1 | 2021-05-31T16:16:12.000Z | 2021-05-31T16:16:12.000Z | from malib.value_functions.value_function import (
MLPValueFunction,
CommNetValueFunction,
BiCNetValueFunction,
)
# __all__ = ["MLPValueFunction"]
| 20 | 50 | 0.7625 | 12 | 160 | 9.666667 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.15625 | 160 | 7 | 51 | 22.857143 | 0.859259 | 0.1875 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.2 | 0 | 0.2 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
2b8975fc52de46e8e473c2014db381061743a8e1 | 598 | py | Python | mall/apps/goods/views.py | codedaliu/meiduo | 909d75eb55e52f9dae8879c5ad1d48ffb52fa498 | [
"MIT"
] | null | null | null | mall/apps/goods/views.py | codedaliu/meiduo | 909d75eb55e52f9dae8879c5ad1d48ffb52fa498 | [
"MIT"
] | null | null | null | mall/apps/goods/views.py | codedaliu/meiduo | 909d75eb55e52f9dae8879c5ad1d48ffb52fa498 | [
"MIT"
] | null | null | null | from django.shortcuts import render
# Create your views here.
from rest_framework.views import APIView
from contents.serializers import HotSKUListSerializer
from goods.models import SKU
class HomeAPIView(APIView):
pass
'''
列表数据
热销数据:应该是到哪个分类去获取哪个分类的热销数据中
1.获取分类id
2.根据id获取数据
3.将数据转化为字典
4返回相应
'''
from rest_framework.generics import ListAPIView
class HotSKUListAPIView(ListAPIView):
def get_queryset(self):
category_id = self.kwargs['category_id']
return SKU.objects.filter(category_id=category_id).order_by('-sales')[:2]
serializer_class = HotSKUListSerializer | 19.290323 | 81 | 0.779264 | 73 | 598 | 6.260274 | 0.657534 | 0.087527 | 0.074398 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.009747 | 0.14214 | 598 | 31 | 82 | 19.290323 | 0.881092 | 0.038462 | 0 | 0 | 0 | 0 | 0.034274 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.083333 | false | 0.083333 | 0.416667 | 0 | 0.833333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 3 |
2b9799f7570f968fd082853bb9689a42c333baf1 | 115 | py | Python | mini-scripts/Python_Casting_(float).txt.py | Web-Dev-Collaborative/PYTHON_PRAC | 856f902fb43dcccae168d34ee6aacc02427a7ac6 | [
"MIT"
] | 5 | 2021-06-02T23:44:25.000Z | 2021-12-27T16:21:57.000Z | mini-scripts/Python_Casting_(float).txt.py | Web-Dev-Collaborative/PYTHON_PRAC | 856f902fb43dcccae168d34ee6aacc02427a7ac6 | [
"MIT"
] | 22 | 2021-05-31T01:33:25.000Z | 2021-10-18T18:32:39.000Z | mini-scripts/Python_Casting_(float).txt.py | Web-Dev-Collaborative/PYTHON_PRAC | 856f902fb43dcccae168d34ee6aacc02427a7ac6 | [
"MIT"
] | 3 | 2021-06-19T03:37:47.000Z | 2021-08-31T00:49:51.000Z | x = float(1)
y = float(2.8)
z = float("3")
w = float("4.2")
print(x)
print(y)
print(z)
print(w)
# Author: Bryan G
| 11.5 | 18 | 0.573913 | 25 | 115 | 2.64 | 0.56 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.06383 | 0.182609 | 115 | 9 | 19 | 12.777778 | 0.638298 | 0.13913 | 0 | 0 | 0 | 0 | 0.041237 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.5 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 3 |
2b9c734ead852fe398bcf4cfccc73af317c3a224 | 52 | py | Python | torrenttv/utils/list_utils/__init__.py | AlexCovizzi/torrenttv | 25ae5490568110a7ea1f2e5eb74505ef8eea002d | [
"MIT"
] | null | null | null | torrenttv/utils/list_utils/__init__.py | AlexCovizzi/torrenttv | 25ae5490568110a7ea1f2e5eb74505ef8eea002d | [
"MIT"
] | 19 | 2020-05-03T17:06:24.000Z | 2021-03-11T05:26:57.000Z | torrenttv/utils/list_utils/__init__.py | AlexCovizzi/torrenttv | 25ae5490568110a7ea1f2e5eb74505ef8eea002d | [
"MIT"
] | 1 | 2020-05-04T19:00:00.000Z | 2020-05-04T19:00:00.000Z | from .flatten import flatten
__all__ = ["flatten"]
| 13 | 28 | 0.730769 | 6 | 52 | 5.666667 | 0.666667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.153846 | 52 | 3 | 29 | 17.333333 | 0.772727 | 0 | 0 | 0 | 0 | 0 | 0.134615 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
2bd0eeb3efd70d103d079728734a516aeedb0822 | 462 | py | Python | code_doc/migrations/0004_auto_20141110_1508.py | coordt/code_doc | c2fac64ac3ad61952a2d9f036727166741f9aff9 | [
"BSD-3-Clause"
] | null | null | null | code_doc/migrations/0004_auto_20141110_1508.py | coordt/code_doc | c2fac64ac3ad61952a2d9f036727166741f9aff9 | [
"BSD-3-Clause"
] | null | null | null | code_doc/migrations/0004_auto_20141110_1508.py | coordt/code_doc | c2fac64ac3ad61952a2d9f036727166741f9aff9 | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [("code_doc", "0003_auto_20141107_1708")]
operations = [
migrations.RemoveField(model_name="project", name="description"),
migrations.RemoveField(model_name="projectversion", name="description"),
migrations.RemoveField(model_name="topic", name="description"),
]
| 28.875 | 80 | 0.714286 | 47 | 462 | 6.765957 | 0.617021 | 0.198113 | 0.245283 | 0.283019 | 0.283019 | 0.283019 | 0 | 0 | 0 | 0 | 0 | 0.043478 | 0.15368 | 462 | 15 | 81 | 30.8 | 0.769821 | 0.045455 | 0 | 0 | 0 | 0 | 0.205011 | 0.052392 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.222222 | 0 | 0.555556 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 3 |
2be8a156acf59142491eb2fae24285870882e1a5 | 4,333 | py | Python | dac.py | hurasum/esp32_python | 59302ea48c3e1e0190fed09f78bb18d5f49b9c71 | [
"Unlicense"
] | null | null | null | dac.py | hurasum/esp32_python | 59302ea48c3e1e0190fed09f78bb18d5f49b9c71 | [
"Unlicense"
] | 1 | 2021-12-14T09:34:25.000Z | 2021-12-20T13:41:03.000Z | dac.py | hurasum/esp32_python | 59302ea48c3e1e0190fed09f78bb18d5f49b9c71 | [
"Unlicense"
] | null | null | null | """
DAC typing class
ESP32 has two 8-bit DAC (digital to analog converter) channels, connected to GPIO25 (Channel 1) and GPIO26 (Channel 2).
The DAC driver allows these channels to be set to arbitrary voltages.<br The DAC channels can also be driven with DMA-style written sample data, via the I2S driver when using the “built-in DAC mode”.
This class includes full support for using ESP32 DAC peripheral.
ESP32 DAC output voltage range is 0-Vdd (3.3 V), the resolution is 8-bits
"""
class DAC:
def deinit(self):
"""
Deinitialize the dac object, free the pin used.
"""
pass
def write(self, value):
"""
Set the DAC value. Valid range is: 0 - 255
The value of 255 sets the voltage on dac pin to 3.3 V
"""
pass
def waveform(self, freq, type ,duration=0 ,scale=0 ,offset=0 ,invert=2):
"""
Generate the waveform on the dac output
Arg Description
freq the waveform frequency; valid range:
16-32000 Hz for sine wave
500-32000 Hz for noise
170 - 3600 Hz for triangle
170 - 7200 Hz for ramp and sawtooth
type the waveform type, use one of the defined constants:
SINE, TRIANGLE, RAMP, SAWTOOTH and NOISE
duration optional, is given, waits for duration ms and stops the waveform
scale optional, only valid for sine wave; range: 0-3; scale the output voltage by 2^scale
offset optional, only valid for sine wave; range: 0-255; ofset the output voltage by offset value
invert optional, only valid for sine wave; range: 0-3; invert the half-cycle of the sine wave
"""
pass
def beep(self, freq, duration ,scale=0):
"""
Generate the sine wave beep on the dac output
Arg Description
freq fequency; valid range:
16-32000 Hz
duration the duration of the beep in ms
scale optional; range: 0-3; scale the output voltage by 2^scale
"""
pass
def write_timed(self, data, samplerate ,mode ,wait=False):
"""
Output the values on dac pin from array or file using ESP32 I2S peripheral
The data in array or file must be 8-bit DAC values
The data from array or file obtained with machine.ADC.read_timed() can be used.
Arg Description
data array object or filename
If an array object is given, write data from array object
The array object can be array of type 'B', or bytearray
If the filename is given, the datafrom the file will be output
samplerate the sample rate at which the data will be output
valid range: 5000 - 500000 Hz
mode optional, default: machine.DAC.NORMAL; if set to machine.DAC.CIRCULAR the data from array or file will be repeated indefinitely (or until stopped)
wait optional, default: False; if set to True waits for data output to finish
"""
pass
def write_buffer(self, data, freq ,mode ,wait=False):
"""
Output the values on dac pin from an array using timer
The in the array must be 8-bit DAC values
The data from an array obtained with machine.ADC.collect() can be used.
Arg Description
data array object of type 'B'
freq float; the frequency at which the data will be output
valid range: 0.001 - 18000 Hz
mode optional, default: machine.DAC.NORMAL; if set to machine.DAC.CIRCULAR the data from array will be repeated indefinitely (or until stopped).
Some 'cliks' can be expected when playing continuously if the first value differs from the last one.
wait optional, default: False; if set to True waits for data output to finish
"""
pass
def wavplay(self, wavfile, correct):
"""
Plays the WAV file on dac pin
Only PCM, 8-bit mono WAV files with sample rate >= 22000 can be played
If the optional argument correct is given, the sample rate is corrected by correct factor.
The allowed range is: -8.0 - +8.0 (float values can be entered).
"""
pass
def stopwave(self):
"""
Stops the background proces started by dac.waveform(), dac.write_timed() or dac.wavplay() function.
"""
pass
| 39.036036 | 199 | 0.647357 | 650 | 4,333 | 4.309231 | 0.286154 | 0.017494 | 0.011424 | 0.021421 | 0.338451 | 0.324884 | 0.318815 | 0.267405 | 0.228133 | 0.158515 | 0 | 0.037279 | 0.294253 | 4,333 | 110 | 200 | 39.390909 | 0.878679 | 0.761828 | 0 | 0.470588 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.470588 | false | 0.470588 | 0 | 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 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
2bead42e8898fc07fa3042e49464fb1267055a6b | 44 | py | Python | vuln/__init__.py | Maskhe/DongTai-engine | 70d61617e4ba469adf8cf97879820d8a09a0359c | [
"Apache-2.0"
] | 16 | 2021-09-01T05:59:56.000Z | 2022-01-17T11:44:39.000Z | vuln/__init__.py | Maskhe/DongTai-engine | 70d61617e4ba469adf8cf97879820d8a09a0359c | [
"Apache-2.0"
] | 14 | 2021-09-17T10:00:20.000Z | 2022-02-15T10:55:32.000Z | vuln/__init__.py | Maskhe/DongTai-engine | 70d61617e4ba469adf8cf97879820d8a09a0359c | [
"Apache-2.0"
] | 26 | 2021-09-01T06:29:54.000Z | 2022-03-25T02:38:55.000Z | default_app_config = 'vuln.apps.VulnConfig'
| 22 | 43 | 0.818182 | 6 | 44 | 5.666667 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.068182 | 44 | 1 | 44 | 44 | 0.829268 | 0 | 0 | 0 | 0 | 0 | 0.454545 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
2bf2011196393733885cd4b7e26234b68e030539 | 212 | py | Python | solidity/install_solc.py | pdos-team/pdos | 7c96e36b4545d103cc56176197ec590fe2691344 | [
"MIT"
] | null | null | null | solidity/install_solc.py | pdos-team/pdos | 7c96e36b4545d103cc56176197ec590fe2691344 | [
"MIT"
] | null | null | null | solidity/install_solc.py | pdos-team/pdos | 7c96e36b4545d103cc56176197ec590fe2691344 | [
"MIT"
] | 1 | 2020-03-15T14:31:13.000Z | 2020-03-15T14:31:13.000Z | #!/usr/bin/env python3
import os
import sys
if os.getuid() != 0:
print ("Must be run as root, sorry.")
sys.exit(-1)
from solcx import install_solc_pragma
install_solc_pragma('>0.5.0 <0.6.0')
print ("Done.")
| 16.307692 | 38 | 0.683962 | 39 | 212 | 3.615385 | 0.692308 | 0.085106 | 0.241135 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.049724 | 0.146226 | 212 | 12 | 39 | 17.666667 | 0.729282 | 0.099057 | 0 | 0 | 0 | 0 | 0.236842 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.375 | 0 | 0.375 | 0.25 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
2bf4eed1a2461a7de84607671464c884ba1a974c | 3,301 | py | Python | backend/backend/settings/base.py | rrhg/react-django-docker-boilerplate | 760237e7503c25740a77eacb6249d538ea9ad0b0 | [
"MIT"
] | null | null | null | backend/backend/settings/base.py | rrhg/react-django-docker-boilerplate | 760237e7503c25740a77eacb6249d538ea9ad0b0 | [
"MIT"
] | null | null | null | backend/backend/settings/base.py | rrhg/react-django-docker-boilerplate | 760237e7503c25740a77eacb6249d538ea9ad0b0 | [
"MIT"
] | null | null | null | """
Base settings to build other settings files upon.
"""
import os
"""
Django settings for backend project.
Generated by 'django-admin startproject' using Django 3.1.4.
For more information on this file, see
https://docs.djangoproject.com/en/3.1/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.1/ref/settings/
"""
from pathlib import Path
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent.parent
BOILERPLATE_DIR = BASE_DIR.parent
# Apps used in both development & production
INSTALLED_APPS = [
'polls.apps.PollsConfig',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'corsheaders',
'rest_framework',
]
# Middleware used in both development & production
MIDDLEWARE = [
'corsheaders.middleware.CorsMiddleware',
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'backend.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'backend.wsgi.application'
# Database
# https://docs.djangoproject.com/en/3.1/ref/settings/#databases
DATABASES = {
"default": {
"ENGINE": "django.db.backends.postgresql",
"NAME": os.environ.get("POSTGRES_DB"),
"USER": os.environ.get("POSTGRES_USER"),
"PASSWORD": os.environ.get("POSTGRES_PASSWORD"),
"HOST": os.environ.get("POSTGRES_HOST"),
"PORT": 5432,
}
}
# Password validation
# https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization
# https://docs.djangoproject.com/en/3.1/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.1/howto/static-files/
STATIC_URL = '/static/'
# static files (django admin & rest_framework) will be copied here by collectstatic
STATIC_ROOT = './django-static/'
| 24.819549 | 91 | 0.688882 | 354 | 3,301 | 6.322034 | 0.403955 | 0.087131 | 0.053172 | 0.067024 | 0.197945 | 0.170241 | 0.100536 | 0.087578 | 0.053619 | 0 | 0 | 0.009218 | 0.178431 | 3,301 | 132 | 92 | 25.007576 | 0.816003 | 0.188428 | 0 | 0 | 1 | 0 | 0.55017 | 0.440051 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.082192 | 0.027397 | 0 | 0.027397 | 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 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
ecfc0d21e03b429f3f05fc69177ca324657bae11 | 52,954 | py | Python | siptrackweb/forms.py | lalusvipi/siptrackweb | e4d2882595a40d3dbb1bb74c1838937988726d8e | [
"BSD-2-Clause"
] | 38 | 2015-03-18T08:05:35.000Z | 2021-11-09T10:57:54.000Z | siptrackweb/forms.py | lalusvipi/siptrackweb | e4d2882595a40d3dbb1bb74c1838937988726d8e | [
"BSD-2-Clause"
] | 29 | 2015-06-25T11:28:07.000Z | 2019-11-30T21:15:30.000Z | siptrackweb/forms.py | lalusvipi/siptrackweb | e4d2882595a40d3dbb1bb74c1838937988726d8e | [
"BSD-2-Clause"
] | 13 | 2015-03-18T06:57:46.000Z | 2021-06-22T10:38:49.000Z | from django import forms
class EmptyForm(forms.Form):
pass
class LoginForm(forms.Form):
username = forms.CharField(
max_length=50,
label='Username'
)
password = forms.CharField(
max_length=32,
label='Password',
widget=forms.PasswordInput(),
required=True
)
class DeleteForm(forms.Form):
verify = forms.CharField(
initial='true',
widget=forms.HiddenInput()
)
class ConfirmForm(forms.Form):
verify = forms.CharField(
initial='true',
widget=forms.HiddenInput()
)
class ViewAddForm(forms.Form):
name = forms.CharField(
max_length=50,
label='Name'
)
description = forms.CharField(
max_length=100,
required=False,
label='Description'
)
class ViewUpdateForm(forms.Form):
name = forms.CharField(
max_length=50,
label='Name'
)
description = forms.CharField(
max_length=100,
required=False,
label='Description'
)
class ViewSearchForm(forms.Form):
searchstring = forms.CharField(
max_length=50,
required=True,
widget=forms.TextInput(attrs={'id': 'searchbox'})
)
class ViewAdvancedSearchForm(forms.Form):
searchAttribute = forms.CharField(
max_length=50,
required=True
)
searchValue = forms.CharField(
max_length=50,
required=False
)
attributesList = forms.CharField(
max_length=256,
required=False
)
OPTIONS = (
('devices', 'devices'),
('device categories', 'device categories'),
('passwords', 'passwords'),
('password categories', 'password categories'),
('networks', 'networks')
)
displayTypes = forms.MultipleChoiceField(
choices=OPTIONS,
required=False
)
class NetworkTreeAddForm(forms.Form):
name = forms.CharField(
max_length=50,
label='Name'
)
protocol = forms.ChoiceField(
label='Protocol',
choices=(('ipv4', 'ipv4'), ('ipv6', 'ipv6'))
)
class NetworkAddForm(forms.Form):
name = forms.CharField(
max_length=50,
label='Address',
help_text='The network/address in CIDR form (x.x.x.x or x.x.x.x/xx)'
)
description = forms.CharField(
max_length=100,
required=False,
label='Description'
)
class NetworkRangeAddForm(forms.Form):
range = forms.CharField(
max_length=50,
label='Range'
)
description = forms.CharField(
max_length=100,
required=False,
label='Description'
)
class NetworkDeleteForm(forms.Form):
recursive = forms.BooleanField(
label='Recursive delete',
required=False
)
class PasswordKeyAddForm(forms.Form):
name = forms.CharField(
max_length=50,
label='Name'
)
key = forms.CharField(
max_length=32,
label='Key',
widget=forms.PasswordInput(),
required=False
)
validate = forms.CharField(
max_length=32,
label='Key (again)',
widget=forms.PasswordInput(),
required=False
)
description = forms.CharField(
max_length=100,
required=False,
label='Description'
)
class CounterAddBasicForm(forms.Form):
name = forms.CharField(
max_length=50,
label='Name'
)
description = forms.CharField(
max_length=100,
required=False,
label='Description'
)
class CounterAddLoopingForm(forms.Form):
name = forms.CharField(
max_length=50,
label='Name'
)
description = forms.CharField(
max_length=100,
required=False,
label='Description'
)
values = forms.CharField(
max_length=5000,
label='Values',
help_text='one value per row',
widget=forms.Textarea(attrs={'cols':'30', 'rows': '5'})
)
class CounterUpdateBasicForm(forms.Form):
name = forms.CharField(
max_length=50,
label='Name'
)
description = forms.CharField(
max_length=100,
required=False,
label='Description'
)
value = forms.DecimalField(
min_value=0,
decimal_places=0,
label='Value'
)
class CounterUpdateLoopingForm(forms.Form):
name = forms.CharField(
max_length=50,
label='Name'
)
description = forms.CharField(
max_length=100,
required=False,
label='Description'
)
value = forms.CharField(
max_length=50,
label='Value'
)
values = forms.CharField(
max_length=5000,
label='Values',
help_text='one value per row',
widget=forms.Textarea(attrs={'cols':'30', 'rows': '5'})
)
class CounterSetForm(forms.Form):
value = forms.DecimalField(
min_value=0,
decimal_places=0,
label='Value'
)
class PasswordAddForm(forms.Form):
pw_username = forms.CharField(
max_length=50,
label='Username',
required=False
)
pw_password = forms.CharField(
max_length=250,
label='Password',
widget=forms.PasswordInput(),
required=False,
help_text='Max length: 250, leave empty for generated password.'
)
validate = forms.CharField(
max_length=250,
label='Password (again)',
widget=forms.PasswordInput(),
required=False
)
description = forms.CharField(
max_length=100,
required=False,
label='Description'
)
def __init__(self, password_keys, *args, **kwargs):
super(PasswordAddForm, self).__init__(*args, **kwargs)
keylist = [('__no-password-key__', 'None')]
for key in password_keys:
value = (key.oid, key.attributes['name'])
if key.attributes.get('default', False) is True:
keylist.insert(0, value)
else:
keylist.append(value)
field = forms.ChoiceField(
label='Password key',
choices=keylist
)
self.fields['passwordkey'] = field
class PasswordUpdateForm(forms.Form):
pw_username = forms.CharField(max_length = 50, label = 'Username',
required = False)
pw_password = forms.CharField(max_length = 250, label = 'Password',
widget = forms.PasswordInput(), required = False,
help_text = 'Max length: 250, leave empty for generated password.')
validate = forms.CharField(max_length = 250, label = 'Password (again)',
widget = forms.PasswordInput(), required = False)
description = forms.CharField(max_length = 100, required = False,
label = 'Description')
def __init__(self, password_keys, *args, **kwargs):
super(PasswordUpdateForm, self).__init__(*args, **kwargs)
keylist = [('__no-password-key__', 'None')]
for key in password_keys:
value = (key.oid, key.attributes['name'])
if key.attributes.get('default', False) is True:
keylist.insert(0, value)
else:
keylist.append(value)
field = forms.ChoiceField(label = 'Password key', choices = keylist)
self.fields['passwordkey'] = field
class DeviceTemplateAddForm(forms.Form):
name = forms.CharField(max_length = 50, label = 'Name')
description = forms.CharField(max_length = 80, label = 'Description',
help_text = 'Description of this template.', required = False)
inheritance_only = forms.BooleanField(label = 'Inheritance only',
required = False,
initial = False,
help_text = 'Template is used for inheritance only.')
device_creation = forms.BooleanField(label = 'Device creation',
required = False,
initial = False,
help_text = 'Template is used for device creation.')
def __init__(self, templates, *args, **kwargs):
super(DeviceTemplateAddForm, self).__init__(*args, **kwargs)
choices = []
for template in templates:
choices.append((template.oid,
template.attributes.get('name', '[UKNOWN]')))
field = forms.MultipleChoiceField(required = False,
label = 'Inherited templates',
choices = choices)
self.fields['inherited_templates'] = field
class NetworkTemplateAddForm(forms.Form):
name = forms.CharField(max_length = 50, label = 'Name')
description = forms.CharField(max_length = 80, label = 'Description',
help_text = 'Description of this template.', required = False)
inheritance_only = forms.BooleanField(label = 'Inheritance only',
required = False,
initial = False,
help_text = 'Template is used for inheritance only.')
def __init__(self, templates, *args, **kwargs):
super(NetworkTemplateAddForm, self).__init__(*args, **kwargs)
choices = []
for template in templates:
choices.append((template.oid,
template.attributes.get('name', '[UKNOWN]')))
field = forms.MultipleChoiceField(required = False,
label = 'Inherited templates',
choices = choices)
self.fields['inherited_templates'] = field
class DeviceTemplateUpdateForm(forms.Form):
name = forms.CharField(max_length = 50, label = 'Name')
description = forms.CharField(max_length = 80, label = 'Description',
help_text = 'Description of this template.', required = False)
inheritance_only = forms.BooleanField(label = 'Inheritance only',
required = False,
initial = False,
help_text = 'Template is used for inheritance only.')
device_creation = forms.BooleanField(label = 'Device creation',
required = False,
initial = False,
help_text = 'Template is used for device creation.')
def __init__(self, templates, *args, **kwargs):
super(DeviceTemplateUpdateForm, self).__init__(*args, **kwargs)
choices = []
for template in templates:
choices.append((template.oid,
template.attributes.get('name', '[UKNOWN]')))
field = forms.MultipleChoiceField(required = False,
label = 'Inherited templates',
choices = choices)
self.fields['inherited_templates'] = field
class NetworkTemplateUpdateForm(forms.Form):
name = forms.CharField(max_length = 50, label = 'Name')
description = forms.CharField(max_length = 80, label = 'Description',
help_text = 'Description of this template.', required = False)
inheritance_only = forms.BooleanField(label = 'Inheritance only',
required = False,
initial = False,
help_text = 'Template is used for inheritance only.')
def __init__(self, templates, *args, **kwargs):
super(NetworkTemplateUpdateForm, self).__init__(*args, **kwargs)
choices = []
for template in templates:
choices.append((template.oid,
template.attributes.get('name', '[UKNOWN]')))
field = forms.MultipleChoiceField(required = False,
label = 'Inherited templates',
choices = choices)
self.fields['inherited_templates'] = field
class TemplateRuleTextAddForm(forms.Form):
attr_name = forms.CharField(max_length = 50, label = 'Attribute name',
help_text = 'Name of attribute to create.')
hidden = forms.BooleanField(label = 'Hide attribute',
required = False,
initial = False,
help_text = 'If true, the attribute will hidden per default if it is large/wikitext.')
important = forms.BooleanField(label = 'Important attribute',
required = False,
initial = False,
help_text = 'If true, the attribute will be displayed on the device/entity overview page.')
large = forms.BooleanField(label = 'Large attribute',
required = False,
initial = False,
help_text = 'If true, the attribute will have a separate display box.')
wikitext = forms.BooleanField(label = 'Wikitext attribute',
required = False,
initial = False,
help_text = 'If true, the attribute will be displayed using wikitext parsing, implies "large".')
description = forms.CharField(max_length = 80, label = 'Description',
help_text = 'Description of this rule.', required = False)
priority = forms.IntegerField(label = 'Priority',
min_value = 0, initial = 10,
help_text = 'The priority of this rule when using the templates, lower value will be displayed first.')
versions = forms.IntegerField(label = 'Versions',
min_value = 1, initial = 1,
help_text = 'Number of stored versions of the attribute.')
class TemplateRuleFixedAddForm(forms.Form):
attr_name = forms.CharField(max_length = 50, label = 'Attribute name',
help_text = 'Name of attribute to create.')
string_value = forms.CharField(max_length = 100, label = 'String value',
help_text = 'The created attributes value.')
variable_expansion = forms.BooleanField(label = 'Expand variables',
required = False,
initial = False)
important = forms.BooleanField(label = 'Important attribute',
required = False,
initial = False,
help_text = 'If true, the attribute will be displayed on the device/entity overview page.')
description = forms.CharField(max_length = 80, label = 'Description',
help_text = 'Description of this rule.', required = False)
priority = forms.IntegerField(label = 'Priority',
min_value = 0, initial = 10,
help_text = 'The priority of this rule when using the templates, lower value will be displayed first.')
versions = forms.IntegerField(label = 'Versions',
min_value = 1, initial = 1,
help_text = 'Number of stored versions of the attribute.')
class TemplateRuleRegmatchAddForm(forms.Form):
attr_name = forms.CharField(max_length = 50, label = 'Attribute name',
help_text = 'Name of attribute to create.')
regexp = forms.CharField(max_length = 50, label = 'Regexp',
help_text = 'Regular expression that must match the input value.')
description = forms.CharField(max_length = 80, label = 'Description',
help_text = 'Description of this rule.', required = False)
versions = forms.IntegerField(label = 'Versions',
min_value = 1, initial = 1,
help_text = 'Number of stored versions of the attribute.')
priority = forms.IntegerField(label = 'Priority',
min_value = 0, initial = 10,
help_text = 'The priority of this rule when using the templates, lower value will be displayed first.')
important = forms.BooleanField(label = 'Important attribute',
required = False,
initial = False,
help_text = 'If true, the attribute will be displayed on the device/entity overview page.')
class TemplateRuleBoolAddForm(forms.Form):
attr_name = forms.CharField(max_length = 50, label = 'Attribute name',
help_text = 'Name of attribute to create.')
default = forms.ChoiceField(label = 'Default',
choices = (('true', 'True'), ('false', 'False')),
help_text = 'Default value for attribute.')
description = forms.CharField(max_length = 80, label = 'Description',
help_text = 'Description of this rule.', required = False)
versions = forms.IntegerField(label = 'Versions',
min_value = 1, initial = 1,
help_text = 'Number of stored versions of the attribute.')
priority = forms.IntegerField(label = 'Priority',
min_value = 0, initial = 10,
help_text = 'The priority of this rule when using the templates, lower value will be displayed first.')
important = forms.BooleanField(label = 'Important attribute',
required = False,
initial = False,
help_text = 'If true, the attribute will be displayed on the device/entity overview page.')
class TemplateRuleIntAddForm(forms.Form):
attr_name = forms.CharField(max_length = 50, label = 'Attribute name',
help_text = 'Name of attribute to create.')
default = forms.IntegerField(label = 'Default',
initial = 0,
help_text = 'Default value.')
description = forms.CharField(max_length = 80, label = 'Description',
help_text = 'Description of this rule.', required = False)
versions = forms.IntegerField(label = 'Versions',
min_value = 1, initial = 1,
help_text = 'Number of stored versions of the attribute.')
priority = forms.IntegerField(label = 'Priority',
min_value = 0, initial = 10,
help_text = 'The priority of this rule when using the templates, lower value will be displayed first.')
important = forms.BooleanField(label = 'Important attribute',
required = False,
initial = False,
help_text = 'If true, the attribute will be displayed on the device/entity overview page.')
class TemplateRuleDeleteAttributeAddForm(forms.Form):
attr_name = forms.CharField(max_length = 50, label = 'Attribute name',
help_text = 'Name of attribute to delete.')
description = forms.CharField(max_length = 80, label = 'Description',
help_text = 'Description of this rule.', required = False)
priority = forms.IntegerField(label = 'Priority',
min_value = 0, initial = 10,
help_text = 'The priority of this rule when using the templates, lower value will be displayed first.')
class TemplateRuleFlushNodesAddForm(forms.Form):
description = forms.CharField(max_length = 80, label = 'Description',
help_text = 'Description of this rule.', required = False)
priority = forms.IntegerField(label = 'Priority',
min_value = 0, initial = 10,
help_text = 'The priority of this rule when using the templates, lower value will be displayed first.')
def __init__(self, node_types, *args, **kwargs):
super(TemplateRuleFlushNodesAddForm, self).__init__(*args, **kwargs)
choices = []
for node_type in node_types:
choices.append((node_type, node_type))
field = forms.MultipleChoiceField(required = False,
label = 'Included node types',
choices = choices,
help_text = 'If no node types are chosen for include, all types will match.')
self.fields['include'] = field
field = forms.MultipleChoiceField(required = False,
label = 'Excluded node types',
choices = choices)
self.fields['exclude'] = field
class TemplateRuleFlushAssociationsAddForm(forms.Form):
description = forms.CharField(max_length = 80, label = 'Description',
help_text = 'Description of this rule.', required = False)
priority = forms.IntegerField(label = 'Priority',
min_value = 0, initial = 10,
help_text = 'The priority of this rule when using the templates, lower value will be displayed first.')
def __init__(self, node_types, *args, **kwargs):
super(TemplateRuleFlushAssociationsAddForm, self).__init__(*args, **kwargs)
choices = []
for node_type in node_types:
choices.append((node_type, node_type))
field = forms.MultipleChoiceField(required = False,
label = 'Included node types',
choices = choices,
help_text = 'If no node types are chosen for include, all types will match.')
self.fields['include'] = field
field = forms.MultipleChoiceField(required = False,
label = 'Excluded node types',
choices = choices)
self.fields['exclude'] = field
class TemplateRulePasswordAddForm(forms.Form):
username = forms.CharField(max_length = 50, label = 'Username',
required = False)
passwd_description = forms.CharField(max_length = 50, label = 'Description',
required = False, help_text = 'Description of the added password.')
description = forms.CharField(max_length = 80, label = 'Description',
help_text = 'Description of this rule.', required = False)
priority = forms.IntegerField(label = 'Priority',
min_value = 0, initial = 10,
help_text = 'The priority of this rule when using the templates, lower value will be displayed first.')
def __init__(self, password_keys, *args, **kwargs):
super(TemplateRulePasswordAddForm, self).__init__(*args, **kwargs)
keylist = [('__no-password-key__', 'None')]
for key in password_keys:
keylist.append((key.oid, key.attributes['name']))
field = forms.ChoiceField(label = 'Password key', choices = keylist)
self.fields['passwordkey'] = field
class TemplateRuleSubdeviceAddForm(forms.Form):
description = forms.CharField(max_length = 80, label = 'Description',
help_text = 'Description of this rule.', required = False)
num_devices = forms.IntegerField(label = 'Number of subdevices',
min_value = 1, initial = 1,
help_text = 'Number of subdevices to create.')
sequence_offset = forms.IntegerField(label = 'Sequence offset',
initial = 0,
help_text = 'Base offset of sequence counter used when applying subdevice templates.')
priority = forms.IntegerField(label = 'Priority',
min_value = 0, initial = 10,
help_text = 'The priority of this rule when using the templates, lower value will be displayed first.')
def __init__(self, templates, *args, **kwargs):
super(TemplateRuleSubdeviceAddForm, self).__init__(*args, **kwargs)
templatelist = [('none', 'None')]
for template in templates:
templatelist.append((template.oid, template.attributes['name']))
field = forms.ChoiceField(label = 'Template', choices = templatelist)
self.fields['template'] = field
class TemplateRuleAssignNetworkAddForm(forms.Form):
description = forms.CharField(max_length = 80, label = 'Description',
help_text = 'Description of this rule.', required = False)
priority = forms.IntegerField(label = 'Priority',
min_value = 0, initial = 10,
help_text = 'The priority of this rule when using the templates, lower value will be displayed first.')
class NetworkAttributeAddSelectTypeForm(forms.Form):
ruletype = forms.ChoiceField(label = 'Attribute type',
choices = (('text', 'text'),
('bool','boolean')))
class AttributeAddSelectTypeForm(forms.Form):
ruletype = forms.ChoiceField(label = 'Attribute type',
choices = (
('text', 'text'),
('bool', 'boolean'),
('int', 'int')
))
class AttributeUpdateTextForm(forms.Form):
value = forms.CharField(max_length = 50, label = 'New value',
required = False)
class AttributeUpdateBoolForm(forms.Form):
value = forms.BooleanField(label = 'New value (true/false)',
required = False)
class AttributeUpdateIntForm(forms.Form):
value = forms.IntegerField(label = 'New value', initial = 0)
class AttributeUpdateLargeTextForm(forms.Form):
def __init__(self, attribute, *args, **kwargs):
super(AttributeUpdateLargeTextForm, self).__init__(*args, **kwargs)
field = forms.CharField(
max_length=5000,
label=attribute.name,
initial=attribute.value,
required=False,
widget=forms.Textarea(attrs={'cols':'100', 'rows': '20'})
)
self.fields['value'] = field
class AttributeAddTextForm(forms.Form):
name = forms.CharField(
max_length=50,
label='Name',
widget=forms.TextInput(
attrs={
'placeholder': 'Name'
}
)
)
value = forms.CharField(
max_length=50,
label='Value',
required=False,
widget=forms.TextInput(
attrs={
'placeholder': 'Value'
}
)
)
ruletype = forms.CharField(
initial='text',
widget=forms.HiddenInput()
)
large = forms.BooleanField(
label='Large attribute',
required=False,
help_text='Attribute will have a separate display box.'
)
wikitext = forms.BooleanField(
label='Wikitext attribute',
required=False,
help_text='Attribute will be displayed using textile wikitext parsing, implies "large".'
)
hidden = forms.BooleanField(
label='Hidden attribute',
required=False,
help_text='Attribute will hidden per default if it is large/wikitext.'
)
important = forms.BooleanField(
label='Important attribute',
required=False,
help_text='Attribute will be displayed on a device/entities overview page.'
)
versions = forms.IntegerField(
label='Versions',
min_value=1,
initial=1,
help_text='If set to > 1 a versioned attribute will be created.'
)
class PasswordAttributeAddTextForm(AttributeAddTextForm):
encrypted = forms.BooleanField(
label='Encrypted attribute',
required=False,
help_text='Attribute will be encrypted using the same key as the parent password.'
)
class AttributeAddBoolForm(forms.Form):
name = forms.CharField(max_length = 50, label = 'Name')
value = forms.ChoiceField(label = 'Value',
choices = (('true', 'True'), ('false', 'False')))
ruletype = forms.CharField(initial = 'bool',
widget = forms.HiddenInput())
versions = forms.IntegerField(label = 'Versions',
min_value = 1, initial = 1,
help_text = 'If set to > 1 a versioned attribute will be created.')
important = forms.BooleanField(label = 'Important attribute',
required = False,
help_text = 'If true, the attribute will be displayed on a device/entities overview page.')
class AttributeAddIntForm(forms.Form):
name = forms.CharField(max_length = 50, label = 'Name')
value = forms.IntegerField(label = 'Integer Value', initial = 0)
ruletype = forms.CharField(initial = 'int',
widget = forms.HiddenInput())
versions = forms.IntegerField(label = 'Versions',
min_value = 1, initial = 1,
help_text = 'If set to > 1 a versioned attribute will be created.')
important = forms.BooleanField(label = 'Important attribute',
required = False,
help_text = 'If true, the attribute will be displayed on a device/entities overview page.')
class DeviceCategoryAddForm(forms.Form):
name = forms.CharField(max_length = 50, label = 'Name')
description = forms.CharField(max_length = 100, required = False,
label = 'Description')
class DeviceCategoryUpdateForm(forms.Form):
name = forms.CharField(max_length = 50, label = 'Name')
description = forms.CharField(max_length = 100, required = False,
label = 'Description')
class TemplateSelectForm(forms.Form):
def __init__(self, templates, permit_none = True, *args, **kwargs):
super(TemplateSelectForm, self).__init__(*args, **kwargs)
tmpllist = []
if permit_none:
tmpllist.append((-1, 'None'))
for template in templates:
tmpllist.append((template.oid,
template.attributes.get('name', '[UNKNOWN]')))
field = forms.ChoiceField(label = 'Select template',
choices = tmpllist)
self.fields['template'] = field
class TemplateSetForm(forms.Form):
def __init__(self, template, *args, **kwargs):
super(TemplateSetForm, self).__init__(*args, **kwargs)
rules = list(template.combinedRules())
rules.sort(cmp=lambda x,y: cmp(x.attributes.get('priority', 10), y.attributes.get('priority', 10)))
for rule in rules:
field = None
if rule.class_name == 'template rule text':
wikitext = rule.attributes.get('wikitext', False)
if not wikitext:
field = forms.CharField(max_length = 50,
label = rule.attr_name,
required = False,
help_text = rule.attributes.get('description', None))
elif rule.class_name == 'template rule regmatch':
if rule.attributes.get('description', None):
help_text = '%s (must match: %s)' % (
rule.attributes.get('description'),
rule.regexp
)
else:
help_text = 'Must match: "%s"' % (rule.regexp)
field = forms.RegexField(max_length = 50,
label = rule.attr_name,
regex = rule.regexp, required = False,
help_text = help_text)
elif rule.class_name == 'template rule bool':
field = forms.BooleanField(label = rule.attr_name,
required = False,
initial = rule.default_value,
help_text = rule.attributes.get('description', None))
elif rule.class_name == 'template rule int':
field = forms.IntegerField(label = rule.attr_name,
initial = rule.default_value,
help_text = rule.attributes.get('description', None))
elif rule.class_name == 'template rule subdevice':
field = forms.IntegerField(label = 'Number of subdevices',
required = False,
initial = rule.num_devices,
help_text = rule.attributes.get('description', None))
if field:
self.fields['argument-%s' % (rule.oid)] = field
for rule in template.combinedRules():
if rule.class_name in [
'template rule regmatch', 'template rule bool',
'template rule int', 'template rule subdevice']:
continue
if rule.class_name == 'template rule text':
wikitext = rule.attributes.get('wikitext', False)
if wikitext:
field = forms.CharField(max_length = 50,
label = rule.attr_name,
required = False,
widget = forms.HiddenInput(),
help_text = rule.attributes.get('description', None))
else:
continue
elif rule.class_name == 'template rule password':
initial = ''
if rule.username:
initial = '%s' % (rule.username)
else:
initial = '[no username]'
if rule.description:
initial = '%s - %s' % (initial, rule.description)
field = forms.CharField(label = 'Add password',
required = False,
initial = initial,
widget=forms.TextInput(attrs={'readonly':'readonly'}),
help_text = rule.attributes.get('description', ''))
elif rule.class_name == 'template rule assign network':
field = forms.CharField(label = 'Auto-assign ip-address',
required = False,
widget = forms.HiddenInput(),
help_text = rule.attributes.get('description', ''))
elif rule.class_name == 'template rule fixed':
field = forms.CharField(label = rule.attr_name,
required = False,
initial = rule.value,
widget=forms.TextInput(attrs={'readonly':'readonly'}),
help_text = rule.attributes.get('description', ''))
apply_label = 'Add attribute %s = %s' % (rule.attr_name, rule.value)
elif rule.class_name == 'template rule flush nodes':
field = forms.CharField(label = 'Flush existing nodes',
required = False,
widget = forms.HiddenInput(),
help_text = rule.attributes.get('description', ''))
elif rule.class_name == 'template rule flush associations':
field = forms.CharField(label = 'Flush existing associations',
required = False,
widget = forms.HiddenInput(),
help_text = rule.attributes.get('description', ''))
elif rule.class_name == 'template rule delete attribute':
field = forms.CharField(label = 'Delete attribute',
required = False,
initial = rule.attr_name,
widget=forms.TextInput(attrs={'readonly':'readonly'}),
help_text = rule.attributes.get('description', ''))
else:
field = forms.CharField(label = rule.class_name,
required = False,
widget = forms.HiddenInput(),
help_text = rule.attributes.get('description', ''))
self.fields['argument-%s' % (rule.oid)] = field
# field = forms.BooleanField(label = 'Overwrite',
# required = False,
# initial = True,
# help_text = 'Overwrite existing attributes that have the same name as an attribute being created.')
# self.fields['overwrite'] = field
# self.fields['template'] = forms.CharField(initial = template.oid,
# widget = forms.HiddenInput())
class DeviceSetValuesForm(forms.Form):
def __init__(self, rules, *args, **kwargs):
super(DeviceSetValuesForm, self).__init__(*args, **kwargs)
for rule in rules:
is_wikitext = rule.attributes.get('wikitext', False)
if rule.dtype == 'text' and not is_wikitext:
field = forms.CharField(max_length = 50, label = rule.name,
required = False,
help_text = rule.attributes.get('description', None))
self.fields['attr-%s' % (rule.oid)] = field
elif rule.dtype == 'text' and is_wikitext:
widget = forms.HiddenInput()
field = forms.CharField(label = rule.name, widget = widget,
initial = ' ')
self.fields['attr-%s' % (rule.oid)] = field
elif rule.dtype == 'regmatch':
field = forms.RegexField(max_length = 50, label = rule.name,
regex = rule.value, required = False,
help_text = 'Must match: "%s"' % (rule.value))
self.fields['attr-%s' % (rule.oid)] = field
# elif rule.dtype == 'fixed':
# widget = forms.HiddenInput()
# field = forms.CharField(max_length = 50, label = rule.name,
# widget = widget, initial = rule.value)
# self.fields['attr-%s' % (rule.oid)] = field
if rule.dtype == 'bool':
field = forms.BooleanField(label = rule.name, required = False,
initial = rule.attributes.get('default', True),
help_text = rule.attributes.get('description', None))
self.fields['attr-%s' % (rule.oid)] = field
else:
pass
class DeviceNetworkAddForm(forms.Form):
def __init__(self, network_trees, *args, **kwargs):
super(DeviceNetworkAddForm, self).__init__(*args, **kwargs)
nt_choices = []
for tree in network_trees:
value = (tree.oid, tree.attributes.get('name', '[UNKNOWN]'))
if tree.attributes.get('default', False) is True:
nt_choices.insert(0, value)
else:
nt_choices.append(value)
field = forms.ChoiceField(label = 'Network Tree',
choices = nt_choices,
help_text = 'Network tree for address.')
self.fields['networktree'] = field
self.fields['network_name'] = \
forms.CharField(max_length = 50, label = 'IP-Address',
help_text = 'Valid forms: host: "a.b.c.d", '
'cidr subnet: "a.b.c.d/nn"')
self.fields['description'] = forms.CharField(max_length = 50, label = 'Description (optional)',
required = False)
class UserAddForm(forms.Form):
user_name = forms.CharField(max_length = 50, label = 'User Name')
real_name = forms.CharField(max_length = 50, label = 'Real Name (optional)',
required = False)
description = forms.CharField(max_length = 50, label = 'Description (optional)',
required = False)
administrator = forms.BooleanField(label = 'Administrator',
required = False,
initial = False)
password = forms.CharField(max_length = 32, label = 'Password',
widget = forms.PasswordInput(), required = True)
validate = forms.CharField(max_length = 32, label = 'Password (again)',
widget = forms.PasswordInput(), required = True)
class UserUpdateAdminForm(forms.Form):
user_name = forms.CharField(max_length = 50, label = 'User Name')
real_name = forms.CharField(max_length = 50, label = 'Real Name (optional)',
required = False)
description = forms.CharField(max_length = 50, label = 'Description (optional)',
required = False)
administrator = forms.BooleanField(label = 'Administrator',
required = False,
initial = False)
class UserUpdateForm(forms.Form):
user_name = forms.CharField(max_length = 50, label = 'User Name')
real_name = forms.CharField(max_length = 50, label = 'Real Name (optional)',
required = False)
description = forms.CharField(max_length = 50, label = 'Description (optional)',
required = False)
class UserResetPasswordForm(forms.Form):
password = forms.CharField(max_length = 32, label = 'Password',
widget = forms.PasswordInput(), required = False,
help_text = 'Reseting the password for a user will disconnect all subkeys etc. Use this if the old password for the user is unknown.')
validate = forms.CharField(max_length = 32, label = 'Password (again)',
widget = forms.PasswordInput(), required = False)
class UserUpdatePasswordForm(forms.Form):
password = forms.CharField(max_length = 32, label = 'New Password',
widget = forms.PasswordInput(), required = False)
validate = forms.CharField(max_length = 32, label = 'New Password (again)',
widget = forms.PasswordInput(), required = False)
old_password = forms.CharField(max_length = 32, label = 'Old Password',
widget = forms.PasswordInput(), required = False,
help_text = 'Needs to be supplied if you are changing the password of a user other than your own.')
class UserConnectKeyForm(forms.Form):
password_key_key = forms.CharField(max_length = 32, label = 'Password key password',
widget = forms.PasswordInput(), required = False,
help_text = 'Required if the current active user doesn\'t have the selected password key connected.')
def __init__(self, password_keys, require_user_password, *args, **kwargs):
super(UserConnectKeyForm, self).__init__(*args, **kwargs)
self.message = '''
If you're connecting a password key for another user, keep in mind; that
user must logout and login to siptrack before the key will be connected.
'''
keylist = []
for key in password_keys:
value = (key.oid, key.attributes['name'])
if key.attributes.get('default', False) is True:
keylist.insert(0, value)
else:
keylist.append(value)
field = forms.ChoiceField(label = 'Password key', choices = keylist)
self.fields['passwordkey'] = field
if require_user_password:
field = forms.CharField(
max_length=32,
label='User\'s password',
help_text='Required to create the users keypair if they\'ve never logged in before.',
widget=forms.PasswordInput(),
required=False
)
self.fields['user_password'] = field
class UserManagerLocalAddForm(forms.Form):
name = forms.CharField(max_length = 50, label = 'Name')
description = forms.CharField(max_length = 50, label = 'Description (optional)',
required = False)
class UserManagerLDAPAddForm(forms.Form):
name = forms.CharField(max_length = 50, label = 'Name')
description = forms.CharField(max_length = 50, label = 'Description (optional)',
required = False)
connection_type = forms.ChoiceField(label = 'Connection type',
choices = (('ldap', 'ldap'), ('ldaps', 'ldaps')))
server = forms.CharField(max_length = 256, label = 'LDAP server')
port = forms.CharField(max_length = 5, label = 'LDAP server port')
base_dn = forms.CharField(max_length = 128, label = 'Base DN')
valid_groups = forms.CharField(max_length = 1000, label = 'Valid LDAP group',
help_text = 'Only members of the given group will be able to log in, use ":" to seperate groups.',
required = False)
class UserManagerActiveDirectoryAddForm(forms.Form):
name = forms.CharField(max_length = 50, label = 'Name')
description = forms.CharField(max_length = 50, label = 'Description (optional)',
required = False)
server = forms.CharField(max_length = 256, label = 'AD server')
base_dn = forms.CharField(max_length = 128, label = 'Base DN')
valid_groups = forms.CharField(max_length = 1000, label = 'Valid LDAP group',
help_text = 'Only members of the given group will be able to log in, use ":" to seperate groups.',
required = False)
user_domain = forms.CharField(max_length = 128, label = 'User Domain')
class DeviceResetForm(forms.Form):
reset_attributes = forms.BooleanField(label = 'Reset attributes',
required = False,
initial = True)
reset_device_links = forms.BooleanField(label = 'Reset device links',
required = False,
initial = False)
reset_passwords = forms.BooleanField(label = 'Reset passwords',
required = False,
initial = True)
reset_subdevices = forms.BooleanField(label = 'Reset subdevices',
required = False,
initial = True)
class ConfigAddSelectTypeForm(forms.Form):
def __init__(self, parent, *args, **kwargs):
super(ConfigAddSelectTypeForm, self).__init__(*args, **kwargs)
choices = []
if parent.class_name not in ['view tree', 'ipv4 network',
'ipv6 network', 'network tree', 'ipv4 network range',
'ipv6 network range']:
choices.append(('netautoassign', 'Network auto assignment'))
choices.append(('value', 'Config value'))
field = forms.ChoiceField(label = 'Config type', choices = choices)
self.fields['config_type'] = field
class ConfigAddNetworkAutoassignForm(forms.Form):
config_type = forms.CharField(initial = 'netautoassign',
widget = forms.HiddenInput())
def __init__(self, network_trees, *args, **kwargs):
super(ConfigAddNetworkAutoassignForm, self).__init__(*args, **kwargs)
nt_choices = []
for tree in network_trees:
value = (tree.oid, tree.attributes.get('name', '[UNKNOWN]'))
if tree.attributes.get('default', False) is True:
nt_choices.insert(0, value)
else:
nt_choices.append(value)
field = forms.ChoiceField(label = 'Network Tree',
choices = nt_choices,
help_text = 'Network tree for address.')
self.fields['networktree'] = field
self.fields['range_start'] = \
forms.CharField(max_length = 50, label = 'Range Start',
help_text = 'Enter the start address of the range used for assignment"')
self.fields['range_end'] = \
forms.CharField(max_length = 50, label = 'Range End',
help_text = 'Enter the end address of the range used for assignment"')
class ConfigAddValueForm(forms.Form):
name = forms.CharField(max_length = 50, label = 'Name')
value = forms.CharField(max_length = 50, label = 'Value', required = False)
config_type = forms.CharField(initial = 'value',
widget = forms.HiddenInput())
class PermissionAddForm(forms.Form):
read_access = forms.BooleanField(label = 'Read access',
required = False)
write_access = forms.BooleanField(label = 'Write access',
required = False)
all_users = forms.BooleanField(label = 'Applies to all users',
required = False)
recursive = forms.BooleanField(label = 'Recursive',
required = False,
help_text = 'Applies recursively up the node tree.')
def __init__(self, users, groups, *args, **kwargs):
super(PermissionAddForm, self).__init__(*args, **kwargs)
field = forms.MultipleChoiceField(required = False,
label = 'Users',
choices = users,
help_text = 'Included users.')
self.fields['users'] = field
field = forms.MultipleChoiceField(required = False,
label = 'Groups',
choices = groups,
help_text = 'Included groups.')
self.fields['groups'] = field
class UserGroupAddForm(forms.Form):
name = forms.CharField(max_length = 50, label = 'Name')
description = forms.CharField(max_length = 50, label = 'Description',
required = False)
def __init__(self, users, *args, **kwargs):
super(UserGroupAddForm, self).__init__(*args, **kwargs)
field = forms.MultipleChoiceField(required = False,
label = 'Users',
choices = users,
help_text = 'Included users.')
self.fields['users'] = field
class UserGroupUpdateForm(forms.Form):
name = forms.CharField(max_length = 50, label = 'Name')
description = forms.CharField(max_length = 50, label = 'Description (optional)',
required = False)
def __init__(self, users, *args, **kwargs):
super(UserGroupUpdateForm, self).__init__(*args, **kwargs)
field = forms.MultipleChoiceField(required = False,
label = 'Users',
choices = users,
help_text = 'Included users.')
self.fields['users'] = field
class CommandAddForm(forms.Form):
freetext = forms.CharField(max_length = 200, label = 'Command text')
class CommandUpdateForm(forms.Form):
freetext = forms.CharField(max_length = 200, label = 'Command text')
class CommandQueueAddForm(forms.Form):
name = forms.CharField(max_length = 50, label = 'Name')
class CommandQueueUpdateForm(forms.Form):
name = forms.CharField(max_length = 50, label = 'Name')
class EventTriggerAddForm(forms.Form):
name = forms.CharField(max_length = 50, label = 'Name')
class EventTriggerUpdateForm(forms.Form):
name = forms.CharField(max_length = 50, label = 'Name')
class EventTriggerRulePythonAddForm(forms.Form):
name = forms.CharField(max_length = 50, label = 'Name')
code = forms.CharField(max_length = 5000, label = 'Code',
help_text = 'python code',
widget = forms.Textarea(attrs={'cols':'80', 'rows': '50'}))
class EventTriggerRulePythonUpdateForm(forms.Form):
name = forms.CharField(max_length = 50, label = 'Name')
code = forms.CharField(max_length = 5000, label = 'Code',
help_text = 'python code',
widget = forms.Textarea(attrs={'cols':'80', 'rows': '50'}))
class UsermanagerADSyncUsersForm(forms.Form):
username = forms.CharField(max_length = 50, label = 'Username')
password = forms.CharField(max_length = 32, label = 'Password',
widget = forms.PasswordInput(), required = True)
class PasswordCategoryAddForm(forms.Form):
name = forms.CharField(max_length = 50, label = 'Name')
description = forms.CharField(max_length = 100, required = False,
label = 'Description')
class DeviceCopyForm(forms.Form):
skip_attributes = forms.BooleanField(label = 'Skip attributes',
required = False, initial = False)
skip_devices = forms.BooleanField(label = 'Skip sub-devices',
required = False, initial = False)
skip_networks = forms.BooleanField(label = 'Skip networks',
required = False, initial = True)
class AttributeEditNotesForm(forms.Form):
notes = forms.CharField(max_length = 50000, label = '',
help_text = '',
required = False,
widget = forms.Textarea(attrs={'cols':'100', 'rows': '15'}))
class AttributeQuickeditForm(forms.Form):
value = forms.CharField(max_length = 100, required = False,
label = 'Value')
class RackUnitOccupiedForm(forms.Form):
reason = forms.CharField(max_length = 500, required = False,
label = 'Reason',
help_text = 'Describe what is occupying this unit.')
class RackUnitReservedForm(forms.Form):
reason = forms.CharField(max_length = 500, required = False,
label = 'Reason',
help_text = 'Describe why this unit is reserved.')
class DeviceConfigAddForm(forms.Form):
name = forms.CharField(max_length = 50, label = 'Name')
description = forms.CharField(max_length = 100, required = False,
label = 'Description')
max_versions = forms.IntegerField(label = 'Retained versions',
min_value = 0, initial = 10,
help_text = 'The number of config versions to retain, set to 0 for unlimited.')
class DeviceConfigSubmitForm(forms.Form):
data = forms.CharField(max_length = 1000000, label = '',
help_text = '',
required = True,
widget = forms.Textarea(attrs={'cols':'100', 'rows': '15'}))
class DeviceConfigTemplateAddForm(forms.Form):
name = forms.CharField(max_length = 50, label = 'Name')
description = forms.CharField(max_length = 100, required = False,
label = 'Description')
data = forms.CharField(max_length = 1000000, label = '',
help_text = '',
required = True,
widget = forms.Textarea(attrs={'cols':'100', 'rows': '15'}))
class DeviceConfigTemplateSubmitForm(forms.Form):
data = forms.CharField(max_length = 1000000, label = '',
help_text = '',
required = True,
widget = forms.Textarea(attrs={'cols':'100', 'rows': '15'}))
| 43.981728 | 146 | 0.587321 | 5,292 | 52,954 | 5.763605 | 0.082011 | 0.075276 | 0.082489 | 0.111603 | 0.745385 | 0.713845 | 0.690764 | 0.6607 | 0.64034 | 0.624701 | 0 | 0.013371 | 0.305114 | 52,954 | 1,203 | 147 | 44.018288 | 0.815528 | 0.01252 | 0 | 0.604089 | 0 | 0.001859 | 0.17819 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.019517 | false | 0.076208 | 0.009294 | 0 | 0.310409 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
a60999b70bdab73a337c0a801d933159535f4296 | 382 | py | Python | schemas/users.py | Ashishb21/propertyConnect | 60bc23125e4b45cc5e0c3b2cff8d57afd57ecbb8 | [
"MIT"
] | null | null | null | schemas/users.py | Ashishb21/propertyConnect | 60bc23125e4b45cc5e0c3b2cff8d57afd57ecbb8 | [
"MIT"
] | null | null | null | schemas/users.py | Ashishb21/propertyConnect | 60bc23125e4b45cc5e0c3b2cff8d57afd57ecbb8 | [
"MIT"
] | null | null | null | from typing import Optional
from pydantic import BaseModel,EmailStr
#properties required during user creation
class RegisterUser(BaseModel):
username: str
email : EmailStr
password : str
phone_no: int
class ShowUser(BaseModel):
username: str
email: EmailStr
is_active: bool
class Config: # to convert non dict obj to json
orm_mode = True | 21.222222 | 52 | 0.717277 | 48 | 382 | 5.645833 | 0.729167 | 0.125461 | 0.147601 | 0.184502 | 0.243542 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.235602 | 382 | 18 | 53 | 21.222222 | 0.928082 | 0.188482 | 0 | 0.307692 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.076923 | 0.153846 | 0 | 0.923077 | 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 | 1 | 0 | 0 | 3 |
a632c715f3c468a9c0bbb7af69ade32291a51b6d | 365 | py | Python | sailfish/kernel/__init__.py | macfadyen/sailfish | 44752a6769a2a7566a90dd9c8df21d4e2c49d720 | [
"MIT"
] | 9 | 2021-06-29T15:43:58.000Z | 2022-03-20T10:13:26.000Z | sailfish/kernel/__init__.py | macfadyen/sailfish | 44752a6769a2a7566a90dd9c8df21d4e2c49d720 | [
"MIT"
] | 1 | 2021-07-14T02:24:53.000Z | 2021-07-14T02:24:53.000Z | sailfish/kernel/__init__.py | macfadyen/sailfish | 44752a6769a2a7566a90dd9c8df21d4e2c49d720 | [
"MIT"
] | 8 | 2021-06-09T09:11:15.000Z | 2021-11-02T20:25:27.000Z | """
A Python module to facilitate JIT-compiled CPU-GPU agnostic compute kernels.
Kernel libraries are collections of functions written in C code that can be
compiled for CPU execution using a normal C compiler via the CFFI module, or
for GPU execution using a CUDA or ROCm compiler via cupy.
"""
from . import library
from . import parse_api
from . import system
| 30.416667 | 76 | 0.786301 | 60 | 365 | 4.766667 | 0.716667 | 0.104895 | 0.104895 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.175342 | 365 | 11 | 77 | 33.181818 | 0.950166 | 0.789041 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 3 |
a643fa6b9b973e3eaf970f5c1bcf721c67f1b002 | 141 | py | Python | code/chokudai_S002_g_01.py | KoyanagiHitoshi/AtCoder | 731892543769b5df15254e1f32b756190378d292 | [
"MIT"
] | 3 | 2019-08-16T16:55:48.000Z | 2021-04-11T10:21:40.000Z | code/chokudai_S002_g_01.py | KoyanagiHitoshi/AtCoder | 731892543769b5df15254e1f32b756190378d292 | [
"MIT"
] | null | null | null | code/chokudai_S002_g_01.py | KoyanagiHitoshi/AtCoder | 731892543769b5df15254e1f32b756190378d292 | [
"MIT"
] | null | null | null | from functools import reduce
from fractions import gcd
n=int(input())
for i in range(n):
a,b=map(int,input().split())
print(gcd(a,b)) | 23.5 | 32 | 0.680851 | 26 | 141 | 3.692308 | 0.692308 | 0.166667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.156028 | 141 | 6 | 33 | 23.5 | 0.806723 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0.166667 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
a654337a734e79739f69d3d53dd0928fa3930eaa | 10,448 | py | Python | portReporter.py | XXXTheInternXXX/portReporter | 40bf983379a6f21c4c9c7143cab61a8b9a024665 | [
"MIT"
] | null | null | null | portReporter.py | XXXTheInternXXX/portReporter | 40bf983379a6f21c4c9c7143cab61a8b9a024665 | [
"MIT"
] | null | null | null | portReporter.py | XXXTheInternXXX/portReporter | 40bf983379a6f21c4c9c7143cab61a8b9a024665 | [
"MIT"
] | null | null | null | # Scan IP for open SQL port (Default Port)
# Run Whois on the IP found
# Scan all the ports and show which ones are left open
# If no open ports, then move on
import os
import sys
amIRoot = os.getuid()
if not amIRoot == 0:
print ("Run me as root plz UwU. I need to send mor packetz.")
sys.exit(0)
import logging
logging.getLogger("scapy.runtime").setLevel(logging.ERROR)
from scapy.all import *
import random
from random import randint
import whois
#Arrays for logging
openPorts = []
filteredPorts = []
closedPorts = []
#Dictionary for WHOIS data
whoisDict = {}
logging.basicConfig(format='[%(asctime)s] - %(name)s - %(levelname)s - %(message)s]', datefmt='%m-%d-%Y %H:%M:%S')
logger = logging.getLogger('portReporter')
logger.setLevel(logging.INFO)
fh = logging.FileHandler('botLog.log')
fh.setLevel(logging.INFO)
formatter = logging.Formatter('[%(asctime)s] - %(name)s - %(levelname)s - %(message)s]', datefmt='%m-%d-%Y %H:%M:%S')
fh.setFormatter(formatter)
logger.addHandler(fh)
hostFileTime = time.strftime("%m-%d-%Y %H:%M:%S")
def scriptRestart():
logger.info("[*] Restarting script...")
python = sys.executable
os.execl(python, python, * sys.argv)
def ipGenerator():
# Check if the IP is real
# Yes, there is a way to do this with sockets...... I don't like it
targetIp = ".".join([ str(random.randint(0, 255)) for _ in range(4) ])
x = targetIp.split(".")
if x[0] == '10' or x[0] == '127' or x[0] == '0':
ipGenerator()
elif x[0] == '172' and x[1] in str(range(16,32)):
ipGenerator()
elif x[0] == '192' and x[1] == '168':
ipGenerator()
elif x[0] == '169' and x[1] == '254':
ipGenerator()
elif x[0] == '100' and x[1] in str(range(64,128)):
ipGenerator()
else:
logger.info("[+] Generated the IP %s", targetIp)
return targetIp
def scan4Ports():
# Check for filtering, use the best source port, and then restart if it is filtered / closed, if it is open it will continue
# Scan for common ports and check their status
logger.info("[+] Scanning for common ports against the IP {0}".format(target))
# Set X as 0 for working with arrays
x = 0
#Set a random ephemeral port
src_port = RandShort()
# Common ports (Top 1000) used by NMAP
commonPorts=[1,3,4,6,7,9,13,17,19,20,21,22,23,24,25,26,30,32,33,37,42,43,49,53,70,79,80,81,82,83,84,85,88,89,90,99,100,106,109,110,111,113,119,125,135,139,143,144,146,161,163,179,199,211,212,222,254,255,256,259,264,280,301,306,311,340,366,389,406,407,416,417,425,427,443,444,445,458,464,465,481,497,500,512,513,514,515,524,541,543,544,545,548,554,555,563,587,593,616,617,625,631,636,646,648,666,667,668,683,687,691,700,705,711,714,720,722,726,749,765,777,783,787,800,801,808,843,873,880,888,898,900,901,902,903,911,912,981,987,990,992,993,995,999,1000,1001,1002,1007,1009,1010,1011,1021,1022,1023,1024,1025,1026,1027,1028,1029,1030,1031,1032,1033,1034,1035,1036,1037,1038,1039,1040,1041,1042,1043,1044,1045,1046,1047,1048,1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069,1070,1071,1072,1073,1074,1075,1076,1077,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1102,1104,1105,1106,1107,1108,1110,1111,1112,1113,1114,1117,1119,1121,1122,1123,1124,1126,1130,1131,1132,1137,1138,1141,1145,1147,1148,1149,1151,1152,1154,1163,1164,1165,1166,1169,1174,1175,1183,1185,1186,1187,1192,1198,1199,1201,1213,1216,1217,1218,1233,1234,1236,1244,1247,1248,1259,1271,1272,1277,1287,1296,1300,1301,1309,1310,1311,1322,1328,1334,1352,1417,1433,1434,1443,1455,1461,1494,1500,1501,1503,1521,1524,1533,1556,1580,1583,1594,1600,1641,1658,1666,1687,1688,1700,1717,1718,1719,1720,1721,1723,1755,1761,1782,1783,1801,1805,1812,1839,1840,1862,1863,1864,1875,1900,1914,1935,1947,1971,1972,1974,1984,1998,1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2013,2020,2021,2022,2030,2033,2034,2035,2038,2040,2041,2042,2043,2045,2046,2047,2048,2049,2065,2068,2099,2100,2103,2105,2106,2107,2111,2119,2121,2126,2135,2144,2160,2161,2170,2179,2190,2191,2196,2200,2222,2251,2260,2288,2301,2323,2366,2381,2382,2383,2393,2394,2399,2401,2492,2500,2522,2525,2557,2601,2602,2604,2605,2607,2608,2638,2701,2702,2710,2717,2718,2725,2800,2809,2811,2869,2875,2909,2910,2920,2967,2968,2998,3000,3001,3003,3005,3006,3007,3011,3013,3017,3030,3031,3052,3071,3077,3128,3168,3211,3221,3260,3261,3268,3269,3283,3300,3301,3306,3322,3323,3324,3325,3333,3351,3367,3369,3370,3371,3372,3389,3390,3404,3476,3493,3517,3527,3546,3551,3580,3659,3689,3690,3703,3737,3766,3784,3800,3801,3809,3814,3826,3827,3828,3851,3869,3871,3878,3880,3889,3905,3914,3918,3920,3945,3971,3986,3995,3998,4000,4001,4002,4003,4004,4005,4006,4045,4111,4125,4126,4129,4224,4242,4279,4321,4343,4443,4444,4445,4446,4449,4550,4567,4662,4848,4899,4900,4998,5000,5001,5002,5003,5004,5009,5030,5033,5050,5051,5054,5060,5061,5080,5087,5100,5101,5102,5120,5190,5200,5214,5221,5222,5225,5226,5269,5280,5298,5357,5405,5414,5431,5432,5440,5500,5510,5544,5550,5555,5560,5566,5631,5633,5666,5678,5679,5718,5730,5800,5801,5802,5810,5811,5815,5822,5825,5850,5859,5862,5877,5900,5901,5902,5903,5904,5906,5907,5910,5911,5915,5922,5925,5950,5952,5959,5960,5961,5962,5963,5987,5988,5989,5998,5999,6000,6001,6002,6003,6004,6005,6006,6007,6009,6025,6059,6100,6101,6106,6112,6123,6129,6156,6346,6389,6502,6510,6543,6547,6565,6566,6567,6580,6646,6666,6667,6668,6669,6689,6692,6699,6779,6788,6789,6792,6839,6881,6901,6969,7000,7001,7002,7004,7007,7019,7025,7070,7100,7103,7106,7200,7201,7402,7435,7443,7496,7512,7625,7627,7676,7741,7777,7778,7800,7911,7920,7921,7937,7938,7999,8000,8001,8002,8007,8008,8009,8010,8011,8021,8022,8031,8042,8045,8080,8081,8082,8083,8084,8085,8086,8087,8088,8089,8090,8093,8099,8100,8180,8181,8192,8193,8194,8200,8222,8254,8290,8291,8292,8300,8333,8383,8400,8402,8443,8500,8600,8649,8651,8652,8654,8701,8800,8873,8888,8899,8994,9000,9001,9002,9003,9009,9010,9011,9040,9050,9071,9080,9081,9090,9091,9099,9100,9101,9102,9103,9110,9111,9200,9207,9220,9290,9415,9418,9485,9500,9502,9503,9535,9575,9593,9594,9595,9618,9666,9876,9877,9878,9898,9900,9917,9929,9943,9944,9968,9998,9999,10000,10001,10002,10003,10004,10009,10010,10012,10024,10025,10082,10180,10215,10243,10566,10616,10617,10621,10626,10628,10629,10778,11110,11111,11967,12000,12174,12265,12345,13456,13722,13782,13783,14000,14238,14441,14442,15000,15002,15003,15004,15660,15742,16000,16001,16012,16016,16018,16080,16113,16992,16993,17877,17988,18040,18101,18988,19101,19283,19315,19350,19780,19801,19842,20000,20005,20031,20221,20222,20828,21571,22939,23502,24444,24800,25734,25735,26214,27000,27352,27353,27355,27356,27715,28201,30000,30718,30951,31038,31337,32768,32769,32770,32771,32772,32773,32774,32775,32776,32777,32778,32779,32780,32781,32782,32783,32784,32785,33354,33899,34571,34572,34573,35500,38292,40193,40911,41511,42510,44176,44442,44443,44501,45100,48080,49152,49153,49154,49155,49156,49157,49158,49159,49160,49161,49163,49165,49167,49175,49176,49400,49999,50000,50001,50002,50003,50006,50300,50389,50500,50636,50800,51103,51493,52673,52822,52848,52869,54045,54328,55055,55056,55555,55600,56737,56738,57294,57797,58080,60020,60443,61532,61900,62078,63331,64623,64680,65000,65129,65389]
# So that we dont get riddled with messages from Scapy
conf.verb = 0
# Running a loop to check a port, report its status, and then add 1 to the loop to move on to the next port
# A way to make this faster would be to adjust the timeout for the scans but it doesn't really matter
while x < len(commonPorts):
dst_port=commonPorts[x]
try:
stealth_scan_resp = sr1(IP(dst=target)/TCP(sport=src_port,dport=dst_port,flags="S"),timeout=1.25)
if(str(type(stealth_scan_resp))=="<type 'NoneType'>"):
logger.info("[*] Port {0} is showing as FILTERED for {1}".format(dst_port,target))
filteredPorts.append(dst_port)
elif(stealth_scan_resp.haslayer(TCP)):
if(stealth_scan_resp.getlayer(TCP).flags == 0x12):
send_rst = sr(IP(dst=target)/TCP(sport=src_port,dport=dst_port,flags="R"),timeout=1.25)
logger.info("[+] Port {0} is showing as OPEN for {1}".format(dst_port,target))
openPorts.append(dst_port)
elif (stealth_scan_resp.getlayer(TCP).flags == 0x14):
logger.info("[-] Port {0} is showing as CLOSED for {1}".format(dst_port,target))
closedPorts.append(dst_port)
elif(stealth_scan_resp.haslayer(ICMP)):
if(int(stealth_scan_resp.getlayer(ICMP).type)==3 and int(stealth_scan_resp.getlayer(ICMP).code) in [1,2,3,9,10,13]):
logger.info("[*] Port {0} is showing as FILTERED for {1}".format(dst_port,target))
filteredPorts.append(dst_port)
else:
logger.info("[-] Port {0} is showing as CLOSED for {1}".format(dst_port,target))
closedPorts.append(dst_port)
except AttributeError:
logger.info("[-] Port {0} is showing as CLOSED for {1}".format(dst_port,target))
closedPorts.append(dst_port)
x += 1
continue
x += 1
if len(openPorts) == 0:
logger.info("[+] No OPEN ports found, restarting...")
scriptRestart()
else:
runWhoisOnTarget()
def runWhoisOnTarget():
whoisCheck = False
try:
logger.info("[+] Starting WHOIS on target {0}".format(target))
whoisCommand = whois.whois(target)
whoisCheck = True
if whoisCheck == True:
logger.info("[+] Scanned domain successfully")
whoisDict["targetEmail"] = whoisCommand.emails
parseDict()
else:
logger.info("[-] The IP {0} does not exist or an error occurred".format(target))
except KeyboardInterrupt:
logger.info("""[*] STOPPED BY USER""")
exit()
except:
logger.info("[-] The IP {0} has failed to resolve ***EXPIRED***".format(target))
scriptRestart()
def parseDict():
targetEmail = "Email: " + str(whoisDict["targetEmail"])
with open ('results.txt', 'a+') as file:
file.write('----Report for {0}----\n'.format(target))
file.write("Open Ports: " + str(openPorts) + "\n")
file.write("Filtered Ports: " + str(filteredPorts) + "\n")
file.write("Closed Ports: " + str(closedPorts) + "\n")
file.write("Email: " + str(whoisDict["targetEmail"]) + "\n")
file.write('----END OF REPORT----\n')
logData()
def logData():
logger.info("[*] ----Report for {0}----".format(target))
logger.info("[*] Open Ports: " + str(openPorts))
logger.info("[*] Filtered Ports: " + str(filteredPorts))
logger.info("[*] Closed Ports: " + str(closedPorts))
logger.info("[*] Email: " + str(whoisDict["targetEmail"]))
logger.info("[*] ----END OF REPORT----")
target = ipGenerator()
scan4Ports() | 71.07483 | 5,009 | 0.733825 | 1,811 | 10,448 | 4.213694 | 0.685809 | 0.027519 | 0.015725 | 0.011794 | 0.116236 | 0.112043 | 0.09029 | 0.082689 | 0.075613 | 0.075613 | 0 | 0.427231 | 0.08193 | 10,448 | 147 | 5,010 | 71.07483 | 0.368328 | 0.077718 | 0 | 0.206612 | 0 | 0.016529 | 0.118399 | 0 | 0 | 0 | 0.000832 | 0 | 0 | 1 | 0.049587 | false | 0 | 0.057851 | 0 | 0.115702 | 0.008264 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
a6661363f224a1485632726708cd49bda0d4229c | 80 | py | Python | landlab/components/lake_fill/__init__.py | saraahsimon/landlab | 1cf809b685efbccaaa149b5899a600c3ccedf30f | [
"MIT"
] | null | null | null | landlab/components/lake_fill/__init__.py | saraahsimon/landlab | 1cf809b685efbccaaa149b5899a600c3ccedf30f | [
"MIT"
] | null | null | null | landlab/components/lake_fill/__init__.py | saraahsimon/landlab | 1cf809b685efbccaaa149b5899a600c3ccedf30f | [
"MIT"
] | null | null | null | from .lake_fill_barnes import LakeMapperBarnes
__all__ = ["LakeMapperBarnes"]
| 16 | 46 | 0.8125 | 8 | 80 | 7.375 | 0.875 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.1125 | 80 | 4 | 47 | 20 | 0.830986 | 0 | 0 | 0 | 0 | 0 | 0.2 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
a69cf74b6c616c2a2b00c96da7d545e93b1d79f2 | 3,143 | py | Python | src/types_constraintes.py | julien-antigny/JConfig | ba344a3ecd5b104fb361733cb789aa6b03c41c28 | [
"Apache-2.0"
] | null | null | null | src/types_constraintes.py | julien-antigny/JConfig | ba344a3ecd5b104fb361733cb789aa6b03c41c28 | [
"Apache-2.0"
] | null | null | null | src/types_constraintes.py | julien-antigny/JConfig | ba344a3ecd5b104fb361733cb789aa6b03c41c28 | [
"Apache-2.0"
] | null | null | null | TYPES = {"int","float","str","bool","list"}
MATCH_TYPES = {"int": int, "float": float, "str": str, "bool": bool, "list": list}
CONSTRAINTS = {
"is_same_type": lambda x, y: type(x) == type(y),
"int" :{
"min_inc": lambda integer, min: integer >= min,
"min_exc": lambda integer, min: integer > min,
"max_inc": lambda integer, max: integer >= max,
"max_exc": lambda integer, max: integer > max,
"value_in": lambda integer, value_in: integer in value_in,
"value_out": lambda integer, value_out: not integer in value_out
},
"float": {
"min_inc": lambda integer, min: integer >= min,
"min_exc": lambda integer, min: integer > min,
"max_inc": lambda integer, max: integer >= max,
"max_exc": lambda integer, max: integer > max,
"value_in": lambda float_, value_in: float_ in value_in,
"value_out": lambda float_, value_out: not float_ in value_out
},
"str": {
"value_in": lambda string, value_in: string in value_in,
"value_out": lambda string, value_out: not string in value_out
},
"list": {
"equal_len": lambda list_, len_: len(list_) == len_,
"min_len" : lambda list_, min_len: len(list_) >= min_len,
"min_inc": lambda list_, min: all(x >= min for x in list_),
"min_exc": lambda list_, min: all(x > min for x in list_),
"max_inc": lambda list_, max: all(x <= max for x in list_),
"max_exc": lambda list_, max: all(x > max for x in list_)
}
}
CONSTRAINT_CHECKS = {
"int" :{
"min_inc": lambda min: type(min) in [int, float],
"min_exc": lambda min: type(min) in [int, float],
"max_inc": lambda max: type(max) in [int, float],
"max_exc": lambda max: type(max) in [int, float],
"value_in": lambda value_in: all([type(value) == int for value in value_in]),
"value_out": lambda value_out: all([type(value) == int for value in value_out])
},
"float": {
"min_inc": lambda min: type(min) in [int, float],
"min_exc": lambda min: type(min) in [int, float],
"max_inc": lambda max: type(max) in [int, float],
"max_exc": lambda max: type(max) in [int, float],
"value_in": lambda value_in: all([type(value) in [int,float] for value in value_in]),
"value_out": lambda value_out: all([type(value) in [int,float] for value in value_out])
},
"str": {
"value_in": lambda value_in: all([type(value) == str for value in value_in]),
"value_out": lambda value_out: all([type(value) == str for value in value_out])
},
"list": {
"equal_len": lambda len_: type(len_) == int and len_ > 0,
"min_len" : lambda min: type(min) == int and min >= 0,
"min_inc": lambda min: type(min) in [int,float],
"min_exc": lambda min: type(min) in [int,float],
"max_inc": lambda max: type(max) in [int,float],
"max_exc": lambda max: type(max) in [int,float],
}
}
| 40.818182 | 96 | 0.560929 | 440 | 3,143 | 3.8 | 0.072727 | 0.108852 | 0.083732 | 0.080742 | 0.772129 | 0.768541 | 0.727273 | 0.665072 | 0.620813 | 0.620813 | 0 | 0.000895 | 0.289214 | 3,143 | 76 | 97 | 41.355263 | 0.747538 | 0 | 0 | 0.444444 | 0 | 0 | 0.124552 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
a6a07499f9e41376f3c3ce20f6b665363c5200f6 | 1,529 | py | Python | visual_diarization_svm/clear_opt_flow_features_train.py | cvossos2046/visual_speaker_diarization_svm_project | bdc57d893ad9c04145568310c068f9c3e2305cf8 | [
"MIT"
] | null | null | null | visual_diarization_svm/clear_opt_flow_features_train.py | cvossos2046/visual_speaker_diarization_svm_project | bdc57d893ad9c04145568310c068f9c3e2305cf8 | [
"MIT"
] | null | null | null | visual_diarization_svm/clear_opt_flow_features_train.py | cvossos2046/visual_speaker_diarization_svm_project | bdc57d893ad9c04145568310c068f9c3e2305cf8 | [
"MIT"
] | null | null | null | def main():
video = "NET20070330_thlep_1_2"
file_path = "optical_flow_features_train/" + video
optical_flow_features_train = open(file_path + "/optical_flow_features_train.txt", "r")
clear_of_features_train = open(file_path + "/clear_opt_flow_features_train.txt", "w")
visual_ids = []
for line in optical_flow_features_train:
words = line.rstrip().split(' ')
if len(words) == 2:
if not int(words[1]) in visual_ids:
visual_ids.append(int(words[1]))
print("visual_ids", visual_ids)
optical_flow_features_train.close()
optical_flow_features_train = open(file_path + "/optical_flow_features_train.txt", "r")
for line in optical_flow_features_train:
words = line.rstrip().split(' ')
if len(words) == 2:
frame = int(words[0])
speaker_id = int(words[1])
else:
# every id that each speaker gets during the video
if speaker_id == 0 or speaker_id == 6 or speaker_id == 13 or speaker_id == 15 or speaker_id == 5 or speaker_id == 16 or speaker_id == 4 or speaker_id == 17 or speaker_id == 3 or speaker_id == 18:
clear_of_features_train.write(str(frame) + ' ' + str(speaker_id) + '\n')
for features in words:
clear_of_features_train.write(str(features) + ' ')
clear_of_features_train.write('\n')
optical_flow_features_train.close()
clear_of_features_train.close()
if __name__ == "__main__":
main()
| 39.205128 | 207 | 0.63244 | 211 | 1,529 | 4.21327 | 0.28436 | 0.219348 | 0.191226 | 0.24297 | 0.508436 | 0.386952 | 0.287964 | 0.287964 | 0.287964 | 0.287964 | 0 | 0.027193 | 0.254415 | 1,529 | 38 | 208 | 40.236842 | 0.752632 | 0.031393 | 0 | 0.344828 | 0 | 0 | 0.118999 | 0.099391 | 0 | 0 | 0 | 0 | 0 | 1 | 0.034483 | false | 0 | 0 | 0 | 0.034483 | 0.034483 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
470fe23973530032b500905cb2a05ec7d7b4bff3 | 238 | py | Python | ensysmod/model/ts_capacity_max.py | NOWUM/EnSysMod | 18c8a2198db3510e667c1f0298d00a3dfcb0aab7 | [
"MIT"
] | 1 | 2021-12-10T19:41:01.000Z | 2021-12-10T19:41:01.000Z | ensysmod/model/ts_capacity_max.py | NOWUM/EnSysMod | 18c8a2198db3510e667c1f0298d00a3dfcb0aab7 | [
"MIT"
] | 83 | 2021-10-20T22:54:28.000Z | 2022-03-24T19:07:06.000Z | ensysmod/model/ts_capacity_max.py | NOWUM/EnSysMod | 18c8a2198db3510e667c1f0298d00a3dfcb0aab7 | [
"MIT"
] | null | null | null | from sqlalchemy import Column, PickleType
from ensysmod.database.base_class import Base
from ensysmod.database.ref_base_class import RefCRBase
class CapacityMax(RefCRBase, Base):
max_capacities = Column(PickleType, nullable=False)
| 26.444444 | 55 | 0.827731 | 30 | 238 | 6.433333 | 0.533333 | 0.165803 | 0.207254 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.113445 | 238 | 8 | 56 | 29.75 | 0.914692 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.6 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
471cbbb20475ef2a9c2237f251f9c85a33676981 | 127 | py | Python | input_tests.py | KittyKuttleFish/Python | 3bb0309d55ac63982706653b00591fc286c6deeb | [
"Unlicense"
] | null | null | null | input_tests.py | KittyKuttleFish/Python | 3bb0309d55ac63982706653b00591fc286c6deeb | [
"Unlicense"
] | null | null | null | input_tests.py | KittyKuttleFish/Python | 3bb0309d55ac63982706653b00591fc286c6deeb | [
"Unlicense"
] | null | null | null | test = input("Please enter any string for input testing:")
print("Testing String...")
import time
time.sleep(5)
if(test)
| 21.166667 | 59 | 0.692913 | 19 | 127 | 4.631579 | 0.736842 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.009434 | 0.165354 | 127 | 5 | 60 | 25.4 | 0.820755 | 0 | 0 | 0 | 0 | 0 | 0.483607 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.2 | null | null | 0.2 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
47209eebbc149e62a5f0d2dabf52ddf2204e7525 | 1,036 | py | Python | tests/utils/test_string_utils.py | PeterSulcs/mlflow | 14c48e7bb1ca6cd6a3c1b249a486cd98bd5e7051 | [
"Apache-2.0"
] | 10,351 | 2018-07-31T02:52:49.000Z | 2022-03-31T23:33:13.000Z | tests/utils/test_string_utils.py | PeterSulcs/mlflow | 14c48e7bb1ca6cd6a3c1b249a486cd98bd5e7051 | [
"Apache-2.0"
] | 3,733 | 2018-07-31T01:38:51.000Z | 2022-03-31T23:56:25.000Z | tests/utils/test_string_utils.py | PeterSulcs/mlflow | 14c48e7bb1ca6cd6a3c1b249a486cd98bd5e7051 | [
"Apache-2.0"
] | 2,596 | 2018-07-31T06:38:39.000Z | 2022-03-31T23:56:32.000Z | import pytest
from mlflow.utils.string_utils import strip_prefix, strip_suffix, is_string_type
@pytest.mark.parametrize(
"original,prefix,expected",
[("smoketest", "smoke", "test"), ("", "test", ""), ("", "", ""), ("test", "", "test")],
)
def test_strip_prefix(original, prefix, expected):
assert strip_prefix(original, prefix) == expected
@pytest.mark.parametrize(
"original,suffix,expected",
[("smoketest", "test", "smoke"), ("", "test", ""), ("", "", ""), ("test", "", "test")],
)
def test_strip_suffix(original, suffix, expected):
assert strip_suffix(original, suffix) == expected
def test_is_string_type():
assert is_string_type("validstring")
assert is_string_type("")
assert is_string_type((b"dog").decode("utf-8"))
assert not is_string_type(None)
assert not is_string_type(["teststring"])
assert not is_string_type([])
assert not is_string_type({})
assert not is_string_type({"test": "string"})
assert not is_string_type(12)
assert not is_string_type(12.7)
| 31.393939 | 91 | 0.666023 | 130 | 1,036 | 5.046154 | 0.238462 | 0.146341 | 0.219512 | 0.181402 | 0.580793 | 0.330793 | 0.1875 | 0.096037 | 0.096037 | 0.096037 | 0 | 0.006826 | 0.151544 | 1,036 | 32 | 92 | 32.375 | 0.739477 | 0 | 0 | 0.08 | 0 | 0 | 0.141892 | 0.046332 | 0 | 0 | 0 | 0 | 0.48 | 1 | 0.12 | false | 0 | 0.08 | 0 | 0.2 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
4723dcee9820113cc4255a18cebb8871583017fd | 124 | py | Python | tests/data/samplecfg.py | glebshevchukk/gradslam | ce38c98537e1521b5e0a780f1c53f26924df7dab | [
"MIT"
] | 1,048 | 2020-11-06T03:49:27.000Z | 2022-03-28T17:57:05.000Z | tests/data/samplecfg.py | glebshevchukk/gradslam | ce38c98537e1521b5e0a780f1c53f26924df7dab | [
"MIT"
] | 32 | 2020-11-08T09:19:21.000Z | 2022-03-14T20:36:25.000Z | tests/data/samplecfg.py | glebshevchukk/gradslam | ce38c98537e1521b5e0a780f1c53f26924df7dab | [
"MIT"
] | 124 | 2020-11-08T07:29:57.000Z | 2022-03-16T11:40:56.000Z | import os
import sys
from gradslam.config import CfgNode as CN
cfg = CN()
cfg.TRAIN = CN()
cfg.TRAIN.HYPERPARAM_1 = 0.9
| 11.272727 | 41 | 0.717742 | 22 | 124 | 4 | 0.681818 | 0.170455 | 0.227273 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.029703 | 0.185484 | 124 | 10 | 42 | 12.4 | 0.841584 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 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 | 3 |
472b7eae05711c0a1df1ff938d239d30340dd29a | 60 | py | Python | tests/dummy_cell_env.py | pktl/distributed_game_of_life | 9ac63cec43977fff2653e7a1b9c7a4c12bbd7925 | [
"MIT"
] | null | null | null | tests/dummy_cell_env.py | pktl/distributed_game_of_life | 9ac63cec43977fff2653e7a1b9c7a4c12bbd7925 | [
"MIT"
] | null | null | null | tests/dummy_cell_env.py | pktl/distributed_game_of_life | 9ac63cec43977fff2653e7a1b9c7a4c12bbd7925 | [
"MIT"
] | null | null | null | from src.dgol_worker.cell_env import CellEnv
ce = CellEnv() | 20 | 44 | 0.8 | 10 | 60 | 4.6 | 0.9 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.116667 | 60 | 3 | 45 | 20 | 0.867925 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
5b3efa495764e79db80a8d873dca101b98d76f42 | 682 | py | Python | meep/__init__.py | mtander/meep | 5b8085014d43f9201b2283bc7d9085f1ace20406 | [
"MIT"
] | null | null | null | meep/__init__.py | mtander/meep | 5b8085014d43f9201b2283bc7d9085f1ace20406 | [
"MIT"
] | null | null | null | meep/__init__.py | mtander/meep | 5b8085014d43f9201b2283bc7d9085f1ace20406 | [
"MIT"
] | null | null | null | from flask import Flask
from config import DefaultConfig
# factory method for creating app objects
def create_app(config=DefaultConfig()):
app = Flask(__name__, instance_relative_config=True)
app.config.from_object(config)
# initialize database and migrations
from meep.models import db, migrate
from meep.models import Address, AreaOfEffect
from meep.models import Coordinate, FuelType
from meep.models import Owner, Line, Project
from meep.models import Radius, Site
db.init_app(app)
migrate.init_app(app, db)
# register blueprints
from meep.resources import project
app.register_blueprint(project.project)
return app
| 27.28 | 56 | 0.752199 | 89 | 682 | 5.640449 | 0.460674 | 0.095618 | 0.139442 | 0.199203 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.187683 | 682 | 24 | 57 | 28.416667 | 0.906137 | 0.13783 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.066667 | false | 0 | 0.533333 | 0 | 0.666667 | 0.066667 | 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 | 1 | 0 | 0 | 3 |
5b4477c7ff32f21e1eedcba6eff6f119beced119 | 1,120 | py | Python | src/api/migrations/0003_auto_20190604_1058.py | pradipta/back-end | 05895b051afc4c8e0cb17db708063d80102e9de5 | [
"MIT"
] | 17 | 2019-05-11T22:15:34.000Z | 2022-03-26T22:45:33.000Z | src/api/migrations/0003_auto_20190604_1058.py | pradipta/back-end | 05895b051afc4c8e0cb17db708063d80102e9de5 | [
"MIT"
] | 390 | 2019-05-23T10:48:57.000Z | 2021-12-17T21:01:43.000Z | src/api/migrations/0003_auto_20190604_1058.py | pradipta/back-end | 05895b051afc4c8e0cb17db708063d80102e9de5 | [
"MIT"
] | 40 | 2019-05-21T14:41:57.000Z | 2021-01-30T13:39:38.000Z | # Generated by Django 2.2.2 on 2019-06-04 15:58
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [("api", "0002_auto_20190522_1618")]
operations = [
migrations.DeleteModel(name="ActiveAdminComment"),
migrations.DeleteModel(name="AdminUser"),
migrations.DeleteModel(name="ArInternalMetadata"),
migrations.DeleteModel(name="Event"),
migrations.DeleteModel(name="GitHubStatistic"),
migrations.DeleteModel(name="GitHubUser"),
migrations.DeleteModel(name="OldCodeSchool"),
migrations.DeleteModel(name="OldLocation"),
migrations.DeleteModel(name="OldTeamMember"),
migrations.DeleteModel(name="Request"),
migrations.DeleteModel(name="Resource"),
migrations.DeleteModel(name="Role"),
migrations.DeleteModel(name="SchemaMigration"),
migrations.DeleteModel(name="Service"),
migrations.DeleteModel(name="SlackUser"),
migrations.DeleteModel(name="Tag"),
migrations.DeleteModel(name="Tagging"),
migrations.DeleteModel(name="Vote"),
]
| 37.333333 | 58 | 0.686607 | 100 | 1,120 | 7.66 | 0.43 | 0.493473 | 0.587467 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.033732 | 0.179464 | 1,120 | 29 | 59 | 38.62069 | 0.799782 | 0.040179 | 0 | 0 | 1 | 0 | 0.188257 | 0.021435 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.043478 | 0 | 0.173913 | 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 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
5b47c020381d563cd22c6d5f79397ba250b6cf19 | 266 | py | Python | solutions/pybasic_ex1_4_1.py | mfernandes61/python-basic | fc105db0e2e3af1830d833eef368fd011b4fcf5e | [
"Unlicense"
] | 40 | 2017-02-22T05:35:16.000Z | 2022-01-10T09:28:35.000Z | solutions/pybasic_ex1_4_1.py | mfernandes61/python-basic | fc105db0e2e3af1830d833eef368fd011b4fcf5e | [
"Unlicense"
] | 10 | 2016-12-12T17:06:50.000Z | 2019-06-14T13:34:22.000Z | solutions/pybasic_ex1_4_1.py | mfernandes61/python-basic | fc105db0e2e3af1830d833eef368fd011b4fcf5e | [
"Unlicense"
] | 47 | 2017-03-24T19:48:50.000Z | 2022-02-27T15:53:09.000Z | # Protein sequence given
seq = "MPISEPTFFEIF"
# Split the sequence into its component amino acids
seq_list = list(seq)
# Use a set to establish the unique amino acids
unique_amino_acids = set(seq_list)
# Print out the unique amino acids
print(unique_amino_acids)
| 22.166667 | 51 | 0.781955 | 42 | 266 | 4.809524 | 0.5 | 0.247525 | 0.316832 | 0.188119 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.161654 | 266 | 11 | 52 | 24.181818 | 0.90583 | 0.567669 | 0 | 0 | 0 | 0 | 0.109091 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.25 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
5b47c29aaab3cdf3c4e1671a310113a2c0e1ba3f | 486 | py | Python | campy/private/backends/backend_interactive_console.py | TristenSeth/campy | 9e726c342d682239e1c19e6f5645c0b2167d7fab | [
"MIT"
] | null | null | null | campy/private/backends/backend_interactive_console.py | TristenSeth/campy | 9e726c342d682239e1c19e6f5645c0b2167d7fab | [
"MIT"
] | null | null | null | campy/private/backends/backend_interactive_console.py | TristenSeth/campy | 9e726c342d682239e1c19e6f5645c0b2167d7fab | [
"MIT"
] | null | null | null | from campy.private.backend_base import ConsoleBackendBase
class InteractiveConsoleBackend(ConsoleBackendBase):
def clear_console(self):
pass
def set_console_font(self, font):
pass
def set_console_size(self, console_size):
pass
def get_console_line(self):
return input()
def put_console(self, line, stderr=False):
print(line)
# def echo_console(self):
# pass
# def end_line_console(self):
# pass
| 20.25 | 57 | 0.658436 | 57 | 486 | 5.385965 | 0.473684 | 0.143322 | 0.14658 | 0.117264 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.261317 | 486 | 23 | 58 | 21.130435 | 0.855153 | 0.141975 | 0 | 0.25 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.416667 | false | 0.25 | 0.083333 | 0.083333 | 0.666667 | 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 | 1 | 0 | 0 | 1 | 0 | 0 | 3 |
5b56109d5d5abec15a2278c520d6306048bb083e | 270 | py | Python | templates/flask/flaskRest/app/configs/config.py | david-osas/create-basic-app | 860fc579672855093ad8426fb01d010de4c7cff8 | [
"MIT"
] | 2 | 2020-12-01T11:33:36.000Z | 2020-12-01T12:25:49.000Z | templates/flask/flaskRest/app/configs/config.py | david-osas/create-basic-app | 860fc579672855093ad8426fb01d010de4c7cff8 | [
"MIT"
] | 2 | 2020-11-25T14:38:57.000Z | 2020-11-25T22:55:25.000Z | templates/flask/flaskRest/app/configs/config.py | david-osas/create-basic-app | 860fc579672855093ad8426fb01d010de4c7cff8 | [
"MIT"
] | 2 | 2020-11-26T08:59:50.000Z | 2021-03-30T20:01:06.000Z | from .development_config import DevelopmentConfig
from .production_config import ProductionConfig
from .testing_config import TestingConfig
ENVIRONMENT_MAPPING = {
"production": ProductionConfig,
"development": DevelopmentConfig,
"testing": TestingConfig
}
| 27 | 49 | 0.807407 | 23 | 270 | 9.304348 | 0.478261 | 0.168224 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.12963 | 270 | 9 | 50 | 30 | 0.910638 | 0 | 0 | 0 | 0 | 0 | 0.103704 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.375 | 0 | 0.375 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 3 |
5b728343141af718346ac4978505ec35a2d52270 | 470 | py | Python | problems/greedy/Solution870.py | akalu/cs-problems-python | 9b1bd8e3932be62135a38a77f955ded9a766b654 | [
"MIT"
] | null | null | null | problems/greedy/Solution870.py | akalu/cs-problems-python | 9b1bd8e3932be62135a38a77f955ded9a766b654 | [
"MIT"
] | null | null | null | problems/greedy/Solution870.py | akalu/cs-problems-python | 9b1bd8e3932be62135a38a77f955ded9a766b654 | [
"MIT"
] | null | null | null | """ Given two arrays A and B of equal size, the advantage of A with respect to B
is the number of indices i for which A[i] > B[i].
Return any permutation of A that maximizes its advantage with respect to B.
Example 1:
Input: A = [2,7,11,15], B = [1,10,4,11] Output: [2,11,7,15]
IDEA:
Only relative order does matter, so one can apply greedy approach here
Sort both arrays, and find the
"""
class Solution870:
pass
| 23.5 | 82 | 0.63617 | 82 | 470 | 3.646341 | 0.670732 | 0.020067 | 0.086957 | 0.093645 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.065089 | 0.280851 | 470 | 19 | 83 | 24.736842 | 0.819527 | 0.823404 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
5b805582575f471d3237916e3dc521e5bb626336 | 1,033 | py | Python | TEP/lista3/C.py | GuilhermeBraz/unb-workflow | 37d680a675a87cea2ff936badf94d757393870c3 | [
"MIT"
] | null | null | null | TEP/lista3/C.py | GuilhermeBraz/unb-workflow | 37d680a675a87cea2ff936badf94d757393870c3 | [
"MIT"
] | null | null | null | TEP/lista3/C.py | GuilhermeBraz/unb-workflow | 37d680a675a87cea2ff936badf94d757393870c3 | [
"MIT"
] | null | null | null | # Argus was charged with guarding Io, which is not an ordinary cow. Io is quite an explorer, and she wanders off rather frequently, making Argus' life stressful. So the cowherd decided to construct an enclosed pasture for Io.
# There are nnn trees growing along the river, where Argus tends Io. For this problem, the river can be viewed as the OXOXOX axis of the Cartesian coordinate system, and the nnn trees as points with the yyy-coordinate equal 000. There is also another tree growing in the point (0,1)(0, 1)(0,1).
# Argus will tie a rope around three of the trees, creating a triangular pasture. Its exact shape doesn't matter to Io, but its area is crucial to her. There may be many ways for Argus to arrange the fence, but only the ones which result in different areas of the pasture are interesting for Io. Calculate the number of different areas that her pasture may have. Note that the pasture must have nonzero area.
t = int(input())
for i in range(t):
n = int(input())
xs = list(map(int, input().split()))
| 114.777778 | 408 | 0.75605 | 186 | 1,033 | 4.198925 | 0.586022 | 0.019206 | 0.007682 | 0.010243 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.010714 | 0.186834 | 1,033 | 9 | 409 | 114.777778 | 0.919048 | 0.893514 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 |
5b88fe4835697ffe0c79e926b04e81fcc84ab9fd | 111 | py | Python | OLD.dir/module2.py | romchegue/Python | 444476088e64d5da66cb00174f3d1d30ebbe38f6 | [
"bzip2-1.0.6"
] | null | null | null | OLD.dir/module2.py | romchegue/Python | 444476088e64d5da66cb00174f3d1d30ebbe38f6 | [
"bzip2-1.0.6"
] | null | null | null | OLD.dir/module2.py | romchegue/Python | 444476088e64d5da66cb00174f3d1d30ebbe38f6 | [
"bzip2-1.0.6"
] | null | null | null | print('starting to load...')
import sys
name = 42
def func(): pass
class klass: pass
print('done loading.')
| 11.1 | 28 | 0.675676 | 17 | 111 | 4.411765 | 0.882353 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.021739 | 0.171171 | 111 | 9 | 29 | 12.333333 | 0.793478 | 0 | 0 | 0 | 0 | 0 | 0.288288 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0.333333 | 0.166667 | 0 | 0.5 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.