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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4f7ac73509e6e84e42327cc7eb2cf60206c29356 | 478 | py | Python | blender/arm/logicnode/math/LN_separate_xyz.py | onelsonic/armory | 55cfead0844923d419d75bf4bd677ebed714b4b5 | [
"Zlib"
] | 2,583 | 2016-07-27T08:25:47.000Z | 2022-03-31T10:42:17.000Z | blender/arm/logicnode/math/LN_separate_xyz.py | N8n5h/armory | 5b4d24f067a2354bafd3ab417bb8e30ee0c5aff8 | [
"Zlib"
] | 2,122 | 2016-07-31T14:20:04.000Z | 2022-03-31T20:44:14.000Z | blender/arm/logicnode/math/LN_separate_xyz.py | N8n5h/armory | 5b4d24f067a2354bafd3ab417bb8e30ee0c5aff8 | [
"Zlib"
] | 451 | 2016-08-12T05:52:58.000Z | 2022-03-31T01:33:07.000Z | from arm.logicnode.arm_nodes import *
class SeparateVectorNode(ArmLogicTreeNode):
"""Splits the given vector into X, Y and Z."""
bl_idname = 'LNSeparateVectorNode'
bl_label = 'Separate XYZ'
arm_section = 'vector'
arm_version = 1
def arm_init(self, context):
self.add_input('ArmVectorSocket', 'Vector')
self.add_output('ArmFloatSocket', 'X')
self.add_output('ArmFloatSocket', 'Y')
self.add_output('ArmFloatSocket', 'Z')
| 29.875 | 51 | 0.669456 | 56 | 478 | 5.535714 | 0.625 | 0.090323 | 0.125806 | 0.26129 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.002632 | 0.205021 | 478 | 15 | 52 | 31.866667 | 0.813158 | 0.083682 | 0 | 0 | 0 | 0 | 0.240741 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.090909 | false | 0 | 0.090909 | 0 | 0.636364 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
4f8bacf5cc8d683ea814fa649f93bbfbdf8b2af2 | 67 | py | Python | SoftUni-Basic/first_steps_in_coding/lab/04_inches_to_centimeters.py | Darkartt/SoftUni | 23d65ddb9f1e454c9b1338a60dc52f5a64c30bc9 | [
"MIT"
] | null | null | null | SoftUni-Basic/first_steps_in_coding/lab/04_inches_to_centimeters.py | Darkartt/SoftUni | 23d65ddb9f1e454c9b1338a60dc52f5a64c30bc9 | [
"MIT"
] | null | null | null | SoftUni-Basic/first_steps_in_coding/lab/04_inches_to_centimeters.py | Darkartt/SoftUni | 23d65ddb9f1e454c9b1338a60dc52f5a64c30bc9 | [
"MIT"
] | null | null | null | inch = float(input())
centimetars = inch * 2.54
print(centimetars) | 16.75 | 25 | 0.716418 | 9 | 67 | 5.333333 | 0.777778 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.051724 | 0.134328 | 67 | 4 | 26 | 16.75 | 0.775862 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.333333 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
4f8e402da6a278939229244bc051662a74bdbb7f | 1,099 | py | Python | app/main/views.py | jfairf01/OrgoWebsite | 62f25faa1cc174f91377a281e1cea1dd898b0b30 | [
"MIT"
] | null | null | null | app/main/views.py | jfairf01/OrgoWebsite | 62f25faa1cc174f91377a281e1cea1dd898b0b30 | [
"MIT"
] | null | null | null | app/main/views.py | jfairf01/OrgoWebsite | 62f25faa1cc174f91377a281e1cea1dd898b0b30 | [
"MIT"
] | null | null | null | from flask import render_template, jsonify
from sqlalchemy import func
from . import main
from .. import db
from ..models import User, HighScore
@main.route('/highScore')
def highScore():
highScore = HighScore.query.order_by(HighScore.username).first()
if highScore is None:
return jsonify(username="None", score=0)
return jsonify(username=highScore.username, score=highScore.highScore)
@main.route('/newhighScore/<userName>/<newScore>')
def newhighScore(userName, newScore):
HighScore.query.delete()
newHighScore = HighScore(username=userName, highScore=newScore)
db.session.add(newHighScore)
db.session.commit()
return jsonify(username=newHighScore.username, score=newHighScore.highScore)
@main.route('/')
def index():
return render_template('main/index.html')
@main.route('/Categories')
def Categories():
return render_template('main/Categories.html')
@main.route('/FourthPage')
def fourthPage():
return render_template('main/FourthPage.html')
@main.route('/FifthPage')
def fifthPage():
return render_template('main/FifthPage.html')
| 28.921053 | 80 | 0.743403 | 128 | 1,099 | 6.335938 | 0.289063 | 0.066584 | 0.098644 | 0.118372 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.001037 | 0.122839 | 1,099 | 37 | 81 | 29.702703 | 0.840249 | 0 | 0 | 0 | 0 | 0 | 0.141947 | 0.031847 | 0 | 0 | 0 | 0 | 0 | 1 | 0.2 | false | 0 | 0.166667 | 0.133333 | 0.6 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 2 |
4f98c653568190ba3d9757f9946ea9b828f77543 | 186 | py | Python | code/src/scripts/pause.py | nuvla/job-engine | 58d42bd24d8dd2c6e28541c08df1455c9ac909f6 | [
"Apache-2.0"
] | 3 | 2019-04-27T10:36:21.000Z | 2019-04-29T12:41:57.000Z | code/src/scripts/pause.py | nuvla/job-engine | 58d42bd24d8dd2c6e28541c08df1455c9ac909f6 | [
"Apache-2.0"
] | 131 | 2019-02-13T06:00:49.000Z | 2022-03-29T15:06:03.000Z | code/src/scripts/pause.py | nuvla/job-engine | 58d42bd24d8dd2c6e28541c08df1455c9ac909f6 | [
"Apache-2.0"
] | 1 | 2020-12-03T11:35:21.000Z | 2020-12-03T11:35:21.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import docker
import socket
docker_client = docker.from_env()
myself = docker_client.containers.get(socket.gethostname())
myself.pause() | 16.909091 | 59 | 0.731183 | 25 | 186 | 5.32 | 0.68 | 0.180451 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.006061 | 0.112903 | 186 | 11 | 60 | 16.909091 | 0.8 | 0.225806 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 0.4 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
4f9a379d3ba99f8e8d48d7249f66b2636ad03135 | 880 | py | Python | backend/app/security.py | Kwsswart/writter | 851b887d0c8b0a9489f530065f0efe744bb149f3 | [
"MIT"
] | null | null | null | backend/app/security.py | Kwsswart/writter | 851b887d0c8b0a9489f530065f0efe744bb149f3 | [
"MIT"
] | null | null | null | backend/app/security.py | Kwsswart/writter | 851b887d0c8b0a9489f530065f0efe744bb149f3 | [
"MIT"
] | null | null | null | import os
from bcrypt import hashpw, gensalt, checkpw
from base64 import b64encode
from hashlib import sha256
from cryptography.fernet import Fernet
e = Fernet(os.getenv("KEY"))
def encpwd(pwd):
"""
Hash pwd provided
"""
return hashpw(b64encode(sha256(pwd.encode()).digest()), gensalt()).decode()
def checkpwd(x, y):
"""
Check whether password hashed matches:
* arg x** password to check
* arg y** original hashed password
"""
return checkpw(b64encode(sha256(x.encode()).digest()), y.encode())
def gen_fernet_key():
"""
Generate encryption key with Fernet
"""
return Fernet.generate_key().decode()
def enc(txt: str) -> str:
"""
Encrypt str
"""
return e.encrypt(txt.encode()).decode()
def dec(txt: str) -> str:
"""
Decrypt str
"""
return e.decrypt(txt.encode()).decode() | 20 | 79 | 0.626136 | 109 | 880 | 5.027523 | 0.422018 | 0.04927 | 0.032847 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.025037 | 0.228409 | 880 | 44 | 80 | 20 | 0.782032 | 0.2125 | 0 | 0 | 0 | 0 | 0.004926 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.3125 | false | 0 | 0.3125 | 0 | 0.9375 | 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 | 0 | 0 | 0 | 2 |
4f9d958bf40e31e749c287f77979cfb2be9e5cee | 396 | py | Python | tests/cell_fabric/test_rect.py | mabrains/ALIGN-public | 9a6c14310de13df369a8340f465911b629f15a3f | [
"BSD-3-Clause"
] | 119 | 2019-05-14T18:44:34.000Z | 2022-03-17T01:01:02.000Z | tests/cell_fabric/test_rect.py | mabrains/ALIGN-public | 9a6c14310de13df369a8340f465911b629f15a3f | [
"BSD-3-Clause"
] | 717 | 2019-04-03T15:36:35.000Z | 2022-03-31T21:56:47.000Z | tests/cell_fabric/test_rect.py | mabrains/ALIGN-public | 9a6c14310de13df369a8340f465911b629f15a3f | [
"BSD-3-Clause"
] | 34 | 2019-04-01T21:21:27.000Z | 2022-03-21T09:46:57.000Z | from align.cell_fabric.transformation import Rect
def test_toList():
r = Rect( 0, 0, 1, 1)
assert r.toList() == [0, 0, 1, 1]
def test_canonical():
r = Rect( 1, 1, 0, 0)
assert r.canonical().toList() == [0, 0, 1, 1]
def test_repr():
r = Rect( 0, 0, 1, 1)
assert r.__repr__() == "[0, 0, 1, 1]"
assert repr(r) == "[0, 0, 1, 1]"
assert str(r) == "[0, 0, 1, 1]"
| 24.75 | 49 | 0.517677 | 70 | 396 | 2.814286 | 0.242857 | 0.081218 | 0.106599 | 0.142132 | 0.467005 | 0.335025 | 0.335025 | 0.162437 | 0 | 0 | 0 | 0.109966 | 0.265152 | 396 | 15 | 50 | 26.4 | 0.56701 | 0 | 0 | 0.166667 | 0 | 0 | 0.090909 | 0 | 0 | 0 | 0 | 0 | 0.416667 | 1 | 0.25 | false | 0 | 0.083333 | 0 | 0.333333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
4fa4042c8d50c736872f18bc6de82a9eeac26254 | 591 | py | Python | apps/base/migrations/0056_auto_20190821_1628.py | gvizquel/pyerp | c859f7293cabd1003f79112463cee93ac89fccba | [
"MIT"
] | null | null | null | apps/base/migrations/0056_auto_20190821_1628.py | gvizquel/pyerp | c859f7293cabd1003f79112463cee93ac89fccba | [
"MIT"
] | 11 | 2020-06-05T22:50:37.000Z | 2022-02-10T09:05:56.000Z | apps/base/migrations/0056_auto_20190821_1628.py | gvizquel/pyerp | c859f7293cabd1003f79112463cee93ac89fccba | [
"MIT"
] | null | null | null | # Generated by Django 2.2.4 on 2019-08-21 20:28
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('base', '0055_pycron'),
]
operations = [
migrations.AlterField(
model_name='pycron',
name='model_name',
field=models.CharField(max_length=40, verbose_name='Modelo'),
),
migrations.AlterField(
model_name='pycron',
name='number_call',
field=models.IntegerField(default=-1, verbose_name='Número de llamadas'),
),
]
| 24.625 | 85 | 0.588832 | 62 | 591 | 5.483871 | 0.66129 | 0.079412 | 0.147059 | 0.170588 | 0.229412 | 0.229412 | 0 | 0 | 0 | 0 | 0 | 0.052506 | 0.291032 | 591 | 23 | 86 | 25.695652 | 0.75895 | 0.076142 | 0 | 0.352941 | 1 | 0 | 0.132353 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.058824 | 0 | 0.235294 | 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 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
96d4fa95c81cfe8edb8a039e4f400fd39027e05f | 1,974 | py | Python | products/api/api.py | Arvind-4/E-commerce-REST-API | ee6bf15f08590db99c423639db382f8c3fb3ab05 | [
"MIT"
] | null | null | null | products/api/api.py | Arvind-4/E-commerce-REST-API | ee6bf15f08590db99c423639db382f8c3fb3ab05 | [
"MIT"
] | null | null | null | products/api/api.py | Arvind-4/E-commerce-REST-API | ee6bf15f08590db99c423639db382f8c3fb3ab05 | [
"MIT"
] | null | null | null | from django.shortcuts import render
from rest_framework.generics import (
ListAPIView,
RetrieveAPIView,
)
from rest_framework.views import APIView
from rest_framework.response import Response
from django.core import serializers
from django.http import Http404
from rest_framework.permissions import AllowAny
from rest_framework.decorators import permission_classes
from products.models import Product
from .serializers import ProductSerializer
# Create your views here.
# class ProductCreate(CreateAPIView):
# queryset = Product.objects.all()
# serializer_class = ProductSerializer
@permission_classes((AllowAny, ))
class ProductListView(ListAPIView):
queryset = Product.objects.all()
serializer_class = ProductSerializer
# class ProductUpdate(RetrieveUpdateAPIView):
# queryset = Product.objects.all()
# serializer_class = ProductSerializer
# lookup_field = 'slug'
# class ProductDelete(DestroyAPIView):
# queryset = Product.objects.all()
# serializer_class = ProductSerializer
# lookup_field = 'slug'
# @permission_classes((AllowAny, ))
# class ProductDetail(APIView):
# def get_object(self, slug):
# try:
# return Product.objects.filter(slug=slug).first()
# except:
# raise Http404
# def get(self, request, slug, format=None, *args, **kwargs):
# instance = self.get_object(slug)
# if instance:
# obj = ProductSerializer(instance)
# return Response(obj.data)
# else:
# return Http404
@permission_classes((AllowAny, ))
class ProductDetail(RetrieveAPIView):
serializer_class = ProductSerializer
lookup_field = ['slug', 'id']
def get_object(self):
slug = self.kwargs.get('slug')
id_ = self.kwargs.get('id')
product_qs = Product.objects.filter(slug=slug, id=id_)
if not product_qs.exists():
raise Http404
return product_qs.first()
| 29.029412 | 65 | 0.692503 | 204 | 1,974 | 6.578431 | 0.338235 | 0.062593 | 0.063338 | 0.074516 | 0.362891 | 0.227273 | 0.19225 | 0.107303 | 0.107303 | 0.107303 | 0 | 0.007727 | 0.213273 | 1,974 | 67 | 66 | 29.462687 | 0.856407 | 0.450355 | 0 | 0.142857 | 0 | 0 | 0.011342 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.035714 | false | 0 | 0.357143 | 0 | 0.642857 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
96e2e02958eb8b2f96b29096a9887913b5f2e8c3 | 733 | py | Python | monitoring/deployment_manager/systems/configuration.py | interuss/InterUSS-Platform | 099abaa1159c4c143f8f1fde6b88956c86608281 | [
"Apache-2.0"
] | null | null | null | monitoring/deployment_manager/systems/configuration.py | interuss/InterUSS-Platform | 099abaa1159c4c143f8f1fde6b88956c86608281 | [
"Apache-2.0"
] | 1 | 2021-11-29T21:53:39.000Z | 2021-11-29T21:53:39.000Z | monitoring/deployment_manager/systems/configuration.py | interuss/InterUSS-Platform | 099abaa1159c4c143f8f1fde6b88956c86608281 | [
"Apache-2.0"
] | null | null | null | from typing import Optional
from monitoring.monitorlib.typing import ImplicitDict
from monitoring.deployment_manager.systems.dss.configuration import DSS
from monitoring.deployment_manager.systems.test.configuration import Test
class KubernetesCluster(ImplicitDict):
name: str
"""Name of the Kubernetes cluster containing this deployment.
Contained in the NAME column of the response to
`kubectl config get-contexts`.
"""
class DeploymentSpec(ImplicitDict):
cluster: Optional[KubernetesCluster]
"""Definition of Kubernetes cluster containing this deployment."""
test: Optional[Test]
"""Test systems in this deployment."""
dss: Optional[DSS]
"""DSS instance in this deployment."""
| 27.148148 | 73 | 0.758527 | 83 | 733 | 6.674699 | 0.421687 | 0.101083 | 0.086643 | 0.111913 | 0.285199 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.162347 | 733 | 26 | 74 | 28.192308 | 0.90228 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.4 | 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 | 0 | 0 | 0 | 2 |
96e2f6791d358888a299b482a3e7912cf3a6c4c5 | 627 | py | Python | src/Broker_Instance/streamer.py | zxq0404/Raven | 398e208330619d76c0236a43493f217c1dd198be | [
"RSA-MD"
] | null | null | null | src/Broker_Instance/streamer.py | zxq0404/Raven | 398e208330619d76c0236a43493f217c1dd198be | [
"RSA-MD"
] | null | null | null | src/Broker_Instance/streamer.py | zxq0404/Raven | 398e208330619d76c0236a43493f217c1dd198be | [
"RSA-MD"
] | null | null | null | import zmq
def main():
try:
context = zmq.Context(1)
# Socket facing clients
frontend = context.socket(zmq.PULL)
frontend.bind("tcp://*:5556")
# Socket facing services
backend = context.socket(zmq.PUSH)
backend.bind("tcp://*:5557")
zmq.device(zmq.STREAMER, frontend, backend)
except Exception as e:
print(e)
print("bringing down zmq device")
finally:
pass
frontend.close()
backend.close()
1,1 Top
if __name__ == "__main__":
main()
| 24.115385 | 79 | 0.503987 | 63 | 627 | 4.888889 | 0.539683 | 0.077922 | 0.103896 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.028646 | 0.38756 | 627 | 25 | 80 | 25.08 | 0.773438 | 0.070175 | 0 | 0 | 0 | 0 | 0.096552 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0.052632 | 0.052632 | null | null | 0.105263 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
96e5665a895a1fb9a756f3fb69c43aacf59d81ff | 886 | py | Python | partialflow/utils.py | jakob-bauer/partialflow | bea1b46ca66fb5c10aefbcd1570aff922a903118 | [
"MIT"
] | 3 | 2017-02-03T15:59:10.000Z | 2020-05-23T07:26:10.000Z | partialflow/utils.py | jakob-bauer/partialflow | bea1b46ca66fb5c10aefbcd1570aff922a903118 | [
"MIT"
] | null | null | null | partialflow/utils.py | jakob-bauer/partialflow | bea1b46ca66fb5c10aefbcd1570aff922a903118 | [
"MIT"
] | 1 | 2018-08-02T02:16:34.000Z | 2018-08-02T02:16:34.000Z | import time
class Timer(object):
def __init__(self):
self._start = 0
self._end = 0
def __enter__(self):
self._start = time.time()
return self
def __exit__(self, exc_type, exc_val, exc_tb):
self._end = time.time()
@property
def duration(self):
if self._end == 0:
return time.time() - self._start
else:
return self._end - self._start
class VerboseTimer(Timer):
def __init__(self, name):
super(VerboseTimer, self).__init__()
self._name = name
def __enter__(self):
print('START: %s...' % self._name)
return super(VerboseTimer, self).__enter__()
def __exit__(self, exc_type, exc_val, exc_tb):
super(VerboseTimer, self).__exit__(exc_type, exc_val, exc_tb)
print('DONE: %s took %.3f seconds.' % (self._name, self.duration)) | 24.611111 | 74 | 0.595937 | 111 | 886 | 4.252252 | 0.279279 | 0.076271 | 0.063559 | 0.082627 | 0.161017 | 0.161017 | 0.122881 | 0.122881 | 0.122881 | 0 | 0 | 0.00627 | 0.27991 | 886 | 36 | 74 | 24.611111 | 0.733542 | 0 | 0 | 0.153846 | 0 | 0 | 0.043968 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.269231 | false | 0 | 0.038462 | 0 | 0.538462 | 0.076923 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
96e773f3eb8d9309f3f610d7802ef89439807320 | 3,679 | py | Python | rush00/rush00/settings.py | ppichier/moviemon_game | 556948b4763879c6c88d60037e4faf5f3555e432 | [
"MIT"
] | null | null | null | rush00/rush00/settings.py | ppichier/moviemon_game | 556948b4763879c6c88d60037e4faf5f3555e432 | [
"MIT"
] | null | null | null | rush00/rush00/settings.py | ppichier/moviemon_game | 556948b4763879c6c88d60037e4faf5f3555e432 | [
"MIT"
] | null | null | null | """
Django settings for rush00 project.
Generated by 'django-admin startproject' using Django 3.0.2.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.0/ref/settings/
"""
import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = "tqki)wptx*uv78p@l=b-(pd#-0e=c#*(1+^z((&9u8kxfx_f^d"
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
"django.contrib.admin",
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sessions",
"django.contrib.messages",
"django.contrib.staticfiles",
"titlescreen",
"worldmap",
"option",
"moviedex",
"battle"
]
MIDDLEWARE = [
"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 = "rush00.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 = "rush00.wsgi.application"
# Database
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases
DATABASES = {
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": os.path.join(BASE_DIR, "db.sqlite3"),
}
}
# Password validation
# https://docs.djangoproject.com/en/3.0/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.0/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.0/howto/static-files/
STATIC_URL = "/static/"
# STATICFILES_DIRS = [os.path.join(BASE_DIR, "static")]
STATIC_ROOT = os.path.join(BASE_DIR, "static")
API_KEY = "3cc63f26"
MOVIES_TITLE_LIST= [
"Parasite",
"Frozen Flesh",
"Disaster Movie",
"From Justin to Kelly",
"Catwoman",
"Hellboy",
"Pulp Fiction",
"Spice World",
"Suicide Squad",
"Aladdin"
]
GAME_INSTANCE = None
FILE_SAVE = "pickle_datas.bin"
PLAYER_START_POSITION = {'x': 0, 'y': 9}
PLAYER_START_STRENGTH = 0
MOVIEBALL_PLAYER_NBR = 3
MOVIEBALL_TOTAL = 50
GRID_SIZE = 10
## MAP RESPONSIVE GRID SIZE
| 24.203947 | 91 | 0.693395 | 426 | 3,679 | 5.873239 | 0.464789 | 0.077938 | 0.061551 | 0.069944 | 0.213829 | 0.18745 | 0.106715 | 0.106715 | 0.047962 | 0 | 0 | 0.016324 | 0.167437 | 3,679 | 151 | 92 | 24.364238 | 0.800522 | 0.289481 | 0 | 0 | 1 | 0.011765 | 0.524932 | 0.395052 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.058824 | 0.011765 | 0 | 0.011765 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
8c22ac32d9e86be7204e958a46ee2baa1ce5b423 | 602 | py | Python | MakeRelativePaths.py | Ccantey/ArcGIS-Scripting | 464ed20e4365c5518ff6e226fb9b209de422f0dc | [
"Unlicense"
] | 11 | 2015-06-08T08:35:46.000Z | 2021-07-29T22:45:23.000Z | MakeRelativePaths.py | Ccantey/ArcGIS-Scripting | 464ed20e4365c5518ff6e226fb9b209de422f0dc | [
"Unlicense"
] | null | null | null | MakeRelativePaths.py | Ccantey/ArcGIS-Scripting | 464ed20e4365c5518ff6e226fb9b209de422f0dc | [
"Unlicense"
] | 5 | 2016-11-22T19:24:59.000Z | 2018-05-02T13:03:43.000Z | import arcpy, os
#walk through all subdirectories and change mxd to store relative paths
for root, dirs, files in os.walk(r"Q:\Geodata\shape"):
for f in files:
if f.endswith(".mxd"):
filepath = root + '\\' + f
print filepath
try:
mxd = arcpy.mapping.MapDocument(filepath)
#set relative paths property
mxd.relativePaths = True
mxd.save()
except:
print filepath + ' failed'
pass
| 28.666667 | 71 | 0.463455 | 58 | 602 | 4.810345 | 0.672414 | 0.043011 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.463455 | 602 | 20 | 72 | 30.1 | 0.863777 | 0.16113 | 0 | 0 | 0 | 0 | 0.057769 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0.076923 | 0.076923 | null | null | 0.153846 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
8c27dc6bc871f7889ddc494ac9e16b08fd6a4764 | 248 | py | Python | settings.py | arakilian0/calcupy | c0091c840cae982c9bf8816f1f8ec630dbb305ae | [
"MIT"
] | 1 | 2021-07-22T03:07:16.000Z | 2021-07-22T03:07:16.000Z | settings.py | arakilian0/calcupy | c0091c840cae982c9bf8816f1f8ec630dbb305ae | [
"MIT"
] | null | null | null | settings.py | arakilian0/calcupy | c0091c840cae982c9bf8816f1f8ec630dbb305ae | [
"MIT"
] | 1 | 2020-01-24T11:51:47.000Z | 2020-01-24T11:51:47.000Z | screen = {
"bg": "blue",
"rows": 0,
"columns": 0,
"columnspan": 4,
"padx": 5,
"pady": 5,
}
input = {
"bg": "blue",
"fg": "red",
"fs": "20px",
}
button = {
"bg": "blue",
"fg": "red",
"fs": "20px",
}
| 11.809524 | 20 | 0.366935 | 27 | 248 | 3.37037 | 0.62963 | 0.197802 | 0.175824 | 0.241758 | 0.373626 | 0.373626 | 0 | 0 | 0 | 0 | 0 | 0.055556 | 0.346774 | 248 | 20 | 21 | 12.4 | 0.506173 | 0 | 0 | 0.388889 | 0 | 0 | 0.278226 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
8c2d9c7411c316a5fdbc00d27ddd1f859de4e57c | 4,645 | py | Python | Libraries/Python/CommonEnvironment/v1.0/CommonEnvironment/TypeInfo/FundamentalTypes/All.py | davidbrownell/v3-Common_Environment | 8f42f256e573cbd83cbf9813db9958025ddf12f2 | [
"BSL-1.0"
] | null | null | null | Libraries/Python/CommonEnvironment/v1.0/CommonEnvironment/TypeInfo/FundamentalTypes/All.py | davidbrownell/v3-Common_Environment | 8f42f256e573cbd83cbf9813db9958025ddf12f2 | [
"BSL-1.0"
] | 1 | 2018-06-08T06:45:16.000Z | 2018-06-08T06:45:16.000Z | Libraries/Python/CommonEnvironment/v1.0/CommonEnvironment/TypeInfo/FundamentalTypes/All.py | davidbrownell/v3-Common_Environment | 8f42f256e573cbd83cbf9813db9958025ddf12f2 | [
"BSL-1.0"
] | 1 | 2018-06-08T04:15:17.000Z | 2018-06-08T04:15:17.000Z | # ----------------------------------------------------------------------
# |
# | All.py
# |
# | David Brownell <db@DavidBrownell.com>
# | 2018-04-23 10:05:42
# |
# ----------------------------------------------------------------------
# |
# | Copyright David Brownell 2018-22.
# | Distributed under the Boost Software License, Version 1.0.
# | (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
# |
# ----------------------------------------------------------------------
"""All items from this module."""
import os
import sys
import CommonEnvironment
from CommonEnvironment.TypeInfo.FundamentalTypes.BoolTypeInfo import BoolTypeInfo
from CommonEnvironment.TypeInfo.FundamentalTypes.DateTimeTypeInfo import DateTimeTypeInfo
from CommonEnvironment.TypeInfo.FundamentalTypes.DateTypeInfo import DateTypeInfo
from CommonEnvironment.TypeInfo.FundamentalTypes.DirectoryTypeInfo import DirectoryTypeInfo
from CommonEnvironment.TypeInfo.FundamentalTypes.DurationTypeInfo import DurationTypeInfo
from CommonEnvironment.TypeInfo.FundamentalTypes.EnumTypeInfo import EnumTypeInfo
from CommonEnvironment.TypeInfo.FundamentalTypes.FilenameTypeInfo import FilenameTypeInfo
from CommonEnvironment.TypeInfo.FundamentalTypes.FloatTypeInfo import FloatTypeInfo
from CommonEnvironment.TypeInfo.FundamentalTypes.GuidTypeInfo import GuidTypeInfo
from CommonEnvironment.TypeInfo.FundamentalTypes.IntTypeInfo import IntTypeInfo
from CommonEnvironment.TypeInfo.FundamentalTypes.StringTypeInfo import StringTypeInfo
from CommonEnvironment.TypeInfo.FundamentalTypes.TimeTypeInfo import TimeTypeInfo
from CommonEnvironment.TypeInfo.FundamentalTypes.UriTypeInfo import Uri, UriTypeInfo
# ----------------------------------------------------------------------
_script_fullpath = CommonEnvironment.ThisFullpath()
_script_dir, _script_name = os.path.split(_script_fullpath)
# ----------------------------------------------------------------------
# ----------------------------------------------------------------------
# |
# | Public Types
# |
# ----------------------------------------------------------------------
ALL_FUNDAMENTAL_TYPES = [ BoolTypeInfo,
DateTimeTypeInfo,
DateTypeInfo,
DirectoryTypeInfo,
DurationTypeInfo,
EnumTypeInfo,
FilenameTypeInfo,
FloatTypeInfo,
GuidTypeInfo,
IntTypeInfo,
StringTypeInfo,
TimeTypeInfo,
UriTypeInfo,
]
# ----------------------------------------------------------------------
# |
# | Public Methods
# |
# ----------------------------------------------------------------------
def CreateFromPythonType(typ, **kwargs):
"""
Creates a TypeInfo object based on the provided type.
Examples:
CreateFromPythonType(int)
CreateFromPythonType(string)
"""
if sys.version_info[0] == 2:
if typ in [ str, unicode, basestring, ]: # <Undefined variable> pylint: disable = E0602
return StringTypeInfo(**kwargs)
else:
if typ == str:
return StringTypeInfo(**kwargs)
for potential_type_info in [ BoolTypeInfo,
DateTimeTypeInfo,
DateTypeInfo,
# Ambiguous: DirectoryTypeInfo
DurationTypeInfo,
# Abmiguous: EnumTypeInfo
# Ambiguous: FilenameTypeInfo
FloatTypeInfo,
GuidTypeInfo,
IntTypeInfo,
# Defined above: StringTypeInfo
TimeTypeInfo,
UriTypeInfo,
]:
if potential_type_info.ExpectedType == typ:
return potential_type_info(**kwargs)
raise Exception("'{}' is not a recognized type".format(typ))
| 46.919192 | 103 | 0.475996 | 269 | 4,645 | 8.141264 | 0.408922 | 0.124658 | 0.172146 | 0.267123 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.010434 | 0.33972 | 4,645 | 98 | 104 | 47.397959 | 0.703619 | 0.277503 | 0 | 0.346154 | 0 | 0 | 0.009077 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.019231 | false | 0 | 0.307692 | 0 | 0.384615 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
8c33eb4b835fe5ebadebb84d215778d0aae457a4 | 3,479 | py | Python | src/mds/api/signals.py | rryan/sana.mds | d62cd7e6a3d47ce933f6ee04aa7f10c8d642c944 | [
"BSD-3-Clause"
] | null | null | null | src/mds/api/signals.py | rryan/sana.mds | d62cd7e6a3d47ce933f6ee04aa7f10c8d642c944 | [
"BSD-3-Clause"
] | null | null | null | src/mds/api/signals.py | rryan/sana.mds | d62cd7e6a3d47ce933f6ee04aa7f10c8d642c944 | [
"BSD-3-Clause"
] | null | null | null | '''
Created on Aug 11, 2012
:author: Sana Development Team
:version: 2.0
'''
from django.dispatch import Signal
class ExternalDispatch(Signal):
""" Simple dispatching signal. The superclass providing_args are a
'dispatcher' key and 'data' dictionary.
"""
def __init__(self):
Signal.__init__(self, providing_args=["dispatcher","data"])
class ExternalDispatcher(object):
""" A handler for sending messages to external targets.
"""
def __init__(self, registry=None):
""" Creates a new instance and sets the registry if provided.
"""
self.registry = registry
def __call__(self,sender, **kwargs):
""" Callback signal processor for dispatching upstream messages.
sender:
An ExternalDispatch signal
"""
data = sender.get("data")
self.sender = sender.get("dispatcher")
# if we provide a registry assume that the "dispatcher" sent with the
# sender is a registry key
if self.registry:
callback = self.registry.get(self.sender)
# Otherwise we assume the "dispatcher" is a callback
else:
callback = self.sender
return callback.dispatch(**data)
class ExternalWSDispatch(Signal):
""" Simple dispatching signal. The superclass providing_args are:
wsname:
the remote web service name
pargs:
path args for formatting the path String
data:
POST data dictionary.
query:
GET query dict
"""
def __init__(self):
Signal.__init__(self, providing_args=["wsname","pargs","data", "query"])
class ExternalWSDispatcher(object):
""" A handler for sending messages to external targets.
"""
def __init__(self, wscallback):
""" Creates a new instance and sets the registry if provided.
"""
self.wscallback = wscallback
def __call__(self,sender, **kwargs):
""" Callback signal processor for dispatching upstream messages.
sender:
An ExternalWSDispatch signal
kwargs:
The data from the ExternalWSDipatch. See ExternalWSDispatch for
details.
"""
data = sender.get("data")
wsname = sender.get("wsname")
pargs = sender.get("pargs")
query = sender.get("query")
return self.callback.wsdispatch(wsname,query=query,pargs=pargs, data=data)
class EventSignal(Signal):
"""A generic message to pass to an EventSignalHandler holds content for
marking the event
"""
def __init__(self):
Signal.__init__(self, providing_args=['event'])
class EventSignalHandler(object):
""" Class based callback implementation for marking events. Creates and
saves a new instance of the model passed to the __init__ method.
"""
def __init__(self, model):
self.model = model
def __call__(self, sender, **kwargs):
try:
data = sender.get('event')
obj = self.model(**data)
obj.save()
return True
except:
return False
class CacheSignal(Signal):
def __init__(self):
Signal.__init__(self, providing_args=['uri','request', 'content'])
class FileCacheSignal(Signal):
def __init__(self):
Signal.__init__(self, providing_args=['uri','request', 'content'])
| 32.514019 | 90 | 0.61052 | 372 | 3,479 | 5.508065 | 0.311828 | 0.050756 | 0.042948 | 0.041484 | 0.373353 | 0.362128 | 0.362128 | 0.362128 | 0.306491 | 0.249878 | 0 | 0.003255 | 0.293475 | 3,479 | 106 | 91 | 32.820755 | 0.83035 | 0.375108 | 0 | 0.255319 | 0 | 0 | 0.059197 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.234043 | false | 0 | 0.021277 | 0 | 0.510638 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
8c3d3f0d60b1efa71f513e96282456978c895ca2 | 9,423 | py | Python | Artesian/_Query/VersionedQuery.py | ARKlab/Artesian.SDK-Python | 79b54ad00526f5a75c400422fd1c0c8532b67436 | [
"MIT"
] | 2 | 2022-02-21T17:03:04.000Z | 2022-02-24T17:14:02.000Z | Artesian/_Query/VersionedQuery.py | ARKlab/Artesian.SDK-Python | 79b54ad00526f5a75c400422fd1c0c8532b67436 | [
"MIT"
] | 2 | 2020-02-06T10:03:35.000Z | 2022-03-01T09:39:54.000Z | Artesian/_Query/VersionedQuery.py | ARKlab/Artesian.SDK-Python | 79b54ad00526f5a75c400422fd1c0c8532b67436 | [
"MIT"
] | 1 | 2019-08-01T06:20:58.000Z | 2019-08-01T06:20:58.000Z | from Artesian._Query.Query import _Query
from Artesian._Query.QueryParameters.VersionedQueryParameters import VersionedQueryParameters
from Artesian._Query.Config.ExtractionRangeConfig import ExtractionRangeConfig
from Artesian._Query.Config.VersionSelectionType import VersionSelectionType
from Artesian._Configuration.DefaultPartitionStrategy import DefaultPartitionStrategy
from Artesian._Query.Config.Granularity import Granularity
import urllib
class _VersionedQuery(_Query):
__routePrefix = "vts"
def __init__(self, client, requestExecutor, partitionStrategy):
queryParameters = VersionedQueryParameters(None,ExtractionRangeConfig(), None, None, None, None, None, None, None)
_Query.__init__(self, client, requestExecutor, queryParameters)
self.__partition= partitionStrategy
def forMarketData(self, ids):
super()._forMarketData(ids)
return self
def forFilterId(self, filterId):
super()._forFilterId(filterId)
return self
def inTimeZone(self, tz):
super()._inTimezone(tz)
return self
def inAbsoluteDateRange(self, start, end):
super()._inAbsoluteDateRange(start, end)
return self
def inRelativePeriodRange(self, pStart, pEnd=None):
super()._inRelativePeriodRange(pStart, pEnd)
return self
def inRelativePeriod(self, extractionPeriod):
super()._inRelativePeriod(extractionPeriod)
return self
def inRelativeInterval(self, relativeInterval):
super()._inRelativeInterval(relativeInterval)
return self
def withTimeTransform(self, tr):
self._queryParameters.transformId = tr
return self
def inGranularity(self, granularity):
self._queryParameters.granularity = granularity
return self
def forMUV(self):
self._queryParameters.versionSelectionType = VersionSelectionType.MUV
return self
def forLastOfDays(self, start, end=None):
self._queryParameters.versionSelectionType = VersionSelectionType.LAST_OF_DAYS
if(start.startswith("P")):
if(end is None):
self._queryParameters.versionSelectionConfig.versionsRange.period = start
else:
self._queryParameters.versionSelectionConfig.versionsRange.periodFrom = start
self._queryParameters.versionSelectionConfig.versionsRange.periodTo = end
else:
self._queryParameters.versionSelectionConfig.versionsRange.dateStart = start
self._queryParameters.versionSelectionConfig.versionsRange.dateEnd = end
return self
def forLastOfMonths(self, start, end=None):
self._queryParameters.versionSelectionType = VersionSelectionType.LAST_OF_MONTHS
if(start.startswith("P")):
if(end is None):
self._queryParameters.versionSelectionConfig.versionsRange.period = start
else:
self._queryParameters.versionSelectionConfig.versionsRange.periodFrom = start
self._queryParameters.versionSelectionConfig.versionsRange.periodTo = end
else:
self._queryParameters.versionSelectionConfig.versionsRange.dateStart = start
self._queryParameters.versionSelectionConfig.versionsRange.dateEnd = end
return self
def forLastNVersions(self, lastN):
self._queryParameters.versionSelectionType = VersionSelectionType.LASTN
self._queryParameters.versionSelectionConfig.lastN = lastN
return self
def forVersion(self, version):
self._queryParameters.versionSelectionType = VersionSelectionType.VERSION
self._queryParameters.versionSelectionConfig.version = version
return self
def forMostRecent(self, start, end=None):
self._queryParameters.versionSelectionType = VersionSelectionType.MOST_RECENT
if(start.startswith("P")):
if(end is None):
self._queryParameters.versionSelectionConfig.versionsRange.period = start
else:
self._queryParameters.versionSelectionConfig.versionsRange.periodFrom = start
self._queryParameters.versionSelectionConfig.versionsRange.periodTo = end
else:
self._queryParameters.versionSelectionConfig.versionsRange.dateStart = start
self._queryParameters.versionSelectionConfig.versionsRange.dateEnd = end
return self
def withFillNull(self):
self._queryParameters.fill = NullFillStategy()
return self
def withFillNone(self):
self._queryParameters.fill = NoFillStategy()
return self
def withFillLatestValue(self, period):
self._queryParameters.fill = FillLatestStategy(period)
return self
def withFillCustomValue(self, val):
self._queryParameters.fill = FillCustomStategy(val)
return self
def execute(self):
urls = self.__buildRequest()
return super()._exec(urls)
def executeAsync(self):
urls = self.__buildRequest()
return super()._execAsync(urls)
def __buildRequest(self):
self.__validateQuery()
qps = self.__partition.Partitionversioned([self._queryParameters])
urls = []
for qp in qps:
url = f"/{self.__routePrefix}/{self.__buildVersionRoute()}/{self.__getGranularityPath(qp.granularity)}/{super()._buildExtractionRangeRoute(qp)}?_=1"
if not (qp.ids is None):
sep = ","
ids= sep.join(map(str,qp.ids))
enc = urllib.parse.quote_plus(ids)
url = url + "&id=" + enc
if not (qp.filterId is None):
url = url + "&filterId=" + qp.filterId
if not (qp.timezone is None):
url = url + "&tz=" + qp.timezone
if not (qp.transformId is None):
url = url + "&tr=" + qp.transformId
if not (qp.fill is None):
url = url + "&" + qp.fill.getUrlParams()
urls.append(url)
return urls
def __validateQuery(self):
super()._validateQuery()
if (self._queryParameters.granularity is None):
raise Exception("Extraction granularity must be provided. Use .InGranularity() argument takes a granularity type")
if (self._queryParameters.versionSelectionType is None):
raise Exception("Version selection must be provided. Provide a version to query. eg .ForLastOfDays() arguments take a date range , period or period range")
def __buildVersionRoute(self):
switcher = {
VersionSelectionType.LASTN: f"Last{self._queryParameters.versionSelectionConfig.lastN}",
VersionSelectionType.MUV: f"MUV",
VersionSelectionType.LAST_OF_DAYS: f"LastOfDays/" + self.__buildVersionRange(),
VersionSelectionType.LAST_OF_MONTHS: f"LastOfMonths/" + self.__buildVersionRange(),
VersionSelectionType.MOST_RECENT: f"MostRecent/" + self.__buildVersionRange(),
VersionSelectionType.VERSION: f"Version/{self._queryParameters.versionSelectionConfig.version}"
}
vr = switcher.get(self._queryParameters.versionSelectionType, "VType")
if vr == "VType" :
raise Exception("Not supported VersionType")
return vr
def __buildVersionRange(self):
vr=""
if (self._queryParameters.versionSelectionConfig.versionsRange.dateStart is not None) and (self._queryParameters.versionSelectionConfig.versionsRange.dateEnd is not None):
vr = f"{self._queryParameters.versionSelectionConfig.versionsRange.dateStart}/{self._queryParameters.versionSelectionConfig.versionsRange.dateEnd}"
elif (self._queryParameters.versionSelectionConfig.versionsRange.period is not None):
vr = f"{self._queryParameters.versionSelectionConfig.versionsRange.period}"
elif (self._queryParameters.versionSelectionConfig.versionsRange.periodFrom is not None) and (self._queryParameters.versionSelectionConfig.versionsRange.periodTo is not None):
vr = f"{self._queryParameters.versionSelectionConfig.versionsRange.dateStart}/{self._queryParameters.versionSelectionConfig.versionsRange.dateEnd}"
return vr
def __getGranularityPath(self,granularity):
switcher = {
Granularity.DAY: "Day",
Granularity.FIFTEEN_MINUTE: "FifteenMinute",
Granularity.HOUR: "Hour" ,
Granularity.MINUTE: "Minute",
Granularity.MONTH: "Month",
Granularity.QUARTER: "Quarter",
Granularity.TEN_MINUTE: "TenMinute",
Granularity.THIRTY_MINUTE: "ThirtyMinute",
Granularity.WEEK: "Week",
Granularity.YEAR: "Year",
}
vr = switcher.get(granularity, "VGran")
if vr == "VGran" :
raise Exception("Not supported Granularity")
return vr
class NullFillStategy:
def getUrlParams(self):
return "fillerK=Null"
class NoFillStategy:
def getUrlParams(self):
return "fillerK=NoFill"
class FillLatestStategy:
def __init__(self, period):
self.period = period
def getUrlParams(self):
return f"fillerK=LatestValidValue&fillerP={self.period}"
class FillCustomStategy:
def __init__(self, val):
self.val = val
def getUrlParams(self):
return f"fillerK=CustomValue&fillerDV={self.val}" | 48.823834 | 184 | 0.685875 | 837 | 9,423 | 7.565114 | 0.200717 | 0.135028 | 0.187776 | 0.213203 | 0.379659 | 0.318067 | 0.292167 | 0.292167 | 0.259476 | 0.249052 | 0 | 0.000137 | 0.228059 | 9,423 | 193 | 185 | 48.823834 | 0.87036 | 0 | 0 | 0.315508 | 0 | 0.02139 | 0.121923 | 0.072899 | 0 | 0 | 0 | 0 | 0 | 1 | 0.176471 | false | 0 | 0.037433 | 0.02139 | 0.40107 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
8c41abbedc0d7fa2c291694a56f40b82034bd4ff | 113 | py | Python | download-deveres/para-execicios-curso-em-video/exe046.py | Hugo-Oliveira-RDO11/meus-deveres | b5e41015e2cb95946262678e82197e5f47d56271 | [
"MIT"
] | null | null | null | download-deveres/para-execicios-curso-em-video/exe046.py | Hugo-Oliveira-RDO11/meus-deveres | b5e41015e2cb95946262678e82197e5f47d56271 | [
"MIT"
] | null | null | null | download-deveres/para-execicios-curso-em-video/exe046.py | Hugo-Oliveira-RDO11/meus-deveres | b5e41015e2cb95946262678e82197e5f47d56271 | [
"MIT"
] | null | null | null | from time import sleep
for c in range(10, -1, -1):
print(c)
sleep(1)
print('BOMMMMMMMMM\nE ANO NOVO!!!')
| 18.833333 | 35 | 0.628319 | 20 | 113 | 3.55 | 0.75 | 0.169014 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.055556 | 0.20354 | 113 | 5 | 36 | 22.6 | 0.733333 | 0 | 0 | 0 | 0 | 0 | 0.230089 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.2 | 0 | 0.2 | 0.4 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
8c4a0be60d8dc4aa18a2eafcee63ae8c7af73a85 | 268 | py | Python | LeetcodeAlgorithms/598. Range Addition II/range-addition-ii.py | Fenghuapiao/PyLeetcode | d804a62643fe935eb61808196a2c093ea9583654 | [
"MIT"
] | 3 | 2019-08-20T06:54:38.000Z | 2022-01-07T12:56:46.000Z | LeetcodeAlgorithms/598. Range Addition II/range-addition-ii.py | Fenghuapiao/PyLeetcode | d804a62643fe935eb61808196a2c093ea9583654 | [
"MIT"
] | null | null | null | LeetcodeAlgorithms/598. Range Addition II/range-addition-ii.py | Fenghuapiao/PyLeetcode | d804a62643fe935eb61808196a2c093ea9583654 | [
"MIT"
] | 2 | 2018-06-07T02:56:39.000Z | 2018-08-01T15:27:55.000Z | class Solution(object):
def maxCount(self, m, n, ops):
"""
:type m: int
:type n: int
:type ops: List[List[int]]
:rtype: int
"""
return reduce(operator.mul, map(min, zip(*ops + [[m,n]])))
| 26.8 | 67 | 0.440299 | 32 | 268 | 3.6875 | 0.625 | 0.033898 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.399254 | 268 | 10 | 68 | 26.8 | 0.732919 | 0.238806 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
8c4fb46daef9f00f54d178b3d13b1196f12048c9 | 473 | py | Python | pyroomacoustics/experimental/__init__.py | oleg-alexandrov/pyroomacoustics | 4681b3cec21e09c54be50b2ee835115bcbc1d298 | [
"MIT"
] | 1 | 2020-02-14T22:32:55.000Z | 2020-02-14T22:32:55.000Z | pyroomacoustics/experimental/__init__.py | Bar-BY/pyroomacoustics | 45b45febdf93340a55a719942f2daa9efbef9960 | [
"MIT"
] | null | null | null | pyroomacoustics/experimental/__init__.py | Bar-BY/pyroomacoustics | 45b45febdf93340a55a719942f2daa9efbef9960 | [
"MIT"
] | 1 | 2021-01-14T08:42:47.000Z | 2021-01-14T08:42:47.000Z | """
Experimental
============
A bunch of routines useful when doing measurements and experiments.
"""
__all__ = [
"measure_ir",
"physics",
"point_cloud",
"delay_calibration",
"deconvolution",
"localization",
"signals",
"rt60",
]
from .deconvolution import *
from .delay_calibration import *
from .localization import *
from .measure_ir import *
from .physics import *
from .point_cloud import *
from .rt60 import *
from .signals import *
| 17.518519 | 67 | 0.672304 | 50 | 473 | 6.16 | 0.5 | 0.227273 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.010526 | 0.196617 | 473 | 26 | 68 | 18.192308 | 0.8 | 0.198732 | 0 | 0 | 0 | 0 | 0.218329 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.444444 | 0 | 0.444444 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
8c54d1bb115f902bf84d6ec2fd66b3e1daa99799 | 3,248 | py | Python | neighborapp/models.py | Maureen-1998DEV/watch_Hood | 44b644dc8a5c4dfbea7a1e90ac7fe79c5dbf9abb | [
"MIT"
] | null | null | null | neighborapp/models.py | Maureen-1998DEV/watch_Hood | 44b644dc8a5c4dfbea7a1e90ac7fe79c5dbf9abb | [
"MIT"
] | null | null | null | neighborapp/models.py | Maureen-1998DEV/watch_Hood | 44b644dc8a5c4dfbea7a1e90ac7fe79c5dbf9abb | [
"MIT"
] | null | null | null |
from django.db import models
from django.contrib.auth.models import User
from cloudinary.models import CloudinaryField
# Create your models here.
class Neighborhood(models.Model):
name = models.CharField(max_length = 50)
location = models.ForeignKey('Location',on_delete = models.CASCADE,null = True)
admin = models.ForeignKey(User,on_delete = models.CASCADE)
occupants = models.IntegerField(null=True)
def __str__(self):
return self.name
def create_neighborhood(self):
self.save()
def delete_neighborhood(self):
self.delete()
@classmethod
def find_neighborhood(cls,neigborhood_id):
neighborhood = cls.objects.get(id = neigborhood_id)
return neighborhood
def update_neighborhood(self):
self.save()
def update_occupants(self):
self.occupants += 1
self.save()
class UserProfile(models.Model):
user = models.ForeignKey(User,on_delete = models.CASCADE,related_name = 'profile')
first_name = models.CharField(max_length = 50,null=True)
last_name = models.CharField(max_length = 50,null=True)
bio = models.TextField(null=True)
neighborhood = models.ForeignKey(Neighborhood,on_delete = models.CASCADE,null=True)
email = models.EmailField(max_length = 60,null=True)
profile_pic = CloudinaryField('profile/')
pub_date = models.DateTimeField(auto_now_add=True)
def __str__(self):
return self.user.username
class Business(models.Model):
name = models.CharField(max_length = 60)
user = models.ForeignKey(User,on_delete = models.CASCADE,related_name = 'business_user')
description = models.CharField(max_length = 150,null=True)
neighborhood = models.ForeignKey(Neighborhood,on_delete = models.CASCADE,related_name = 'business_neighbourhood')
category = models.ForeignKey('Category',on_delete = models.CASCADE,null=True)
email = models.EmailField(max_length = 60)
def __str__(self):
return self.name
def create_business(self):
self.save()
def delete_business(self):
self.delete()
@classmethod
def find_business(cls,business_id):
business = Business.objects.get(id = business_id)
return business
def update_business(self):
self.save()
class Post(models.Model):
title = models.CharField(max_length = 50)
content = models.TextField()
user = models.ForeignKey(User,on_delete = models.CASCADE)
neighborhood = models.ForeignKey(Neighborhood,on_delete = models.CASCADE)
type = models.CharField(max_length = 50,null=True)
pub_date = models.DateTimeField(auto_now_add=True,null=True)
def __str__(self):
return self.title
class Comment(models.Model):
comment = models.CharField(max_length = 300)
posted_on = models.DateTimeField(auto_now=True)
user = models.ForeignKey(User, on_delete=models.CASCADE)
def save_comment(self):
self.save()
def delete_comment(self):
self.delete()
class Location(models.Model):
name = models.CharField(max_length = 40)
def __str__(self):
return self.name
class Category(models.Model):
name = models.CharField(max_length = 40)
def __str__(self):
return self.name | 30.933333 | 117 | 0.703818 | 398 | 3,248 | 5.550251 | 0.190955 | 0.048891 | 0.081485 | 0.108646 | 0.594387 | 0.536442 | 0.484382 | 0.3866 | 0.217746 | 0.217746 | 0 | 0.01029 | 0.192118 | 3,248 | 105 | 118 | 30.933333 | 0.831555 | 0.007389 | 0 | 0.320513 | 0 | 0 | 0.020484 | 0.006828 | 0 | 0 | 0 | 0 | 0 | 1 | 0.217949 | false | 0 | 0.038462 | 0.076923 | 0.820513 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
8c59187ba750abcf04c6147479de2bce3f2491de | 751 | py | Python | oidc_provider/migrations/0029_auto_20190606_1218.py | omunozn/django-oidc-provider | 6f4822b56637aaa7ece92324123c26a36061d73a | [
"MIT"
] | 2 | 2018-10-05T01:17:57.000Z | 2020-10-07T21:07:20.000Z | oidc_provider/migrations/0029_auto_20190606_1218.py | omunozn/django-oidc-provider | 6f4822b56637aaa7ece92324123c26a36061d73a | [
"MIT"
] | null | null | null | oidc_provider/migrations/0029_auto_20190606_1218.py | omunozn/django-oidc-provider | 6f4822b56637aaa7ece92324123c26a36061d73a | [
"MIT"
] | 4 | 2018-10-30T14:47:12.000Z | 2020-05-06T19:11:55.000Z | # Generated by Django 2.2.2 on 2019-06-06 12:18
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('oidc_provider', '0028_auto_20190502_1654'),
]
operations = [
migrations.AddField(
model_name='code',
name='ae',
field=models.SmallIntegerField(null=True, verbose_name='AE'),
),
migrations.AddField(
model_name='token',
name='ae',
field=models.SmallIntegerField(null=True, verbose_name='AE'),
),
migrations.AddField(
model_name='userconsent',
name='ae',
field=models.SmallIntegerField(null=True, verbose_name='AE'),
),
]
| 25.896552 | 73 | 0.573901 | 75 | 751 | 5.613333 | 0.48 | 0.085511 | 0.163895 | 0.192399 | 0.52019 | 0.52019 | 0.52019 | 0.52019 | 0.52019 | 0.52019 | 0 | 0.059273 | 0.303595 | 751 | 28 | 74 | 26.821429 | 0.745698 | 0.05992 | 0 | 0.545455 | 1 | 0 | 0.096591 | 0.03267 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.045455 | 0 | 0.181818 | 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 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
4fb19360602138faa0d22fba8d442fb8c1895535 | 1,792 | py | Python | accounts/models.py | barissaslan/eventhub | 37aa005b3f2eab9a2c6c48d30b2f7f4483fa6749 | [
"MIT"
] | 4 | 2017-11-13T19:51:25.000Z | 2020-12-08T17:19:31.000Z | accounts/models.py | barissaslan/eventhub | 37aa005b3f2eab9a2c6c48d30b2f7f4483fa6749 | [
"MIT"
] | null | null | null | accounts/models.py | barissaslan/eventhub | 37aa005b3f2eab9a2c6c48d30b2f7f4483fa6749 | [
"MIT"
] | 3 | 2018-05-19T08:37:42.000Z | 2020-12-08T17:19:34.000Z | from django.db import models
from django.contrib.auth.models import BaseUserManager, AbstractBaseUser
from event.models import Event
class UserManager(BaseUserManager):
def create_user(self, email, password=None):
if not email:
raise ValueError('Users must have an email address')
user = self.model(
email=self.normalize_email(email),
)
user.set_password(password)
user.save(using=self._db)
return user
def create_superuser(self, email, password):
user = self.create_user(
email,
password=password,
)
user.is_admin = True
user.save(using=self._db)
return user
class User(AbstractBaseUser):
email = models.EmailField(
verbose_name='email address',
max_length=255,
unique=True,
)
first_name = models.CharField(max_length=255, blank=True, null=True)
last_name = models.CharField(max_length=255, blank=True, null=True)
cell_phone = models.CharField(max_length=30, blank=True, null=True)
date_of_birth = models.DateField(blank=True, null=True)
is_active = models.BooleanField(default=True)
is_admin = models.BooleanField(default=False)
objects = UserManager()
USERNAME_FIELD = 'email'
def get_full_name(self):
if self.first_name and self.last_name:
return "{} {}".format(self.first_name, self.last_name)
else:
return self.email
def get_short_name(self):
return self.first_name
def __str__(self):
return self.email
def has_perm(self, perm, obj=None):
return True
def has_module_perms(self, app_label):
return True
@property
def is_staff(self):
return self.is_admin
| 25.971014 | 72 | 0.648996 | 223 | 1,792 | 5.035874 | 0.358744 | 0.032057 | 0.046305 | 0.060552 | 0.137133 | 0.137133 | 0.137133 | 0.085485 | 0.085485 | 0.085485 | 0 | 0.008289 | 0.259487 | 1,792 | 68 | 73 | 26.352941 | 0.83798 | 0 | 0 | 0.156863 | 0 | 0 | 0.030709 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.156863 | false | 0.078431 | 0.058824 | 0.098039 | 0.607843 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 2 |
4fbab7405719ae7d782fceeb047eb0c83c99705f | 3,604 | py | Python | oms_cms/backend/api/v2/socialaccount/views.py | RomanYarovoi/oms_cms | 49c6789242d7a35e81f4f208c04b18fb79249be7 | [
"BSD-3-Clause"
] | 18 | 2019-07-11T18:34:10.000Z | 2021-11-20T06:34:39.000Z | oms_cms/backend/api/v2/socialaccount/views.py | RomanYarovoi/oms_cms | 49c6789242d7a35e81f4f208c04b18fb79249be7 | [
"BSD-3-Clause"
] | 13 | 2019-07-24T11:27:58.000Z | 2022-03-28T01:07:31.000Z | oms_cms/backend/api/v2/socialaccount/views.py | RomanYarovoi/oms_cms | 49c6789242d7a35e81f4f208c04b18fb79249be7 | [
"BSD-3-Clause"
] | 18 | 2019-07-08T18:07:21.000Z | 2021-11-03T10:33:07.000Z | from rest_framework import generics, permissions
from rest_framework import filters as filters_rf
from django_filters import rest_framework as filters
from allauth.socialaccount.models import SocialAccount, SocialApp, SocialToken
from .serializers import SocialAppSerializer, SocialAppExtendedSerializer, SocialAccountSerializer, \
SocialAccountExtendedSerializer, SocialTokenSerializer, SocialTokenExtendedSerializer
class SocialAppListApi(generics.ListAPIView):
"""Список всех SocialApp"""
permission_classes = [permissions.DjangoModelPermissions]
queryset = SocialApp.objects.all()
serializer_class = SocialAppExtendedSerializer
filter_backends = [filters.DjangoFilterBackend,
filters_rf.SearchFilter,
filters_rf.OrderingFilter]
filter_fields = ('id', 'provider', 'sites')
search_fields = ['name', 'client_id', 'id']
ordering = ['id']
class SocialAppRetrieveDeleteUpdateApi(generics.RetrieveUpdateDestroyAPIView):
"""Просмотр, изменение и удаления приложения соц. сети"""
permission_classes = [permissions.DjangoModelPermissions]
queryset = SocialApp.objects.all()
lookup_field = 'id'
serializer_class = SocialAppSerializer
class SocialAppCreateApi(generics.CreateAPIView):
"""Добавление приложения соц. сети"""
permission_classes = [permissions.DjangoModelPermissions]
queryset = SocialApp.objects.none()
serializer_class = SocialAppSerializer
class SocialAccountListApi(generics.ListAPIView):
"""Список всех аккаунтов соц. сетей"""
permission_classes = [permissions.DjangoModelPermissions]
queryset = SocialAccount.objects.all()
serializer_class = SocialAccountExtendedSerializer
filter_backends = [filters.DjangoFilterBackend,
filters_rf.SearchFilter,
filters_rf.OrderingFilter]
filter_fields = ('id', 'user', 'provider')
search_fields = ['user__username']
ordering = ['id']
class SocialAccountRetrieveDeleteUpdateApi(generics.RetrieveUpdateDestroyAPIView):
"""Просмотр, изменение и удаления аккаунта в соц. сети"""
permission_classes = [permissions.DjangoModelPermissions]
queryset = SocialAccount.objects.all()
serializer_class = SocialAccountSerializer
lookup_field = 'id'
class SocialAccountCreateApi(generics.CreateAPIView):
"""Добавление аккаунта соц. сети"""
permission_classes = [permissions.DjangoModelPermissions]
queryset = SocialAccount.objects.none()
serializer_class = SocialAccountSerializer
class SocialTokenListApi(generics.ListAPIView):
"""Список токенов"""
permission_classes = [permissions.DjangoModelPermissions]
queryset = SocialToken.objects.all()
serializer_class = SocialTokenExtendedSerializer
filter_backends = [filters.DjangoFilterBackend,
filters_rf.SearchFilter,
filters_rf.OrderingFilter]
filter_fields = ('id', 'app', 'account')
search_fields = ['account__user__username', 'token', 'id']
ordering = ['id']
class SocialTokenRetrieveDeleteUpdateApi(generics.RetrieveUpdateDestroyAPIView):
"""Просмотр, изменение и удаления токенов"""
permission_classes = [permissions.DjangoModelPermissions]
queryset = SocialToken.objects.all()
serializer_class = SocialTokenSerializer
lookup_field = 'id'
class SocialTokenCreateApi(generics.CreateAPIView):
"""Добавление токена"""
permission_classes = [permissions.DjangoModelPermissions]
queryset = SocialToken.objects.none()
serializer_class = SocialTokenSerializer
| 39.173913 | 101 | 0.748613 | 291 | 3,604 | 9.106529 | 0.271478 | 0.057736 | 0.095094 | 0.169811 | 0.492075 | 0.492075 | 0.421887 | 0.393208 | 0.363019 | 0.328302 | 0 | 0 | 0.165927 | 3,604 | 91 | 102 | 39.604396 | 0.88157 | 0.081021 | 0 | 0.571429 | 0 | 0 | 0.034293 | 0.007042 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.079365 | 0 | 0.888889 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
4fbff0bc9c697c0951f61a60296a6035d822cd65 | 941 | py | Python | backend.py | Fennec2000GH/KeywordFS | 0e1d7ab78d084e0c21cf4e7246ed169353cfca9b | [
"MIT"
] | null | null | null | backend.py | Fennec2000GH/KeywordFS | 0e1d7ab78d084e0c21cf4e7246ed169353cfca9b | [
"MIT"
] | null | null | null | backend.py | Fennec2000GH/KeywordFS | 0e1d7ab78d084e0c21cf4e7246ed169353cfca9b | [
"MIT"
] | null | null | null |
from genericpath import exists, isfile
import json, os
from pprint import pprint
from keyword_extraction import *
from topic_modeling import *
# from xml_parser import *
def file_to_json(path: str, storage_path: str = 'storage'):
"""
Converts file containing text to stored JSON object to track topics and keywords.
Parameters:
path (str): Path to file to be converted to JSON object.
storage_path (str): Path to directory to store JSON object.
Returns:
None
"""
# edge case
if not (os.path.exists(path=path) and os.path.isfile(path=path)):
raise ValueError(f'{path} is not a valid path to a file.')
os.makedirs(path=storage_path, exist_ok=True)
with open(file=path, mode='r') as file:
json_dict = dict({
'keywords': set(),
'topics': set(find_topics(documents=))
})
json.dump(obj=file)
| 30.354839 | 86 | 0.629118 | 128 | 941 | 4.539063 | 0.476563 | 0.048193 | 0.048193 | 0.04475 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.275239 | 941 | 30 | 87 | 31.366667 | 0.851906 | 0.036132 | 0 | 0 | 0 | 0 | 0.098498 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.333333 | null | null | 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 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
4fc9baceeb6c53d83cab3241e6032040a6ea6f24 | 33,921 | py | Python | tests/examples/minlplib/syn05m04h.py | ouyang-w-19/decogo | 52546480e49776251d4d27856e18a46f40c824a1 | [
"MIT"
] | 2 | 2021-07-03T13:19:10.000Z | 2022-02-06T10:48:13.000Z | tests/examples/minlplib/syn05m04h.py | ouyang-w-19/decogo | 52546480e49776251d4d27856e18a46f40c824a1 | [
"MIT"
] | 1 | 2021-07-04T14:52:14.000Z | 2021-07-15T10:17:11.000Z | tests/examples/minlplib/syn05m04h.py | ouyang-w-19/decogo | 52546480e49776251d4d27856e18a46f40c824a1 | [
"MIT"
] | null | null | null | # MINLP written by GAMS Convert at 04/21/18 13:54:28
#
# Equation counts
# Total E G L N X C B
# 363 141 12 210 0 0 0 0
#
# Variable counts
# x b i s1s s2s sc si
# Total cont binary integer sos1 sos2 scont sint
# 209 169 40 0 0 0 0 0
# FX 0 0 0 0 0 0 0 0
#
# Nonzero counts
# Total const NL DLL
# 843 807 36 0
#
# Reformulation has removed 1 variable and 1 equation
from pyomo.environ import *
model = m = ConcreteModel()
m.x2 = Var(within=Reals,bounds=(None,None),initialize=0)
m.x3 = Var(within=Reals,bounds=(None,None),initialize=0)
m.x4 = Var(within=Reals,bounds=(None,None),initialize=0)
m.x5 = Var(within=Reals,bounds=(None,None),initialize=0)
m.x6 = Var(within=Reals,bounds=(None,None),initialize=0)
m.x7 = Var(within=Reals,bounds=(None,None),initialize=0)
m.x8 = Var(within=Reals,bounds=(None,None),initialize=0)
m.x9 = Var(within=Reals,bounds=(None,None),initialize=0)
m.x10 = Var(within=Reals,bounds=(None,None),initialize=0)
m.x11 = Var(within=Reals,bounds=(None,None),initialize=0)
m.x12 = Var(within=Reals,bounds=(None,None),initialize=0)
m.x13 = Var(within=Reals,bounds=(None,None),initialize=0)
m.x14 = Var(within=Reals,bounds=(None,None),initialize=0)
m.x15 = Var(within=Reals,bounds=(None,None),initialize=0)
m.x16 = Var(within=Reals,bounds=(None,None),initialize=0)
m.x17 = Var(within=Reals,bounds=(None,None),initialize=0)
m.x18 = Var(within=Reals,bounds=(None,None),initialize=0)
m.x19 = Var(within=Reals,bounds=(None,None),initialize=0)
m.x20 = Var(within=Reals,bounds=(None,None),initialize=0)
m.x21 = Var(within=Reals,bounds=(None,None),initialize=0)
m.x22 = Var(within=Reals,bounds=(0,40),initialize=0)
m.x23 = Var(within=Reals,bounds=(0,40),initialize=0)
m.x24 = Var(within=Reals,bounds=(0,40),initialize=0)
m.x25 = Var(within=Reals,bounds=(0,40),initialize=0)
m.x26 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x27 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x28 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x29 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x30 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x31 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x32 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x33 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x34 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x35 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x36 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x37 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x38 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x39 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x40 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x41 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x42 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x43 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x44 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x45 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x46 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x47 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x48 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x49 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x50 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x51 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x52 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x53 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x54 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x55 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x56 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x57 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x58 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x59 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x60 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x61 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x62 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x63 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x64 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x65 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x66 = Var(within=Reals,bounds=(0,30),initialize=0)
m.x67 = Var(within=Reals,bounds=(0,30),initialize=0)
m.x68 = Var(within=Reals,bounds=(0,30),initialize=0)
m.x69 = Var(within=Reals,bounds=(0,30),initialize=0)
m.x70 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x71 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x72 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x73 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x74 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x75 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x76 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x77 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x78 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x79 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x80 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x81 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x82 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x83 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x84 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x85 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x86 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x87 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x88 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x89 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x90 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x91 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x92 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x93 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x94 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x95 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x96 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x97 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x98 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x99 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x100 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x101 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x102 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x103 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x104 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x105 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x106 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x107 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x108 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x109 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x110 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x111 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x112 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x113 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x114 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x115 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x116 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x117 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x118 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x119 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x120 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x121 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x122 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x123 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x124 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x125 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x126 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x127 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x128 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x129 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x130 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x131 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x132 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x133 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x134 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x135 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x136 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x137 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x138 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x139 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x140 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x141 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x142 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x143 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x144 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x145 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x146 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x147 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x148 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x149 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x150 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x151 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x152 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x153 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x154 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x155 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x156 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x157 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x158 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x159 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x160 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x161 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x162 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x163 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x164 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x165 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x166 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x167 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x168 = Var(within=Reals,bounds=(0,None),initialize=0)
m.x169 = Var(within=Reals,bounds=(0,None),initialize=0)
m.b170 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b171 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b172 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b173 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b174 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b175 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b176 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b177 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b178 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b179 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b180 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b181 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b182 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b183 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b184 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b185 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b186 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b187 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b188 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b189 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b190 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b191 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b192 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b193 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b194 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b195 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b196 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b197 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b198 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b199 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b200 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b201 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b202 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b203 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b204 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b205 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b206 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b207 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b208 = Var(within=Binary,bounds=(0,1),initialize=0)
m.b209 = Var(within=Binary,bounds=(0,1),initialize=0)
m.obj = Objective(expr= - m.x22 - m.x23 - m.x24 - m.x25 + 5*m.x46 + 10*m.x47 + 5*m.x48 + 10*m.x49 - 2*m.x66 - m.x67
- 2*m.x68 - m.x69 + 80*m.x70 + 90*m.x71 + 120*m.x72 + 100*m.x73 + 285*m.x74 + 390*m.x75
+ 350*m.x76 + 300*m.x77 + 290*m.x78 + 405*m.x79 + 190*m.x80 + 340*m.x81 - 5*m.b190 - 4*m.b191
- 6*m.b192 - 3*m.b193 - 8*m.b194 - 7*m.b195 - 6*m.b196 - 5*m.b197 - 6*m.b198 - 9*m.b199
- 4*m.b200 - 3*m.b201 - 10*m.b202 - 9*m.b203 - 5*m.b204 - 6*m.b205 - 6*m.b206 - 10*m.b207
- 6*m.b208 - 9*m.b209, sense=maximize)
m.c2 = Constraint(expr= m.x22 - m.x26 - m.x30 == 0)
m.c3 = Constraint(expr= m.x23 - m.x27 - m.x31 == 0)
m.c4 = Constraint(expr= m.x24 - m.x28 - m.x32 == 0)
m.c5 = Constraint(expr= m.x25 - m.x29 - m.x33 == 0)
m.c6 = Constraint(expr= - m.x34 - m.x38 + m.x42 == 0)
m.c7 = Constraint(expr= - m.x35 - m.x39 + m.x43 == 0)
m.c8 = Constraint(expr= - m.x36 - m.x40 + m.x44 == 0)
m.c9 = Constraint(expr= - m.x37 - m.x41 + m.x45 == 0)
m.c10 = Constraint(expr= m.x42 - m.x46 - m.x50 == 0)
m.c11 = Constraint(expr= m.x43 - m.x47 - m.x51 == 0)
m.c12 = Constraint(expr= m.x44 - m.x48 - m.x52 == 0)
m.c13 = Constraint(expr= m.x45 - m.x49 - m.x53 == 0)
m.c14 = Constraint(expr= m.x50 - m.x54 - m.x58 - m.x62 == 0)
m.c15 = Constraint(expr= m.x51 - m.x55 - m.x59 - m.x63 == 0)
m.c16 = Constraint(expr= m.x52 - m.x56 - m.x60 - m.x64 == 0)
m.c17 = Constraint(expr= m.x53 - m.x57 - m.x61 - m.x65 == 0)
m.c18 = Constraint(expr=(m.x98/(1e-6 + m.b170) - log(1 + m.x82/(1e-6 + m.b170)))*(1e-6 + m.b170) <= 0)
m.c19 = Constraint(expr=(m.x99/(1e-6 + m.b171) - log(1 + m.x83/(1e-6 + m.b171)))*(1e-6 + m.b171) <= 0)
m.c20 = Constraint(expr=(m.x100/(1e-6 + m.b172) - log(1 + m.x84/(1e-6 + m.b172)))*(1e-6 + m.b172) <= 0)
m.c21 = Constraint(expr=(m.x101/(1e-6 + m.b173) - log(1 + m.x85/(1e-6 + m.b173)))*(1e-6 + m.b173) <= 0)
m.c22 = Constraint(expr= m.x86 == 0)
m.c23 = Constraint(expr= m.x87 == 0)
m.c24 = Constraint(expr= m.x88 == 0)
m.c25 = Constraint(expr= m.x89 == 0)
m.c26 = Constraint(expr= m.x102 == 0)
m.c27 = Constraint(expr= m.x103 == 0)
m.c28 = Constraint(expr= m.x104 == 0)
m.c29 = Constraint(expr= m.x105 == 0)
m.c30 = Constraint(expr= m.x26 - m.x82 - m.x86 == 0)
m.c31 = Constraint(expr= m.x27 - m.x83 - m.x87 == 0)
m.c32 = Constraint(expr= m.x28 - m.x84 - m.x88 == 0)
m.c33 = Constraint(expr= m.x29 - m.x85 - m.x89 == 0)
m.c34 = Constraint(expr= m.x34 - m.x98 - m.x102 == 0)
m.c35 = Constraint(expr= m.x35 - m.x99 - m.x103 == 0)
m.c36 = Constraint(expr= m.x36 - m.x100 - m.x104 == 0)
m.c37 = Constraint(expr= m.x37 - m.x101 - m.x105 == 0)
m.c38 = Constraint(expr= m.x82 - 40*m.b170 <= 0)
m.c39 = Constraint(expr= m.x83 - 40*m.b171 <= 0)
m.c40 = Constraint(expr= m.x84 - 40*m.b172 <= 0)
m.c41 = Constraint(expr= m.x85 - 40*m.b173 <= 0)
m.c42 = Constraint(expr= m.x86 + 40*m.b170 <= 40)
m.c43 = Constraint(expr= m.x87 + 40*m.b171 <= 40)
m.c44 = Constraint(expr= m.x88 + 40*m.b172 <= 40)
m.c45 = Constraint(expr= m.x89 + 40*m.b173 <= 40)
m.c46 = Constraint(expr= m.x98 - 3.71357206670431*m.b170 <= 0)
m.c47 = Constraint(expr= m.x99 - 3.71357206670431*m.b171 <= 0)
m.c48 = Constraint(expr= m.x100 - 3.71357206670431*m.b172 <= 0)
m.c49 = Constraint(expr= m.x101 - 3.71357206670431*m.b173 <= 0)
m.c50 = Constraint(expr= m.x102 + 3.71357206670431*m.b170 <= 3.71357206670431)
m.c51 = Constraint(expr= m.x103 + 3.71357206670431*m.b171 <= 3.71357206670431)
m.c52 = Constraint(expr= m.x104 + 3.71357206670431*m.b172 <= 3.71357206670431)
m.c53 = Constraint(expr= m.x105 + 3.71357206670431*m.b173 <= 3.71357206670431)
m.c54 = Constraint(expr=(m.x106/(1e-6 + m.b174) - 1.2*log(1 + m.x90/(1e-6 + m.b174)))*(1e-6 + m.b174) <= 0)
m.c55 = Constraint(expr=(m.x107/(1e-6 + m.b175) - 1.2*log(1 + m.x91/(1e-6 + m.b175)))*(1e-6 + m.b175) <= 0)
m.c56 = Constraint(expr=(m.x108/(1e-6 + m.b176) - 1.2*log(1 + m.x92/(1e-6 + m.b176)))*(1e-6 + m.b176) <= 0)
m.c57 = Constraint(expr=(m.x109/(1e-6 + m.b177) - 1.2*log(1 + m.x93/(1e-6 + m.b177)))*(1e-6 + m.b177) <= 0)
m.c58 = Constraint(expr= m.x94 == 0)
m.c59 = Constraint(expr= m.x95 == 0)
m.c60 = Constraint(expr= m.x96 == 0)
m.c61 = Constraint(expr= m.x97 == 0)
m.c62 = Constraint(expr= m.x110 == 0)
m.c63 = Constraint(expr= m.x111 == 0)
m.c64 = Constraint(expr= m.x112 == 0)
m.c65 = Constraint(expr= m.x113 == 0)
m.c66 = Constraint(expr= m.x30 - m.x90 - m.x94 == 0)
m.c67 = Constraint(expr= m.x31 - m.x91 - m.x95 == 0)
m.c68 = Constraint(expr= m.x32 - m.x92 - m.x96 == 0)
m.c69 = Constraint(expr= m.x33 - m.x93 - m.x97 == 0)
m.c70 = Constraint(expr= m.x38 - m.x106 - m.x110 == 0)
m.c71 = Constraint(expr= m.x39 - m.x107 - m.x111 == 0)
m.c72 = Constraint(expr= m.x40 - m.x108 - m.x112 == 0)
m.c73 = Constraint(expr= m.x41 - m.x109 - m.x113 == 0)
m.c74 = Constraint(expr= m.x90 - 40*m.b174 <= 0)
m.c75 = Constraint(expr= m.x91 - 40*m.b175 <= 0)
m.c76 = Constraint(expr= m.x92 - 40*m.b176 <= 0)
m.c77 = Constraint(expr= m.x93 - 40*m.b177 <= 0)
m.c78 = Constraint(expr= m.x94 + 40*m.b174 <= 40)
m.c79 = Constraint(expr= m.x95 + 40*m.b175 <= 40)
m.c80 = Constraint(expr= m.x96 + 40*m.b176 <= 40)
m.c81 = Constraint(expr= m.x97 + 40*m.b177 <= 40)
m.c82 = Constraint(expr= m.x106 - 4.45628648004517*m.b174 <= 0)
m.c83 = Constraint(expr= m.x107 - 4.45628648004517*m.b175 <= 0)
m.c84 = Constraint(expr= m.x108 - 4.45628648004517*m.b176 <= 0)
m.c85 = Constraint(expr= m.x109 - 4.45628648004517*m.b177 <= 0)
m.c86 = Constraint(expr= m.x110 + 4.45628648004517*m.b174 <= 4.45628648004517)
m.c87 = Constraint(expr= m.x111 + 4.45628648004517*m.b175 <= 4.45628648004517)
m.c88 = Constraint(expr= m.x112 + 4.45628648004517*m.b176 <= 4.45628648004517)
m.c89 = Constraint(expr= m.x113 + 4.45628648004517*m.b177 <= 4.45628648004517)
m.c90 = Constraint(expr= - 0.75*m.x114 + m.x146 == 0)
m.c91 = Constraint(expr= - 0.75*m.x115 + m.x147 == 0)
m.c92 = Constraint(expr= - 0.75*m.x116 + m.x148 == 0)
m.c93 = Constraint(expr= - 0.75*m.x117 + m.x149 == 0)
m.c94 = Constraint(expr= m.x118 == 0)
m.c95 = Constraint(expr= m.x119 == 0)
m.c96 = Constraint(expr= m.x120 == 0)
m.c97 = Constraint(expr= m.x121 == 0)
m.c98 = Constraint(expr= m.x150 == 0)
m.c99 = Constraint(expr= m.x151 == 0)
m.c100 = Constraint(expr= m.x152 == 0)
m.c101 = Constraint(expr= m.x153 == 0)
m.c102 = Constraint(expr= m.x54 - m.x114 - m.x118 == 0)
m.c103 = Constraint(expr= m.x55 - m.x115 - m.x119 == 0)
m.c104 = Constraint(expr= m.x56 - m.x116 - m.x120 == 0)
m.c105 = Constraint(expr= m.x57 - m.x117 - m.x121 == 0)
m.c106 = Constraint(expr= m.x70 - m.x146 - m.x150 == 0)
m.c107 = Constraint(expr= m.x71 - m.x147 - m.x151 == 0)
m.c108 = Constraint(expr= m.x72 - m.x148 - m.x152 == 0)
m.c109 = Constraint(expr= m.x73 - m.x149 - m.x153 == 0)
m.c110 = Constraint(expr= m.x114 - 4.45628648004517*m.b178 <= 0)
m.c111 = Constraint(expr= m.x115 - 4.45628648004517*m.b179 <= 0)
m.c112 = Constraint(expr= m.x116 - 4.45628648004517*m.b180 <= 0)
m.c113 = Constraint(expr= m.x117 - 4.45628648004517*m.b181 <= 0)
m.c114 = Constraint(expr= m.x118 + 4.45628648004517*m.b178 <= 4.45628648004517)
m.c115 = Constraint(expr= m.x119 + 4.45628648004517*m.b179 <= 4.45628648004517)
m.c116 = Constraint(expr= m.x120 + 4.45628648004517*m.b180 <= 4.45628648004517)
m.c117 = Constraint(expr= m.x121 + 4.45628648004517*m.b181 <= 4.45628648004517)
m.c118 = Constraint(expr= m.x146 - 3.34221486003388*m.b178 <= 0)
m.c119 = Constraint(expr= m.x147 - 3.34221486003388*m.b179 <= 0)
m.c120 = Constraint(expr= m.x148 - 3.34221486003388*m.b180 <= 0)
m.c121 = Constraint(expr= m.x149 - 3.34221486003388*m.b181 <= 0)
m.c122 = Constraint(expr= m.x150 + 3.34221486003388*m.b178 <= 3.34221486003388)
m.c123 = Constraint(expr= m.x151 + 3.34221486003388*m.b179 <= 3.34221486003388)
m.c124 = Constraint(expr= m.x152 + 3.34221486003388*m.b180 <= 3.34221486003388)
m.c125 = Constraint(expr= m.x153 + 3.34221486003388*m.b181 <= 3.34221486003388)
m.c126 = Constraint(expr=(m.x154/(1e-6 + m.b182) - 1.5*log(1 + m.x122/(1e-6 + m.b182)))*(1e-6 + m.b182) <= 0)
m.c127 = Constraint(expr=(m.x155/(1e-6 + m.b183) - 1.5*log(1 + m.x123/(1e-6 + m.b183)))*(1e-6 + m.b183) <= 0)
m.c128 = Constraint(expr=(m.x156/(1e-6 + m.b184) - 1.5*log(1 + m.x124/(1e-6 + m.b184)))*(1e-6 + m.b184) <= 0)
m.c129 = Constraint(expr=(m.x157/(1e-6 + m.b185) - 1.5*log(1 + m.x125/(1e-6 + m.b185)))*(1e-6 + m.b185) <= 0)
m.c130 = Constraint(expr= m.x126 == 0)
m.c131 = Constraint(expr= m.x127 == 0)
m.c132 = Constraint(expr= m.x128 == 0)
m.c133 = Constraint(expr= m.x129 == 0)
m.c134 = Constraint(expr= m.x158 == 0)
m.c135 = Constraint(expr= m.x159 == 0)
m.c136 = Constraint(expr= m.x160 == 0)
m.c137 = Constraint(expr= m.x161 == 0)
m.c138 = Constraint(expr= m.x58 - m.x122 - m.x126 == 0)
m.c139 = Constraint(expr= m.x59 - m.x123 - m.x127 == 0)
m.c140 = Constraint(expr= m.x60 - m.x124 - m.x128 == 0)
m.c141 = Constraint(expr= m.x61 - m.x125 - m.x129 == 0)
m.c142 = Constraint(expr= m.x74 - m.x154 - m.x158 == 0)
m.c143 = Constraint(expr= m.x75 - m.x155 - m.x159 == 0)
m.c144 = Constraint(expr= m.x76 - m.x156 - m.x160 == 0)
m.c145 = Constraint(expr= m.x77 - m.x157 - m.x161 == 0)
m.c146 = Constraint(expr= m.x122 - 4.45628648004517*m.b182 <= 0)
m.c147 = Constraint(expr= m.x123 - 4.45628648004517*m.b183 <= 0)
m.c148 = Constraint(expr= m.x124 - 4.45628648004517*m.b184 <= 0)
m.c149 = Constraint(expr= m.x125 - 4.45628648004517*m.b185 <= 0)
m.c150 = Constraint(expr= m.x126 + 4.45628648004517*m.b182 <= 4.45628648004517)
m.c151 = Constraint(expr= m.x127 + 4.45628648004517*m.b183 <= 4.45628648004517)
m.c152 = Constraint(expr= m.x128 + 4.45628648004517*m.b184 <= 4.45628648004517)
m.c153 = Constraint(expr= m.x129 + 4.45628648004517*m.b185 <= 4.45628648004517)
m.c154 = Constraint(expr= m.x154 - 2.54515263975353*m.b182 <= 0)
m.c155 = Constraint(expr= m.x155 - 2.54515263975353*m.b183 <= 0)
m.c156 = Constraint(expr= m.x156 - 2.54515263975353*m.b184 <= 0)
m.c157 = Constraint(expr= m.x157 - 2.54515263975353*m.b185 <= 0)
m.c158 = Constraint(expr= m.x158 + 2.54515263975353*m.b182 <= 2.54515263975353)
m.c159 = Constraint(expr= m.x159 + 2.54515263975353*m.b183 <= 2.54515263975353)
m.c160 = Constraint(expr= m.x160 + 2.54515263975353*m.b184 <= 2.54515263975353)
m.c161 = Constraint(expr= m.x161 + 2.54515263975353*m.b185 <= 2.54515263975353)
m.c162 = Constraint(expr= - m.x130 + m.x162 == 0)
m.c163 = Constraint(expr= - m.x131 + m.x163 == 0)
m.c164 = Constraint(expr= - m.x132 + m.x164 == 0)
m.c165 = Constraint(expr= - m.x133 + m.x165 == 0)
m.c166 = Constraint(expr= - 0.5*m.x138 + m.x162 == 0)
m.c167 = Constraint(expr= - 0.5*m.x139 + m.x163 == 0)
m.c168 = Constraint(expr= - 0.5*m.x140 + m.x164 == 0)
m.c169 = Constraint(expr= - 0.5*m.x141 + m.x165 == 0)
m.c170 = Constraint(expr= m.x134 == 0)
m.c171 = Constraint(expr= m.x135 == 0)
m.c172 = Constraint(expr= m.x136 == 0)
m.c173 = Constraint(expr= m.x137 == 0)
m.c174 = Constraint(expr= m.x142 == 0)
m.c175 = Constraint(expr= m.x143 == 0)
m.c176 = Constraint(expr= m.x144 == 0)
m.c177 = Constraint(expr= m.x145 == 0)
m.c178 = Constraint(expr= m.x166 == 0)
m.c179 = Constraint(expr= m.x167 == 0)
m.c180 = Constraint(expr= m.x168 == 0)
m.c181 = Constraint(expr= m.x169 == 0)
m.c182 = Constraint(expr= m.x62 - m.x130 - m.x134 == 0)
m.c183 = Constraint(expr= m.x63 - m.x131 - m.x135 == 0)
m.c184 = Constraint(expr= m.x64 - m.x132 - m.x136 == 0)
m.c185 = Constraint(expr= m.x65 - m.x133 - m.x137 == 0)
m.c186 = Constraint(expr= m.x66 - m.x138 - m.x142 == 0)
m.c187 = Constraint(expr= m.x67 - m.x139 - m.x143 == 0)
m.c188 = Constraint(expr= m.x68 - m.x140 - m.x144 == 0)
m.c189 = Constraint(expr= m.x69 - m.x141 - m.x145 == 0)
m.c190 = Constraint(expr= m.x78 - m.x162 - m.x166 == 0)
m.c191 = Constraint(expr= m.x79 - m.x163 - m.x167 == 0)
m.c192 = Constraint(expr= m.x80 - m.x164 - m.x168 == 0)
m.c193 = Constraint(expr= m.x81 - m.x165 - m.x169 == 0)
m.c194 = Constraint(expr= m.x130 - 4.45628648004517*m.b186 <= 0)
m.c195 = Constraint(expr= m.x131 - 4.45628648004517*m.b187 <= 0)
m.c196 = Constraint(expr= m.x132 - 4.45628648004517*m.b188 <= 0)
m.c197 = Constraint(expr= m.x133 - 4.45628648004517*m.b189 <= 0)
m.c198 = Constraint(expr= m.x134 + 4.45628648004517*m.b186 <= 4.45628648004517)
m.c199 = Constraint(expr= m.x135 + 4.45628648004517*m.b187 <= 4.45628648004517)
m.c200 = Constraint(expr= m.x136 + 4.45628648004517*m.b188 <= 4.45628648004517)
m.c201 = Constraint(expr= m.x137 + 4.45628648004517*m.b189 <= 4.45628648004517)
m.c202 = Constraint(expr= m.x138 - 30*m.b186 <= 0)
m.c203 = Constraint(expr= m.x139 - 30*m.b187 <= 0)
m.c204 = Constraint(expr= m.x140 - 30*m.b188 <= 0)
m.c205 = Constraint(expr= m.x141 - 30*m.b189 <= 0)
m.c206 = Constraint(expr= m.x142 + 30*m.b186 <= 30)
m.c207 = Constraint(expr= m.x143 + 30*m.b187 <= 30)
m.c208 = Constraint(expr= m.x144 + 30*m.b188 <= 30)
m.c209 = Constraint(expr= m.x145 + 30*m.b189 <= 30)
m.c210 = Constraint(expr= m.x162 - 15*m.b186 <= 0)
m.c211 = Constraint(expr= m.x163 - 15*m.b187 <= 0)
m.c212 = Constraint(expr= m.x164 - 15*m.b188 <= 0)
m.c213 = Constraint(expr= m.x165 - 15*m.b189 <= 0)
m.c214 = Constraint(expr= m.x166 + 15*m.b186 <= 15)
m.c215 = Constraint(expr= m.x167 + 15*m.b187 <= 15)
m.c216 = Constraint(expr= m.x168 + 15*m.b188 <= 15)
m.c217 = Constraint(expr= m.x169 + 15*m.b189 <= 15)
m.c218 = Constraint(expr= m.x2 + 5*m.b190 == 0)
m.c219 = Constraint(expr= m.x3 + 4*m.b191 == 0)
m.c220 = Constraint(expr= m.x4 + 6*m.b192 == 0)
m.c221 = Constraint(expr= m.x5 + 3*m.b193 == 0)
m.c222 = Constraint(expr= m.x6 + 8*m.b194 == 0)
m.c223 = Constraint(expr= m.x7 + 7*m.b195 == 0)
m.c224 = Constraint(expr= m.x8 + 6*m.b196 == 0)
m.c225 = Constraint(expr= m.x9 + 5*m.b197 == 0)
m.c226 = Constraint(expr= m.x10 + 6*m.b198 == 0)
m.c227 = Constraint(expr= m.x11 + 9*m.b199 == 0)
m.c228 = Constraint(expr= m.x12 + 4*m.b200 == 0)
m.c229 = Constraint(expr= m.x13 + 3*m.b201 == 0)
m.c230 = Constraint(expr= m.x14 + 10*m.b202 == 0)
m.c231 = Constraint(expr= m.x15 + 9*m.b203 == 0)
m.c232 = Constraint(expr= m.x16 + 5*m.b204 == 0)
m.c233 = Constraint(expr= m.x17 + 6*m.b205 == 0)
m.c234 = Constraint(expr= m.x18 + 6*m.b206 == 0)
m.c235 = Constraint(expr= m.x19 + 10*m.b207 == 0)
m.c236 = Constraint(expr= m.x20 + 6*m.b208 == 0)
m.c237 = Constraint(expr= m.x21 + 9*m.b209 == 0)
m.c238 = Constraint(expr= m.b170 - m.b171 <= 0)
m.c239 = Constraint(expr= m.b170 - m.b172 <= 0)
m.c240 = Constraint(expr= m.b170 - m.b173 <= 0)
m.c241 = Constraint(expr= m.b171 - m.b172 <= 0)
m.c242 = Constraint(expr= m.b171 - m.b173 <= 0)
m.c243 = Constraint(expr= m.b172 - m.b173 <= 0)
m.c244 = Constraint(expr= m.b174 - m.b175 <= 0)
m.c245 = Constraint(expr= m.b174 - m.b176 <= 0)
m.c246 = Constraint(expr= m.b174 - m.b177 <= 0)
m.c247 = Constraint(expr= m.b175 - m.b176 <= 0)
m.c248 = Constraint(expr= m.b175 - m.b177 <= 0)
m.c249 = Constraint(expr= m.b176 - m.b177 <= 0)
m.c250 = Constraint(expr= m.b178 - m.b179 <= 0)
m.c251 = Constraint(expr= m.b178 - m.b180 <= 0)
m.c252 = Constraint(expr= m.b178 - m.b181 <= 0)
m.c253 = Constraint(expr= m.b179 - m.b180 <= 0)
m.c254 = Constraint(expr= m.b179 - m.b181 <= 0)
m.c255 = Constraint(expr= m.b180 - m.b181 <= 0)
m.c256 = Constraint(expr= m.b182 - m.b183 <= 0)
m.c257 = Constraint(expr= m.b182 - m.b184 <= 0)
m.c258 = Constraint(expr= m.b182 - m.b185 <= 0)
m.c259 = Constraint(expr= m.b183 - m.b184 <= 0)
m.c260 = Constraint(expr= m.b183 - m.b185 <= 0)
m.c261 = Constraint(expr= m.b184 - m.b185 <= 0)
m.c262 = Constraint(expr= m.b186 - m.b187 <= 0)
m.c263 = Constraint(expr= m.b186 - m.b188 <= 0)
m.c264 = Constraint(expr= m.b186 - m.b189 <= 0)
m.c265 = Constraint(expr= m.b187 - m.b188 <= 0)
m.c266 = Constraint(expr= m.b187 - m.b189 <= 0)
m.c267 = Constraint(expr= m.b188 - m.b189 <= 0)
m.c268 = Constraint(expr= m.b190 + m.b191 <= 1)
m.c269 = Constraint(expr= m.b190 + m.b192 <= 1)
m.c270 = Constraint(expr= m.b190 + m.b193 <= 1)
m.c271 = Constraint(expr= m.b190 + m.b191 <= 1)
m.c272 = Constraint(expr= m.b191 + m.b192 <= 1)
m.c273 = Constraint(expr= m.b191 + m.b193 <= 1)
m.c274 = Constraint(expr= m.b190 + m.b192 <= 1)
m.c275 = Constraint(expr= m.b191 + m.b192 <= 1)
m.c276 = Constraint(expr= m.b192 + m.b193 <= 1)
m.c277 = Constraint(expr= m.b190 + m.b193 <= 1)
m.c278 = Constraint(expr= m.b191 + m.b193 <= 1)
m.c279 = Constraint(expr= m.b192 + m.b193 <= 1)
m.c280 = Constraint(expr= m.b194 + m.b195 <= 1)
m.c281 = Constraint(expr= m.b194 + m.b196 <= 1)
m.c282 = Constraint(expr= m.b194 + m.b197 <= 1)
m.c283 = Constraint(expr= m.b194 + m.b195 <= 1)
m.c284 = Constraint(expr= m.b195 + m.b196 <= 1)
m.c285 = Constraint(expr= m.b195 + m.b197 <= 1)
m.c286 = Constraint(expr= m.b194 + m.b196 <= 1)
m.c287 = Constraint(expr= m.b195 + m.b196 <= 1)
m.c288 = Constraint(expr= m.b196 + m.b197 <= 1)
m.c289 = Constraint(expr= m.b194 + m.b197 <= 1)
m.c290 = Constraint(expr= m.b195 + m.b197 <= 1)
m.c291 = Constraint(expr= m.b196 + m.b197 <= 1)
m.c292 = Constraint(expr= m.b198 + m.b199 <= 1)
m.c293 = Constraint(expr= m.b198 + m.b200 <= 1)
m.c294 = Constraint(expr= m.b198 + m.b201 <= 1)
m.c295 = Constraint(expr= m.b198 + m.b199 <= 1)
m.c296 = Constraint(expr= m.b199 + m.b200 <= 1)
m.c297 = Constraint(expr= m.b199 + m.b201 <= 1)
m.c298 = Constraint(expr= m.b198 + m.b200 <= 1)
m.c299 = Constraint(expr= m.b199 + m.b200 <= 1)
m.c300 = Constraint(expr= m.b200 + m.b201 <= 1)
m.c301 = Constraint(expr= m.b198 + m.b201 <= 1)
m.c302 = Constraint(expr= m.b199 + m.b201 <= 1)
m.c303 = Constraint(expr= m.b200 + m.b201 <= 1)
m.c304 = Constraint(expr= m.b202 + m.b203 <= 1)
m.c305 = Constraint(expr= m.b202 + m.b204 <= 1)
m.c306 = Constraint(expr= m.b202 + m.b205 <= 1)
m.c307 = Constraint(expr= m.b202 + m.b203 <= 1)
m.c308 = Constraint(expr= m.b203 + m.b204 <= 1)
m.c309 = Constraint(expr= m.b203 + m.b205 <= 1)
m.c310 = Constraint(expr= m.b202 + m.b204 <= 1)
m.c311 = Constraint(expr= m.b203 + m.b204 <= 1)
m.c312 = Constraint(expr= m.b204 + m.b205 <= 1)
m.c313 = Constraint(expr= m.b202 + m.b205 <= 1)
m.c314 = Constraint(expr= m.b203 + m.b205 <= 1)
m.c315 = Constraint(expr= m.b204 + m.b205 <= 1)
m.c316 = Constraint(expr= m.b206 + m.b207 <= 1)
m.c317 = Constraint(expr= m.b206 + m.b208 <= 1)
m.c318 = Constraint(expr= m.b206 + m.b209 <= 1)
m.c319 = Constraint(expr= m.b206 + m.b207 <= 1)
m.c320 = Constraint(expr= m.b207 + m.b208 <= 1)
m.c321 = Constraint(expr= m.b207 + m.b209 <= 1)
m.c322 = Constraint(expr= m.b206 + m.b208 <= 1)
m.c323 = Constraint(expr= m.b207 + m.b208 <= 1)
m.c324 = Constraint(expr= m.b208 + m.b209 <= 1)
m.c325 = Constraint(expr= m.b206 + m.b209 <= 1)
m.c326 = Constraint(expr= m.b207 + m.b209 <= 1)
m.c327 = Constraint(expr= m.b208 + m.b209 <= 1)
m.c328 = Constraint(expr= m.b170 - m.b190 <= 0)
m.c329 = Constraint(expr= - m.b170 + m.b171 - m.b191 <= 0)
m.c330 = Constraint(expr= - m.b170 - m.b171 + m.b172 - m.b192 <= 0)
m.c331 = Constraint(expr= - m.b170 - m.b171 - m.b172 + m.b173 - m.b193 <= 0)
m.c332 = Constraint(expr= m.b174 - m.b194 <= 0)
m.c333 = Constraint(expr= - m.b174 + m.b175 - m.b195 <= 0)
m.c334 = Constraint(expr= - m.b174 - m.b175 + m.b176 - m.b196 <= 0)
m.c335 = Constraint(expr= - m.b174 - m.b175 - m.b176 + m.b177 - m.b197 <= 0)
m.c336 = Constraint(expr= m.b178 - m.b198 <= 0)
m.c337 = Constraint(expr= - m.b178 + m.b179 - m.b199 <= 0)
m.c338 = Constraint(expr= - m.b178 - m.b179 + m.b180 - m.b200 <= 0)
m.c339 = Constraint(expr= - m.b178 - m.b179 - m.b180 + m.b181 - m.b201 <= 0)
m.c340 = Constraint(expr= m.b182 - m.b202 <= 0)
m.c341 = Constraint(expr= - m.b182 + m.b183 - m.b203 <= 0)
m.c342 = Constraint(expr= - m.b182 - m.b183 + m.b184 - m.b204 <= 0)
m.c343 = Constraint(expr= - m.b182 - m.b183 - m.b184 + m.b185 - m.b205 <= 0)
m.c344 = Constraint(expr= m.b186 - m.b206 <= 0)
m.c345 = Constraint(expr= - m.b186 + m.b187 - m.b207 <= 0)
m.c346 = Constraint(expr= - m.b186 - m.b187 + m.b188 - m.b208 <= 0)
m.c347 = Constraint(expr= - m.b186 - m.b187 - m.b188 + m.b189 - m.b209 <= 0)
m.c348 = Constraint(expr= m.b170 + m.b174 == 1)
m.c349 = Constraint(expr= m.b171 + m.b175 == 1)
m.c350 = Constraint(expr= m.b172 + m.b176 == 1)
m.c351 = Constraint(expr= m.b173 + m.b177 == 1)
m.c352 = Constraint(expr= m.b170 + m.b174 - m.b178 >= 0)
m.c353 = Constraint(expr= m.b171 + m.b175 - m.b179 >= 0)
m.c354 = Constraint(expr= m.b172 + m.b176 - m.b180 >= 0)
m.c355 = Constraint(expr= m.b173 + m.b177 - m.b181 >= 0)
m.c356 = Constraint(expr= m.b170 + m.b174 - m.b182 >= 0)
m.c357 = Constraint(expr= m.b171 + m.b175 - m.b183 >= 0)
m.c358 = Constraint(expr= m.b172 + m.b176 - m.b184 >= 0)
m.c359 = Constraint(expr= m.b173 + m.b177 - m.b185 >= 0)
m.c360 = Constraint(expr= m.b170 + m.b174 - m.b186 >= 0)
m.c361 = Constraint(expr= m.b171 + m.b175 - m.b187 >= 0)
m.c362 = Constraint(expr= m.b172 + m.b176 - m.b188 >= 0)
m.c363 = Constraint(expr= m.b173 + m.b177 - m.b189 >= 0)
| 35.187759 | 117 | 0.635565 | 6,075 | 33,921 | 3.548807 | 0.111111 | 0.042766 | 0.246301 | 0.155851 | 0.512176 | 0.471682 | 0.461663 | 0.441579 | 0.369219 | 0 | 0 | 0.220744 | 0.160107 | 33,921 | 963 | 118 | 35.224299 | 0.535978 | 0.020047 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.00173 | 0 | 0.00173 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
4fcfbd8024734cb1efbb3a2c975669d6daead2b5 | 666 | py | Python | RaspberryPi/Hardware/UltrasonicSensorSet.py | amaankhan02/SelfDrivingCar | 7831a9db13d2e8c9ca683e48588eabdf065f80fa | [
"MIT"
] | null | null | null | RaspberryPi/Hardware/UltrasonicSensorSet.py | amaankhan02/SelfDrivingCar | 7831a9db13d2e8c9ca683e48588eabdf065f80fa | [
"MIT"
] | null | null | null | RaspberryPi/Hardware/UltrasonicSensorSet.py | amaankhan02/SelfDrivingCar | 7831a9db13d2e8c9ca683e48588eabdf065f80fa | [
"MIT"
] | null | null | null | import RPi.GPIO as gpio
from enum import Enum
import time
from GpioMode import GpioMode
from UltrasonicSensor import UltrasonicSensor
class UltrasonicSensorSet:
def __init__(self, *args:UltrasonicSensor):
"""
:param args: UltrasonicSensor objects
"""
self.ussSet = args
def getDistances(self):
"""
:return: list of distances of all UltrasonicSensors in order of how passed in constructor
"""
distances = []
for uss in self.ussSet:
distances.append(uss.getDistance())
return distances
def cleanup(self):
gpio.cleanup()
print("GPIO cleaned up") | 25.615385 | 97 | 0.641141 | 71 | 666 | 5.957746 | 0.535211 | 0.047281 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.283784 | 666 | 26 | 98 | 25.615385 | 0.886792 | 0.190691 | 0 | 0 | 0 | 0 | 0.030426 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.1875 | false | 0 | 0.3125 | 0 | 0.625 | 0.0625 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
4ff5b0c354535c37f2701811b82b3f73ff4f9e97 | 989 | py | Python | blogjaguar/apps/blog/categorylister.py | darioblanco/blogjaguar | 11f5d8b1afa8b206992142e97382895a80a70b58 | [
"Apache-2.0"
] | null | null | null | blogjaguar/apps/blog/categorylister.py | darioblanco/blogjaguar | 11f5d8b1afa8b206992142e97382895a80a70b58 | [
"Apache-2.0"
] | 9 | 2020-06-30T05:41:00.000Z | 2020-06-30T05:42:16.000Z | blogjaguar/apps/blog/categorylister.py | darioblanco/blogjaguar | 11f5d8b1afa8b206992142e97382895a80a70b58 | [
"Apache-2.0"
] | null | null | null | # Copyright 2011 Dario Blanco Iturriaga
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from blog.models import Category
class CategoryLister():
""" Manages everything related with categories for a specific language.
"""
def __init__(self, l):
self.language = l
def get_categories(self):
""" Returns the category list for the selected language.
"""
return Category.objects.filter(lang=self.language).order_by('title')
| 34.103448 | 76 | 0.71183 | 136 | 989 | 5.132353 | 0.654412 | 0.08596 | 0.037249 | 0.045845 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.01027 | 0.212336 | 989 | 28 | 77 | 35.321429 | 0.885751 | 0.722952 | 0 | 0 | 0 | 0 | 0.02008 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0.166667 | 0 | 0.833333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
8b0a50f43851de6203cf6ea5aec25fdd01ac8908 | 5,508 | py | Python | standalone/demo_texas.py | apalomES/plug | 5ab2244e0560814a313bc73b18796324f1599d35 | [
"MIT"
] | null | null | null | standalone/demo_texas.py | apalomES/plug | 5ab2244e0560814a313bc73b18796324f1599d35 | [
"MIT"
] | null | null | null | standalone/demo_texas.py | apalomES/plug | 5ab2244e0560814a313bc73b18796324f1599d35 | [
"MIT"
] | null | null | null | from uuid import uuid4
from powersimdata import Scenario
scenario = Scenario()
print(scenario.state.name)
scenario.set_grid(interconnect="Texas")
scenario.set_name("test", "comp_" + str(uuid4()))
scenario.set_time("2016-01-01 00:00:00", "2016-01-01 03:00:00", "1H")
scenario.set_base_profile("demand", "vJan2021")
scenario.set_base_profile("hydro", "vJan2021")
scenario.set_base_profile("solar", "vJan2021")
scenario.set_base_profile("wind", "vJan2021")
scenario.change_table.ct = {
"ng": {
"zone_id": {
301: 0.9335236224644795,
302: 1.0333898171154643,
303: 0.8571428571428572,
304: 0.9147922682213607,
305: 1.0875509750330794,
306: 0.7056654770933735,
307: 0.8070167506838167,
308: 1.2989804301171135,
},
"plant_id": {13033: 0, 13266: 0, 13271: 0, 13272: 0},
},
"wind": {
"zone_id": {
301: 1.1293320940114195,
302: 2.2996731828360466,
303: 1.1460693669609412,
304: 1.5378918905751389,
305: 1.6606575751914816,
},
"plant_id": {12912: 0},
},
"solar": {
"zone_id": {
301: 1.6497354497354497,
303: 9.965517241379311,
306: 1.4309500489715965,
307: 0.6303534303534303,
308: 0.37341772151898733,
}
},
"coal": {
"zone_id": {
302: 0.0,
304: 0.8484061967718387,
305: 0.9102977061981454,
306: 2.260960124024402,
307: 5.486687036228721,
308: 1.244369937993577,
},
"plant_id": {
13170: 0,
13171: 0,
13395: 0,
13396: 0,
13409: 0,
13410: 0,
13411: 0,
},
},
"hydro": {
"zone_id": {
302: 1.125,
303: 0.4949567723342939,
304: 2.0723684210526314,
305: 0.8779069767441859,
306: 1.0100376411543288,
}
},
"nuclear": {"zone_id": {305: 1.0123456790123457, 307: 0.9451377095178322}},
"new_plant": [
{
"bus_id": 3007104,
"Pmax": 277,
"type": "ng",
"c0": 1365,
"c1": 24,
"c2": 0.00124,
"Pmin": 0,
},
{
"bus_id": 3004056,
"Pmax": 150,
"type": "ng",
"c0": 1365,
"c1": 24,
"c2": 0.00124,
"Pmin": 0,
},
{
"bus_id": 3008097,
"Pmax": 100,
"type": "other",
"c0": 0,
"c1": 0,
"c2": 0,
"Pmin": 0,
},
{
"bus_id": 3002079,
"type": "solar",
"Pmax": 454,
"Pmin": 0,
"plant_id_neighbor": 14000,
},
{
"bus_id": 3002130,
"type": "solar",
"Pmax": 189,
"Pmin": 0,
"plant_id_neighbor": 14006,
},
{
"bus_id": 3004197,
"type": "solar",
"Pmax": 17.3,
"Pmin": 0,
"plant_id_neighbor": 13237,
},
{
"bus_id": 3005377,
"type": "solar",
"Pmax": 81.8,
"Pmin": 0,
"plant_id_neighbor": 13161,
},
{
"bus_id": 3007261,
"type": "wind",
"Pmax": 220,
"Pmin": 0,
"plant_id_neighbor": 13042,
},
],
"branch": {
"branch_id": {
101015: 1.4632275132275132,
101388: 2.77443536296368,
102720: 1.0714268651011682,
102724: 1.2878188476770431,
101061: 1.1221224283420168,
101073: 1.1064509996877934,
101115: 1.614508643453941,
101135: 1.8684227740089265,
101139: 1.4007881119103172,
101147: 1.3893613551221164,
101152: 1.0935968044543969,
101157: 1.3741440903124618,
101166: 1.8625941328537707,
101169: 1.1208781587528398,
101274: 1.2044964191072227,
101312: 1.0845454872992843,
101313: 1.2817355758991542,
101320: 1.23111915644994,
101352: 1.1292883444424753,
101353: 1.0476530424345853,
103717: 1.2,
103534: 2,
103896: 1.1,
103897: 1.1,
103898: 1.1,
103827: 2,
100916: 2,
100918: 2,
100923: 2,
100926: 2,
100928: 2,
100947: 2,
100949: 3,
100952: 2,
100954: 2,
100957: 2,
100972: 2,
100973: 2,
100979: 2,
101000: 2,
101003: 2,
101004: 2,
101018: 2,
101363: 2,
}
},
"demand": {
"zone_id": {
301: 1.0867,
302: 1.0867,
303: 1.0867,
304: 1.0867,
305: 1.0867,
306: 1.0867,
307: 1.0867,
308: 1.0867,
}
},
}
grid = scenario.get_grid()
ct = scenario.get_ct()
scenario.print_scenario_info()
scenario.create_scenario()
scenario.prepare_simulation_input()
resp = scenario.launch_simulation(solver="glpk")
scenario.check_progress()
| 25.382488 | 79 | 0.444808 | 497 | 5,508 | 4.82495 | 0.416499 | 0.023353 | 0.020851 | 0.025021 | 0.10759 | 0.028357 | 0.028357 | 0.028357 | 0.028357 | 0.028357 | 0 | 0.491117 | 0.427741 | 5,508 | 216 | 80 | 25.5 | 0.26967 | 0 | 0 | 0.126829 | 0 | 0 | 0.094408 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.009756 | 0 | 0.009756 | 0.009756 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
8b0b7d57ff6061a5647dccc3c860959fdca68eea | 602 | py | Python | AeroComBAT/__init__.py | bennames/AeroComBAT-Project | ddc7194d5ccc0b8bf09b73cc0c2c3d64adf4a472 | [
"MIT"
] | 13 | 2016-01-20T04:42:38.000Z | 2022-03-09T04:49:48.000Z | AeroComBAT/__init__.py | mldmnn/AeroComBAT-Project | ddc7194d5ccc0b8bf09b73cc0c2c3d64adf4a472 | [
"MIT"
] | 1 | 2016-04-18T14:19:26.000Z | 2016-04-18T21:55:25.000Z | AeroComBAT/__init__.py | mldmnn/AeroComBAT-Project | ddc7194d5ccc0b8bf09b73cc0c2c3d64adf4a472 | [
"MIT"
] | 3 | 2018-05-03T07:45:05.000Z | 2021-04-07T08:55:14.000Z | """A tool for modeling composite beams and aircraft wings.
``Aerodynamics``
This module provides the aerodynamics models used within AeroComBAT
``AircraftParts``
This module provides a full-fledged wing object that can be used to
determine if a design is both statically adequate as well as stable.
``FEM``
This module provides a finite element model object, intended as a
convenient way for a user to create and model composite structures and
potential flow lifting surfaces.
``Structures``
This module provides the structural models used within AeroComBAT.
""" | 43 | 75 | 0.750831 | 83 | 602 | 5.445783 | 0.626506 | 0.088496 | 0.159292 | 0.09292 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.202658 | 602 | 14 | 76 | 43 | 0.941667 | 0.9701 | 0 | null | 0 | null | 0 | 0 | null | 0 | 0 | 0 | null | 1 | null | true | 0 | 0 | null | null | null | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
8b1bd7659a90a8ba28e7af3215b07594e4ce1ce4 | 620 | py | Python | dayu_widgets/radio_button.py | ZSD-tim/dayu_widgets | 31c2530bdc4161d9311574d9850c2e9471e53072 | [
"MIT"
] | 157 | 2019-03-10T05:55:21.000Z | 2022-03-31T09:07:00.000Z | dayu_widgets/radio_button.py | kanbang/dayu_widgets | 6ff101e6c6f8fcf10e5cb578023a12ccdcef9164 | [
"MIT"
] | 16 | 2019-07-15T11:30:53.000Z | 2021-12-16T14:17:59.000Z | dayu_widgets/radio_button.py | kanbang/dayu_widgets | 6ff101e6c6f8fcf10e5cb578023a12ccdcef9164 | [
"MIT"
] | 56 | 2019-06-19T03:35:27.000Z | 2022-03-22T08:07:32.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*-
###################################################################
# Author: Mu yanru
# Date : 2019.2
# Email : muyanru345@163.com
###################################################################
"""
MRadioButton
"""
from dayu_widgets.mixin import cursor_mixin
from dayu_widgets.qt import QRadioButton
@cursor_mixin
class MRadioButton(QRadioButton):
"""
MRadioButton just use stylesheet and set cursor shape when hover. No more extend.
"""
def __init__(self, text='', parent=None):
super(MRadioButton, self).__init__(text=text, parent=parent)
| 28.181818 | 85 | 0.55 | 63 | 620 | 5.222222 | 0.714286 | 0.048632 | 0.091185 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.022388 | 0.135484 | 620 | 21 | 86 | 29.52381 | 0.591418 | 0.316129 | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
8b22f60e8817b510f8bc63f41e536f26cc1e0f64 | 689 | py | Python | test/integration/ggrc/models/test_control_assessment.py | mikecb/ggrc-core | 1cda560cb0920021416e07740c6cca1acba56268 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | test/integration/ggrc/models/test_control_assessment.py | mikecb/ggrc-core | 1cda560cb0920021416e07740c6cca1acba56268 | [
"ECL-2.0",
"Apache-2.0"
] | 1 | 2021-03-26T00:24:35.000Z | 2021-03-26T00:24:35.000Z | test/integration/ggrc/models/test_control_assessment.py | mikecb/ggrc-core | 1cda560cb0920021416e07740c6cca1acba56268 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | # Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: miha@reciprocitylabs.com
# Maintained By: miha@reciprocitylabs.com
from ggrc import db
from ggrc.models import ControlAssessment
from integration.ggrc import TestCase
from integration.ggrc.models.factories import ControlAssessmentFactory
class TestControlAssessment(TestCase):
def test_auto_slug_generation(self):
ControlAssessmentFactory(title="Some title")
db.session.commit()
ca = ControlAssessment.query.first()
self.assertIn("CONTROL-", ca.slug)
self.assertIn(ca.control.slug, ca.slug)
| 34.45 | 78 | 0.780842 | 87 | 689 | 6.149425 | 0.609195 | 0.02243 | 0.078505 | 0.08972 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.009901 | 0.120464 | 689 | 19 | 79 | 36.263158 | 0.872937 | 0.333817 | 0 | 0 | 0 | 0 | 0.039648 | 0 | 0 | 0 | 0 | 0 | 0.181818 | 1 | 0.090909 | false | 0 | 0.363636 | 0 | 0.545455 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
8b328370d1cf93b389aef2ac7b2ff633d0f7663a | 519 | py | Python | rotait/workload.py | stevecshanks/rota-it | 09a48b3e8c863557968258f9083bb69e4188e5b3 | [
"MIT"
] | null | null | null | rotait/workload.py | stevecshanks/rota-it | 09a48b3e8c863557968258f9083bb69e4188e5b3 | [
"MIT"
] | null | null | null | rotait/workload.py | stevecshanks/rota-it | 09a48b3e8c863557968258f9083bb69e4188e5b3 | [
"MIT"
] | null | null | null | from collections import Counter
class Workload:
def __init__(self, tasks):
self.per_person = Counter(task.assignee for task in tasks)
def assign(self, task, person):
task.assignee = person
self.per_person[person] += 1
return task
def assigned_to(self, person):
return self.per_person[person]
def get_least_busy_person(self, people):
if not people:
return None
return sorted(people, key=lambda person: self.assigned_to(person))[0] | 25.95 | 77 | 0.655106 | 68 | 519 | 4.823529 | 0.470588 | 0.064024 | 0.118902 | 0.115854 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005208 | 0.260116 | 519 | 20 | 77 | 25.95 | 0.848958 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.285714 | false | 0 | 0.071429 | 0.071429 | 0.714286 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
8b409e98d4bcafd53946a98c26955761614abc97 | 216 | py | Python | js/jquery_scrolltofixed/__init__.py | davidjb/js.jquery_scrolltofixed | f5a8606ce8c240334504e43f218c2e8d11d09551 | [
"BSD-3-Clause"
] | 1 | 2016-08-31T19:19:16.000Z | 2016-08-31T19:19:16.000Z | js/jquery_scrolltofixed/__init__.py | davidjb/js.jquery_scrolltofixed | f5a8606ce8c240334504e43f218c2e8d11d09551 | [
"BSD-3-Clause"
] | null | null | null | js/jquery_scrolltofixed/__init__.py | davidjb/js.jquery_scrolltofixed | f5a8606ce8c240334504e43f218c2e8d11d09551 | [
"BSD-3-Clause"
] | null | null | null | from fanstatic import Library, Resource
library = Library('scrolltofixed', 'resources')
scrolltofixed = Resource(library, 'jquery-scrolltofixed.js',
minified='jquery-scrolltofixed-min.js')
| 30.857143 | 64 | 0.699074 | 20 | 216 | 7.55 | 0.55 | 0.198676 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.189815 | 216 | 6 | 65 | 36 | 0.862857 | 0 | 0 | 0 | 0 | 0 | 0.333333 | 0.231481 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
8c6a4e21298bd22ee6accce6dcffb362757cd105 | 746 | py | Python | devops-console/apps/applications/migrations/0002_auto_20190130_1757.py | lilinghell/devops | 1b2890d3f2d9f6e15e5b32d0910bc4768f065adc | [
"Apache-2.0"
] | 4 | 2019-12-06T06:19:33.000Z | 2021-12-23T13:05:06.000Z | devops-console/apps/applications/migrations/0002_auto_20190130_1757.py | lilinghell/devops | 1b2890d3f2d9f6e15e5b32d0910bc4768f065adc | [
"Apache-2.0"
] | 8 | 2020-03-15T03:40:38.000Z | 2022-03-12T00:50:27.000Z | devops-console/apps/applications/migrations/0002_auto_20190130_1757.py | lilinghell/devops | 1b2890d3f2d9f6e15e5b32d0910bc4768f065adc | [
"Apache-2.0"
] | null | null | null | # Generated by Django 2.1.5 on 2019-01-30 09:57
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('applications', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='repository',
name='auth_pwd',
field=models.CharField(max_length=128, null=True),
),
migrations.AlterField(
model_name='repository',
name='auth_token',
field=models.CharField(max_length=128, null=True),
),
migrations.AlterField(
model_name='repository',
name='auth_username',
field=models.CharField(max_length=128, null=True),
),
]
| 26.642857 | 62 | 0.580429 | 75 | 746 | 5.64 | 0.52 | 0.141844 | 0.177305 | 0.205674 | 0.617021 | 0.617021 | 0.617021 | 0.50591 | 0.411348 | 0.411348 | 0 | 0.05395 | 0.30429 | 746 | 27 | 63 | 27.62963 | 0.761079 | 0.060322 | 0 | 0.545455 | 1 | 0 | 0.121602 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.045455 | 0 | 0.181818 | 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 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
8c6d9af9d7f87aa9ba388d3e1cf15c31ce4fbd09 | 2,958 | py | Python | tests/test_encode.py | gruber-sciencelab/SMEAGOL | 966e18a9869e992537605f93e5ee2af1c9e257f2 | [
"MIT"
] | null | null | null | tests/test_encode.py | gruber-sciencelab/SMEAGOL | 966e18a9869e992537605f93e5ee2af1c9e257f2 | [
"MIT"
] | null | null | null | tests/test_encode.py | gruber-sciencelab/SMEAGOL | 966e18a9869e992537605f93e5ee2af1c9e257f2 | [
"MIT"
] | null | null | null | from smeagol.encode import *
import os
import pytest
script_dir = os.path.dirname(__file__)
rel_path = "data"
data_path = os.path.join(script_dir, rel_path)
def test_integer_encode():
record = SeqRecord(Seq('ACGTNWSMKRYBDHVZ'), id='id', name='name')
result = integer_encode(record, rc=False)
assert np.all(result == [1,2,3,4,6,7,8,9,10,11,12,13,14,15,16,0])
record = SeqRecord(Seq('ACGE'))
with pytest.raises(KeyError):
integer_encode(record, rc='none')
record = SeqRecord(Seq('AGCAU'))
result = integer_encode(record, rc=True)
assert np.all(result == [1, 5, 3, 2, 5])
def test_SeqEncoding():
records = [SeqRecord(Seq('AGC'), id='id1', name='name1'),
SeqRecord(Seq('ACA'), id='id2', name='name2')]
result = SeqEncoding(records, sense='+')
assert result.len == 3
assert np.all(result.ids == ['id1', 'id2'])
assert np.all(result.names == ['name1', 'name2'])
assert np.all(result.seqs == np.array([[1,3,2], [1,2,1]]))
assert np.all(result.senses == ['+', '+'])
assert type(result.senses) == np.ndarray
assert type(result.ids) == np.ndarray
assert type(result.names) == np.ndarray
assert type(result.senses) == np.ndarray
result = SeqEncoding(records, sense='+', rcomp='only')
assert np.all(result.ids == ['id1', 'id2'])
assert np.all(result.names == ['name1', 'name2'])
assert np.all(result.seqs == np.array([[3,2,4], [4,3,4]]))
assert np.all(result.senses == ['-', '-'])
result = SeqEncoding(records, sense='+', rcomp='both')
assert np.all(result.ids == ['id1', 'id2', 'id1', 'id2'])
assert np.all(result.names == ['name1', 'name2', 'name1', 'name2'])
assert np.all(result.seqs == np.array([[1,3,2], [1,2,1], [3,2,4], [4,3,4]]))
assert np.all(result.senses == ['+', '+', '-', '-'])
def test_SeqGroups():
records = os.path.join(data_path, 'test.fa.gz')
result = SeqGroups(records, sense='+')
expected = [SeqEncoding([SeqRecord(seq=Seq('ATTAAATA'), id='Seg1', name='Seg1')], sense='+', rcomp='none'), SeqEncoding([SeqRecord(seq=Seq('CAAAATCTTTAGGATTAGCAC'), id='Seg2', name='Seg2')], sense='+', rcomp='none')]
for i in range(2):
assert np.all(result.seqs[i].seqs == expected[i].seqs)
assert result.seqs[i].ids == expected[i].ids
assert result.seqs[i].senses == expected[i].senses
assert result.seqs[i].names == expected[i].names
records = [SeqRecord(Seq('AGC'), id='id1', name='name'),
SeqRecord(Seq('ACA'), id='id2', name='name')]
result = SeqGroups(records, sense='-', rcomp='both', group_by='name')
assert len(result.seqs) == 1
expected = SeqEncoding(records, sense='-', rcomp='both')
assert np.all(result.seqs[0].seqs == expected.seqs)
assert np.all(result.seqs[0].ids == expected.ids)
assert np.all(result.seqs[0].names == expected.names)
assert np.all(result.seqs[0].senses == expected.senses)
| 44.149254 | 220 | 0.612576 | 415 | 2,958 | 4.322892 | 0.209639 | 0.084727 | 0.116499 | 0.180045 | 0.497213 | 0.372352 | 0.27146 | 0.231884 | 0.231884 | 0.156076 | 0 | 0.034722 | 0.172414 | 2,958 | 67 | 221 | 44.149254 | 0.698121 | 0 | 0 | 0.105263 | 0 | 0 | 0.08246 | 0.007097 | 0.017544 | 0 | 0 | 0 | 0.491228 | 1 | 0.052632 | false | 0 | 0.052632 | 0 | 0.105263 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
8c6dfa8e7650cca218f10ad2519c965b351b6e94 | 688 | py | Python | tflite/BuiltinOperator.py | erezinman/tflite-flatbuffer-explorer | 0fe1828b80108de3b6b7075de6a66162dfd0d322 | [
"MIT"
] | null | null | null | tflite/BuiltinOperator.py | erezinman/tflite-flatbuffer-explorer | 0fe1828b80108de3b6b7075de6a66162dfd0d322 | [
"MIT"
] | null | null | null | tflite/BuiltinOperator.py | erezinman/tflite-flatbuffer-explorer | 0fe1828b80108de3b6b7075de6a66162dfd0d322 | [
"MIT"
] | null | null | null | # automatically generated by the FlatBuffers compiler, do not modify
# namespace: tflite
class BuiltinOperator(object):
ADD = 0
AVERAGE_POOL_2D = 1
CONCATENATION = 2
CONV_2D = 3
DEPTHWISE_CONV_2D = 4
EMBEDDING_LOOKUP = 7
FULLY_CONNECTED = 9
HASHTABLE_LOOKUP = 10
L2_NORMALIZATION = 11
L2_POOL_2D = 12
LOCAL_RESPONSE_NORMALIZATION = 13
LOGISTIC = 14
LSH_PROJECTION = 15
LSTM = 16
MAX_POOL_2D = 17
RELU = 19
RELU6 = 21
RESHAPE = 22
RESIZE_BILINEAR = 23
RNN = 24
SOFTMAX = 25
SPACE_TO_DEPTH = 26
SVDF = 27
TANH = 28
CONCAT_EMBEDDINGS = 29
SKIP_GRAM = 30
CALL = 31
CUSTOM = 32
| 19.657143 | 68 | 0.638081 | 91 | 688 | 4.593407 | 0.89011 | 0.043062 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.120253 | 0.311047 | 688 | 34 | 69 | 20.235294 | 0.761603 | 0.122093 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 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 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
8c71904ebd9c63564cf8de7ecdb8f509752b6a40 | 703 | py | Python | parser/team27/G-27/execution/symbol/table.py | Lenin201/tytus | cace7587b0274ceb26327b583201493bd1048b96 | [
"MIT"
] | 1 | 2021-01-09T05:32:35.000Z | 2021-01-09T05:32:35.000Z | parser/team27/G-27/execution/symbol/table.py | XiomRB/tytus | 0873e4bdce5c110bee6ef2aa98240be6a93ae024 | [
"MIT"
] | null | null | null | parser/team27/G-27/execution/symbol/table.py | XiomRB/tytus | 0873e4bdce5c110bee6ef2aa98240be6a93ae024 | [
"MIT"
] | null | null | null | class Table(object):
def __init__(self, name):
self.name = name
self.columns = []
def createColumn(self, column):
self.columns.append(column)
def readColumn(self, name):
for value in self.columns:
if value.name == name:
return value
def updateColumn(self, name, column):
for i in range(0,len(self.columns)):
if self.columns[i].name == name:
self.columns[i] = column
break
def deleteColumn(self, name):
for i in range(0, len(self.columns)):
if self.columns[i].name == name:
del self.columns[i]
break
| 28.12 | 45 | 0.519203 | 82 | 703 | 4.402439 | 0.304878 | 0.274238 | 0.132964 | 0.105263 | 0.265928 | 0.265928 | 0.265928 | 0.265928 | 0.265928 | 0.265928 | 0 | 0.004545 | 0.374111 | 703 | 24 | 46 | 29.291667 | 0.815909 | 0 | 0 | 0.3 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0 | 0 | 0.35 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
8c78b4076ac285387691eaefdc4b2dc0c790be8d | 1,191 | py | Python | app/core/models.py | 108806/drf_adv_test | fe4363e47e65de883fabd551aaf18ca5ff7bee1d | [
"BSD-2-Clause"
] | null | null | null | app/core/models.py | 108806/drf_adv_test | fe4363e47e65de883fabd551aaf18ca5ff7bee1d | [
"BSD-2-Clause"
] | null | null | null | app/core/models.py | 108806/drf_adv_test | fe4363e47e65de883fabd551aaf18ca5ff7bee1d | [
"BSD-2-Clause"
] | null | null | null | from django.db import models
from django.contrib.auth.models import AbstractBaseUser, BaseUserManager, \
PermissionsMixin
class UserManager(BaseUserManager):
def create_user(self, email, password=None, **extra_fields):
"""Creates and saves a new user"""
if not email: raise ValueError('No valid email provided')
user = self.model(email=self.normalize_email(email), **extra_fields)
user.set_password(password)
user.save(using=self._db)
return user
def create_superuser(self, email, password):
"""Creates and saves a new superuser"""
user = self.create_user(email, password)
user.is_staff = True
user.is_superuser = True
user.save(using=self._db)
return user
class User(AbstractBaseUser, PermissionsMixin):
"""Custom user model that supports using email instead of username"""
email = models.EmailField(max_length=255, unique=True)
name = models.CharField(max_length=255)
is_active = models.BooleanField(default=True)
is_staff = models.BooleanField(default=False)
objects = UserManager()
USERNAME_FIELD = 'email'
class TestUser(models.Model):
"""Delme asap"""
field = models.EmailField(max_length=255, unique=True)
| 29.775 | 75 | 0.739715 | 154 | 1,191 | 5.61039 | 0.422078 | 0.027778 | 0.041667 | 0.037037 | 0.199074 | 0.155093 | 0.155093 | 0 | 0 | 0 | 0 | 0.008911 | 0.151973 | 1,191 | 39 | 76 | 30.538462 | 0.846535 | 0.115029 | 0 | 0.16 | 0 | 0 | 0.027132 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.08 | false | 0.16 | 0.08 | 0 | 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 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 2 |
8c8302aacd848814b28c80f3cb7d246d2c41919a | 222 | py | Python | pysge/utils.py | shane-breeze/pysge | 7c8d7f8df5ca7c09c529b01134a0e789a2ba2cbe | [
"MIT"
] | null | null | null | pysge/utils.py | shane-breeze/pysge | 7c8d7f8df5ca7c09c529b01134a0e789a2ba2cbe | [
"MIT"
] | null | null | null | pysge/utils.py | shane-breeze/pysge | 7c8d7f8df5ca7c09c529b01134a0e789a2ba2cbe | [
"MIT"
] | null | null | null | try:
import subprocess32 as sp
except ModuleNotFoundError:
import subprocess as sp
import shlex
def run_command(cmd):
p = sp.run(shlex.split(cmd), stdout=sp.PIPE, stderr=sp.PIPE)
return p.stdout, p.stderr
| 22.2 | 64 | 0.725225 | 34 | 222 | 4.705882 | 0.558824 | 0.05 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.010989 | 0.18018 | 222 | 9 | 65 | 24.666667 | 0.868132 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0 | 0.375 | 0 | 0.625 | 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 | 0 | 0 | 0 | 2 |
8c860bdb685621ac68461a5e8c8c00340c6b1c45 | 435 | py | Python | tests/test_inchi.py | ginkgobioworks/pychemy | e2da05ff5815aae1465407b4d434afb66117e8da | [
"MIT"
] | 3 | 2016-12-18T20:19:51.000Z | 2020-10-20T01:49:39.000Z | tests/test_inchi.py | ginkgobioworks/pychemy | e2da05ff5815aae1465407b4d434afb66117e8da | [
"MIT"
] | null | null | null | tests/test_inchi.py | ginkgobioworks/pychemy | e2da05ff5815aae1465407b4d434afb66117e8da | [
"MIT"
] | 1 | 2020-03-29T22:55:46.000Z | 2020-03-29T22:55:46.000Z | from __future__ import print_function
import unittest
import six
from pychemy.inchi import InChI
class InchiTest(unittest.TestCase):
def test_unicode_inchi(self):
inchi_str = six.u('InChI=1S/C14H18O8/c1-20-9-4-7(5-15)2-3-8(9)21-14-13(19)12(18)11(17)10(6-16)22-14/h2-5,10-14,16-19H,6H2,1H3/t10-,11-,12+,13-,14-/m1/s1')
inchi = InChI(inchi_str)
formula = inchi.formula
self.assertEqual(formula.formula, 'C14H18O8')
| 29 | 158 | 0.721839 | 81 | 435 | 3.765432 | 0.62963 | 0.052459 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.194301 | 0.112644 | 435 | 14 | 159 | 31.071429 | 0.595855 | 0 | 0 | 0 | 0 | 0.1 | 0.324138 | 0.305747 | 0 | 0 | 0 | 0 | 0.1 | 1 | 0.1 | false | 0 | 0.4 | 0 | 0.6 | 0.1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
8c8a4300c28e34f4930ae2443042159fc3f83514 | 753 | py | Python | experimental_code/integratedAltAz/keplerianToCartesianOrbital.py | rex-mcall/EST_Internship_2021 | e2281925c0410e10cf779f8da37d2cf0b58c893a | [
"MIT"
] | null | null | null | experimental_code/integratedAltAz/keplerianToCartesianOrbital.py | rex-mcall/EST_Internship_2021 | e2281925c0410e10cf779f8da37d2cf0b58c893a | [
"MIT"
] | null | null | null | experimental_code/integratedAltAz/keplerianToCartesianOrbital.py | rex-mcall/EST_Internship_2021 | e2281925c0410e10cf779f8da37d2cf0b58c893a | [
"MIT"
] | null | null | null | from tletools import TLE
import matplotlib.pyplot as plt
import numpy as np
import math
from math import *
import sys
import datetime as dt
import tleToKeplerianElements as ttke
# uses TLE to return the current distance of the satellite to the focus
def distanceToCentralBody(tle, curr_trueA):
lan, argp, inc, ecc, n, M, a, E, v = ttke.tleToKepler(tle)
eccA = atan2(sqrt(1 - ecc ** 2) * sin(curr_trueA), ecc + cos(curr_trueA))
eccA = eccA % (2 * pi)
r = a * (1 - ecc * cos(eccA))
return r
# calculates the orbital plane cartesian coordinates for one point in time
def getOrbitalCartesianCoords(tle, curr_trueA):
r = distanceToCentralBody(tle, curr_trueA)
x = r * cos(curr_trueA)
y = r * sin(curr_trueA)
return x, y | 31.375 | 77 | 0.706507 | 117 | 753 | 4.487179 | 0.521368 | 0.12 | 0.068571 | 0.125714 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.008375 | 0.207171 | 753 | 24 | 78 | 31.375 | 0.871022 | 0.188579 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.105263 | false | 0 | 0.421053 | 0 | 0.631579 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
8ca80fec6941295983f63bed7954d4de64aa4bfb | 208 | py | Python | csrf/api/v1/urls.py | CredoEducation/edx-drf-extensions | 853fb5ec6392d57693008e1a1c1620b79cb8343b | [
"Apache-2.0"
] | 13 | 2016-08-26T15:33:05.000Z | 2020-12-20T19:12:34.000Z | csrf/api/v1/urls.py | CredoEducation/edx-drf-extensions | 853fb5ec6392d57693008e1a1c1620b79cb8343b | [
"Apache-2.0"
] | 74 | 2016-03-11T21:42:14.000Z | 2021-10-04T05:41:12.000Z | csrf/api/v1/urls.py | CredoEducation/edx-drf-extensions | 853fb5ec6392d57693008e1a1c1620b79cb8343b | [
"Apache-2.0"
] | 13 | 2016-11-21T06:34:17.000Z | 2021-09-07T08:34:28.000Z | """
URL definitions for version 1 of the CSRF API.
"""
from django.conf.urls import url
from .views import CsrfTokenView
urlpatterns = [
url(r'^token$', CsrfTokenView.as_view(), name='csrf_token'),
]
| 16 | 64 | 0.701923 | 29 | 208 | 4.965517 | 0.758621 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005747 | 0.163462 | 208 | 12 | 65 | 17.333333 | 0.821839 | 0.221154 | 0 | 0 | 0 | 0 | 0.11039 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 0.4 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
8ca83fa54e7394d645fa820ab6dd850bff3aac1f | 832 | py | Python | bokeh/protocol/messages/ok.py | kinghows/bokeh | aeb7abc1dbe2b67ce0f4422838a96fb8362c52c7 | [
"BSD-3-Clause"
] | 4 | 2018-06-03T14:08:15.000Z | 2020-09-09T01:56:29.000Z | bokeh/protocol/messages/ok.py | kinghows/bokeh | aeb7abc1dbe2b67ce0f4422838a96fb8362c52c7 | [
"BSD-3-Clause"
] | 1 | 2021-05-09T02:45:17.000Z | 2021-05-09T02:45:17.000Z | bokeh/protocol/messages/ok.py | kinghows/bokeh | aeb7abc1dbe2b67ce0f4422838a96fb8362c52c7 | [
"BSD-3-Clause"
] | 3 | 2020-04-28T17:47:50.000Z | 2021-04-05T06:11:46.000Z | from __future__ import absolute_import
import logging
log = logging.getLogger(__name__)
from ..message import Message
from . import register
@register
class ok_1(Message):
''' Define the ``OK`` message (revision 1) for acknowledging successful
handling of a previous message.
The ``content`` fragment of for this message is empty.
'''
msgtype = 'OK'
revision = 1
@classmethod
def create(cls, request_id, **metadata):
''' Create an ``OK`` message
Args:
request_id (str) :
The message ID for the message the precipitated the OK.
Any additional keyword arguments will be put into the message
``metadata`` fragment as-is.
'''
header = cls.create_header(request_id=request_id)
return cls(header, metadata, {})
| 23.771429 | 75 | 0.644231 | 101 | 832 | 5.158416 | 0.504951 | 0.069098 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004926 | 0.268029 | 832 | 34 | 76 | 24.470588 | 0.850575 | 0.439904 | 0 | 0 | 0 | 0 | 0.005141 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.076923 | 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 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
8cadc9a1ef987de2247466e14b6dcd5f4aa056a1 | 220 | py | Python | src/utils/pythonSrc/watchFaceParser/elements/weatherElements/icon.py | chm-dev/amazfitGTSwatchfaceBundle | 4cb04be5215de16628418e9b38152a35d5372d3e | [
"MIT"
] | 49 | 2019-12-18T11:24:56.000Z | 2022-03-28T09:56:27.000Z | src/utils/pythonSrc/watchFaceParser/elements/weatherElements/icon.py | chm-dev/amazfitGTSwatchfaceBundle | 4cb04be5215de16628418e9b38152a35d5372d3e | [
"MIT"
] | 6 | 2020-01-08T21:31:15.000Z | 2022-03-25T19:13:26.000Z | src/utils/pythonSrc/watchFaceParser/elements/weatherElements/icon.py | chm-dev/amazfitGTSwatchfaceBundle | 4cb04be5215de16628418e9b38152a35d5372d3e | [
"MIT"
] | 6 | 2019-12-27T17:30:24.000Z | 2021-09-30T08:11:01.000Z | from watchFaceParser.elements.basicElements.imageSet import ImageSet
class Icon:
definitions = {
1: { 'Name': 'Images', 'Type': ImageSet},
2: { 'Name': 'NoWeatherImageIndex', 'Type': 'long'},
}
| 24.444444 | 68 | 0.622727 | 20 | 220 | 6.85 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.011628 | 0.218182 | 220 | 8 | 69 | 27.5 | 0.784884 | 0 | 0 | 0 | 0 | 0 | 0.205479 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.166667 | 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 | 0 | 0 | 0 | 0 | 0 | 2 |
8cae7ac8e5d8109409bea3d890ec721d39341abb | 905 | py | Python | netbox/dcim/migrations/0133_port_colors.py | TheFlyingCorpse/netbox | a226f06b1beb575011d783b202d76cb74d3b1f79 | [
"Apache-2.0"
] | 4,994 | 2019-07-01T13:15:44.000Z | 2022-03-31T19:55:45.000Z | netbox/dcim/migrations/0133_port_colors.py | TheFlyingCorpse/netbox | a226f06b1beb575011d783b202d76cb74d3b1f79 | [
"Apache-2.0"
] | 4,045 | 2019-07-01T14:24:09.000Z | 2022-03-31T16:07:39.000Z | netbox/dcim/migrations/0133_port_colors.py | TheFlyingCorpse/netbox | a226f06b1beb575011d783b202d76cb74d3b1f79 | [
"Apache-2.0"
] | 1,225 | 2019-07-01T15:34:03.000Z | 2022-03-31T16:47:09.000Z | from django.db import migrations
import utilities.fields
class Migration(migrations.Migration):
dependencies = [
('dcim', '0132_cable_length'),
]
operations = [
migrations.AddField(
model_name='frontport',
name='color',
field=utilities.fields.ColorField(blank=True, max_length=6),
),
migrations.AddField(
model_name='frontporttemplate',
name='color',
field=utilities.fields.ColorField(blank=True, max_length=6),
),
migrations.AddField(
model_name='rearport',
name='color',
field=utilities.fields.ColorField(blank=True, max_length=6),
),
migrations.AddField(
model_name='rearporttemplate',
name='color',
field=utilities.fields.ColorField(blank=True, max_length=6),
),
]
| 27.424242 | 72 | 0.577901 | 82 | 905 | 6.256098 | 0.353659 | 0.146199 | 0.179337 | 0.210526 | 0.610136 | 0.610136 | 0.610136 | 0.610136 | 0.610136 | 0.610136 | 0 | 0.012759 | 0.307182 | 905 | 32 | 73 | 28.28125 | 0.805423 | 0 | 0 | 0.571429 | 0 | 0 | 0.100552 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.071429 | 0 | 0.178571 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
8cca8d879ebb48981faec1a262d979d1e0c2e298 | 13,639 | py | Python | py_src/mlpiot/proto/scene_description_pb2.py | machine2learn/mlpiot.base | da0b77fccbb0e42d1ddbb6dbc490313433dc7575 | [
"Apache-2.0"
] | 1 | 2021-03-30T20:49:54.000Z | 2021-03-30T20:49:54.000Z | py_src/mlpiot/proto/scene_description_pb2.py | machine2learn/mlpiot.base | da0b77fccbb0e42d1ddbb6dbc490313433dc7575 | [
"Apache-2.0"
] | null | null | null | py_src/mlpiot/proto/scene_description_pb2.py | machine2learn/mlpiot.base | da0b77fccbb0e42d1ddbb6dbc490313433dc7575 | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: mlpiot/proto/scene_description.proto
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
from mlpiot.proto import google_color_pb2 as mlpiot_dot_proto_dot_google__color__pb2
from mlpiot.proto import google_geometry_pb2 as mlpiot_dot_proto_dot_google__geometry__pb2
from mlpiot.proto import google_timestamp_pb2 as mlpiot_dot_proto_dot_google__timestamp__pb2
from mlpiot.proto import image_pb2 as mlpiot_dot_proto_dot_image__pb2
DESCRIPTOR = _descriptor.FileDescriptor(
name='mlpiot/proto/scene_description.proto',
package='mlpiot.proto',
syntax='proto3',
serialized_options=None,
serialized_pb=b'\n$mlpiot/proto/scene_description.proto\x12\x0cmlpiot.proto\x1a\x1fmlpiot/proto/google_color.proto\x1a\"mlpiot/proto/google_geometry.proto\x1a#mlpiot/proto/google_timestamp.proto\x1a\x18mlpiot/proto/image.proto\"I\n\x17SceneDescriptorMetadata\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0f\n\x07version\x18\x02 \x01(\x05\x12\x0f\n\x07payload\x18\x03 \x01(\t\"\xc5\x01\n\rObjectInScene\x12\x12\n\nclass_name\x18\x01 \x01(\t\x12\x16\n\x0e\x63lass_icon_url\x18\x02 \x01(\t\x12\x30\n\x0c\x62ounding_box\x18\x03 \x01(\x0b\x32\x1a.mlpiot.proto.BoundingPoly\x12\x12\n\nconfidence\x18\x04 \x01(\x02\x12\r\n\x05score\x18\x05 \x01(\x02\x12\"\n\x05\x63olor\x18\x06 \x01(\x0b\x32\x13.mlpiot.proto.Color\x12\x0f\n\x07payload\x18\x07 \x01(\t\"\xeb\x01\n\x10SceneDescription\x12*\n\ttimestamp\x18\x01 \x01(\x0b\x32\x17.mlpiot.proto.Timestamp\x12\x37\n\x08metadata\x18\x02 \x01(\x0b\x32%.mlpiot.proto.SceneDescriptorMetadata\x12,\n\x07objects\x18\x03 \x03(\x0b\x32\x1b.mlpiot.proto.ObjectInScene\x12,\n\x0f\x61nnotated_image\x18\x04 \x01(\x0b\x32\x13.mlpiot.proto.Image\x12\x16\n\x0einput_image_id\x18\x05 \x01(\x03\"\xad\x01\n\x15SceneDescriptionArray\x12*\n\ttimestamp\x18\x01 \x01(\x0b\x32\x17.mlpiot.proto.Timestamp\x12\x37\n\x08metadata\x18\x02 \x01(\x0b\x32%.mlpiot.proto.SceneDescriptorMetadata\x12/\n\x07objects\x18\x03 \x03(\x0b\x32\x1e.mlpiot.proto.SceneDescriptionb\x06proto3'
,
dependencies=[mlpiot_dot_proto_dot_google__color__pb2.DESCRIPTOR,mlpiot_dot_proto_dot_google__geometry__pb2.DESCRIPTOR,mlpiot_dot_proto_dot_google__timestamp__pb2.DESCRIPTOR,mlpiot_dot_proto_dot_image__pb2.DESCRIPTOR,])
_SCENEDESCRIPTORMETADATA = _descriptor.Descriptor(
name='SceneDescriptorMetadata',
full_name='mlpiot.proto.SceneDescriptorMetadata',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='name', full_name='mlpiot.proto.SceneDescriptorMetadata.name', index=0,
number=1, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='version', full_name='mlpiot.proto.SceneDescriptorMetadata.version', index=1,
number=2, type=5, cpp_type=1, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='payload', full_name='mlpiot.proto.SceneDescriptorMetadata.payload', index=2,
number=3, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=186,
serialized_end=259,
)
_OBJECTINSCENE = _descriptor.Descriptor(
name='ObjectInScene',
full_name='mlpiot.proto.ObjectInScene',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='class_name', full_name='mlpiot.proto.ObjectInScene.class_name', index=0,
number=1, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='class_icon_url', full_name='mlpiot.proto.ObjectInScene.class_icon_url', index=1,
number=2, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='bounding_box', full_name='mlpiot.proto.ObjectInScene.bounding_box', index=2,
number=3, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='confidence', full_name='mlpiot.proto.ObjectInScene.confidence', index=3,
number=4, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='score', full_name='mlpiot.proto.ObjectInScene.score', index=4,
number=5, type=2, cpp_type=6, label=1,
has_default_value=False, default_value=float(0),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='color', full_name='mlpiot.proto.ObjectInScene.color', index=5,
number=6, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='payload', full_name='mlpiot.proto.ObjectInScene.payload', index=6,
number=7, type=9, cpp_type=9, label=1,
has_default_value=False, default_value=b"".decode('utf-8'),
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=262,
serialized_end=459,
)
_SCENEDESCRIPTION = _descriptor.Descriptor(
name='SceneDescription',
full_name='mlpiot.proto.SceneDescription',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='timestamp', full_name='mlpiot.proto.SceneDescription.timestamp', index=0,
number=1, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='metadata', full_name='mlpiot.proto.SceneDescription.metadata', index=1,
number=2, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='objects', full_name='mlpiot.proto.SceneDescription.objects', index=2,
number=3, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='annotated_image', full_name='mlpiot.proto.SceneDescription.annotated_image', index=3,
number=4, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='input_image_id', full_name='mlpiot.proto.SceneDescription.input_image_id', index=4,
number=5, type=3, cpp_type=2, label=1,
has_default_value=False, default_value=0,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=462,
serialized_end=697,
)
_SCENEDESCRIPTIONARRAY = _descriptor.Descriptor(
name='SceneDescriptionArray',
full_name='mlpiot.proto.SceneDescriptionArray',
filename=None,
file=DESCRIPTOR,
containing_type=None,
fields=[
_descriptor.FieldDescriptor(
name='timestamp', full_name='mlpiot.proto.SceneDescriptionArray.timestamp', index=0,
number=1, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='metadata', full_name='mlpiot.proto.SceneDescriptionArray.metadata', index=1,
number=2, type=11, cpp_type=10, label=1,
has_default_value=False, default_value=None,
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
_descriptor.FieldDescriptor(
name='objects', full_name='mlpiot.proto.SceneDescriptionArray.objects', index=2,
number=3, type=11, cpp_type=10, label=3,
has_default_value=False, default_value=[],
message_type=None, enum_type=None, containing_type=None,
is_extension=False, extension_scope=None,
serialized_options=None, file=DESCRIPTOR),
],
extensions=[
],
nested_types=[],
enum_types=[
],
serialized_options=None,
is_extendable=False,
syntax='proto3',
extension_ranges=[],
oneofs=[
],
serialized_start=700,
serialized_end=873,
)
_OBJECTINSCENE.fields_by_name['bounding_box'].message_type = mlpiot_dot_proto_dot_google__geometry__pb2._BOUNDINGPOLY
_OBJECTINSCENE.fields_by_name['color'].message_type = mlpiot_dot_proto_dot_google__color__pb2._COLOR
_SCENEDESCRIPTION.fields_by_name['timestamp'].message_type = mlpiot_dot_proto_dot_google__timestamp__pb2._TIMESTAMP
_SCENEDESCRIPTION.fields_by_name['metadata'].message_type = _SCENEDESCRIPTORMETADATA
_SCENEDESCRIPTION.fields_by_name['objects'].message_type = _OBJECTINSCENE
_SCENEDESCRIPTION.fields_by_name['annotated_image'].message_type = mlpiot_dot_proto_dot_image__pb2._IMAGE
_SCENEDESCRIPTIONARRAY.fields_by_name['timestamp'].message_type = mlpiot_dot_proto_dot_google__timestamp__pb2._TIMESTAMP
_SCENEDESCRIPTIONARRAY.fields_by_name['metadata'].message_type = _SCENEDESCRIPTORMETADATA
_SCENEDESCRIPTIONARRAY.fields_by_name['objects'].message_type = _SCENEDESCRIPTION
DESCRIPTOR.message_types_by_name['SceneDescriptorMetadata'] = _SCENEDESCRIPTORMETADATA
DESCRIPTOR.message_types_by_name['ObjectInScene'] = _OBJECTINSCENE
DESCRIPTOR.message_types_by_name['SceneDescription'] = _SCENEDESCRIPTION
DESCRIPTOR.message_types_by_name['SceneDescriptionArray'] = _SCENEDESCRIPTIONARRAY
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
SceneDescriptorMetadata = _reflection.GeneratedProtocolMessageType('SceneDescriptorMetadata', (_message.Message,), {
'DESCRIPTOR' : _SCENEDESCRIPTORMETADATA,
'__module__' : 'mlpiot.proto.scene_description_pb2'
# @@protoc_insertion_point(class_scope:mlpiot.proto.SceneDescriptorMetadata)
})
_sym_db.RegisterMessage(SceneDescriptorMetadata)
ObjectInScene = _reflection.GeneratedProtocolMessageType('ObjectInScene', (_message.Message,), {
'DESCRIPTOR' : _OBJECTINSCENE,
'__module__' : 'mlpiot.proto.scene_description_pb2'
# @@protoc_insertion_point(class_scope:mlpiot.proto.ObjectInScene)
})
_sym_db.RegisterMessage(ObjectInScene)
SceneDescription = _reflection.GeneratedProtocolMessageType('SceneDescription', (_message.Message,), {
'DESCRIPTOR' : _SCENEDESCRIPTION,
'__module__' : 'mlpiot.proto.scene_description_pb2'
# @@protoc_insertion_point(class_scope:mlpiot.proto.SceneDescription)
})
_sym_db.RegisterMessage(SceneDescription)
SceneDescriptionArray = _reflection.GeneratedProtocolMessageType('SceneDescriptionArray', (_message.Message,), {
'DESCRIPTOR' : _SCENEDESCRIPTIONARRAY,
'__module__' : 'mlpiot.proto.scene_description_pb2'
# @@protoc_insertion_point(class_scope:mlpiot.proto.SceneDescriptionArray)
})
_sym_db.RegisterMessage(SceneDescriptionArray)
# @@protoc_insertion_point(module_scope)
| 45.768456 | 1,384 | 0.768311 | 1,709 | 13,639 | 5.820948 | 0.101229 | 0.046643 | 0.03468 | 0.042019 | 0.729996 | 0.629373 | 0.591878 | 0.541616 | 0.541616 | 0.541616 | 0 | 0.035909 | 0.113865 | 13,639 | 297 | 1,385 | 45.922559 | 0.787192 | 0.034973 | 0 | 0.649057 | 1 | 0.003774 | 0.226505 | 0.189249 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.030189 | 0 | 0.030189 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
8ccc7527ffc47c5ff344fbc2004901e2de010bf4 | 242 | py | Python | core/exception.py | simyy/flask_app | ec34a4e939620b2d261364b40e85f8211f8f9e9d | [
"MIT"
] | null | null | null | core/exception.py | simyy/flask_app | ec34a4e939620b2d261364b40e85f8211f8f9e9d | [
"MIT"
] | 2 | 2021-03-25T22:14:36.000Z | 2021-06-01T22:51:34.000Z | core/exception.py | simyy/flask_app | ec34a4e939620b2d261364b40e85f8211f8f9e9d | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# coding=utf-8
class BaseException(Exception):
def __init__(self, code, msg):
self.code = code
self.msg = msg
def __str__(self):
return '<%s %s>' % (self.__class__.__name__, self.code)
| 20.166667 | 63 | 0.607438 | 32 | 242 | 4.09375 | 0.59375 | 0.183206 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005464 | 0.243802 | 242 | 11 | 64 | 22 | 0.710383 | 0.136364 | 0 | 0 | 0 | 0 | 0.033816 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0 | 0.166667 | 0.666667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 2 |
8ce0ee53bb5fb1aa40bed29ff3cb17d7bb85ac52 | 524 | py | Python | trace_feature/models/simple_scenario.py | trace-features-bdd/trace_feature | e372b3188d5d77c58789afdb1e39d25e2cf84785 | [
"MIT"
] | null | null | null | trace_feature/models/simple_scenario.py | trace-features-bdd/trace_feature | e372b3188d5d77c58789afdb1e39d25e2cf84785 | [
"MIT"
] | null | null | null | trace_feature/models/simple_scenario.py | trace-features-bdd/trace_feature | e372b3188d5d77c58789afdb1e39d25e2cf84785 | [
"MIT"
] | null | null | null | from trace_feature.models.scenario import Scenario
class SimpleScenario(Scenario):
def __init__(self):
self.steps = []
self.scenario_title = ""
self.line = None
self.executed_methods = []
def execute(self):
pass
def set_line(self):
pass
def __str__(self):
print("\n Title: " + self.scenario_title)
self.print_methods()
return ""
def print_methods(self):
for method in self.executed_methods:
print(method)
| 20.153846 | 50 | 0.593511 | 58 | 524 | 5.086207 | 0.465517 | 0.091525 | 0.115254 | 0.142373 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.30916 | 524 | 25 | 51 | 20.96 | 0.814917 | 0 | 0 | 0.111111 | 0 | 0 | 0.019084 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.277778 | false | 0.111111 | 0.055556 | 0 | 0.444444 | 0.222222 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
8cf3894e77f3b424b8d63437a58e95928dde4ed7 | 652 | py | Python | src/280. Wiggle Sort.py | rajshrivastava/LeetCode | dfe6342fe22b324429b0be3e5c0fef46c7e6b3b0 | [
"MIT"
] | 1 | 2019-12-16T08:18:25.000Z | 2019-12-16T08:18:25.000Z | src/280. Wiggle Sort.py | rajshrivastava/LeetCode | dfe6342fe22b324429b0be3e5c0fef46c7e6b3b0 | [
"MIT"
] | null | null | null | src/280. Wiggle Sort.py | rajshrivastava/LeetCode | dfe6342fe22b324429b0be3e5c0fef46c7e6b3b0 | [
"MIT"
] | null | null | null | class Solution:
def wiggleSort(self, nums: List[int]) -> None:
"""
Do not return anything, modify nums in-place instead.
"""
'''
[3,5,2,1,6,4]
[3,5,1,6,2,4]
[4,3,2,1]
[3,4,2,1]
[6,6,5,6,3,8]
'''
def is_correct_order(x, y, isAscending):
return x <= y if isAscending else x >= y
isAscending = True
for i in range(1, len(nums)):
if not is_correct_order(nums[i-1], nums[i], isAscending):
nums[i-1], nums[i] = nums[i], nums[i-1]
isAscending = not isAscending
| 27.166667 | 69 | 0.455521 | 92 | 652 | 3.184783 | 0.402174 | 0.102389 | 0.061433 | 0.068259 | 0.075085 | 0 | 0 | 0 | 0 | 0 | 0 | 0.076336 | 0.397239 | 652 | 23 | 70 | 28.347826 | 0.669211 | 0.081288 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | false | 0 | 0 | 0.111111 | 0.444444 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 2 |
8cf86bfb6eec122aaf737782baf668c53d57edad | 363 | py | Python | Task1E.py | dan7267/1a-flood-risk-project-93 | d95cee987f5673d637626e1804f719371a25daa8 | [
"MIT"
] | null | null | null | Task1E.py | dan7267/1a-flood-risk-project-93 | d95cee987f5673d637626e1804f719371a25daa8 | [
"MIT"
] | null | null | null | Task1E.py | dan7267/1a-flood-risk-project-93 | d95cee987f5673d637626e1804f719371a25daa8 | [
"MIT"
] | null | null | null | from floodsystem.stationdata import MonitoringStation
from floodsystem.geo import rivers_by_station_number
def run():
"""Requirements for Task1E"""
rivers_station_number = rivers_by_station_number(MonitoringStation, 9)
print(rivers_station_number)
if __name__ == "__main__":
print("*** Task 1E: CUED Part IA Flood Warning System ***")
run() | 30.25 | 74 | 0.752066 | 44 | 363 | 5.795455 | 0.636364 | 0.203922 | 0.117647 | 0.164706 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.00974 | 0.151515 | 363 | 12 | 75 | 30.25 | 0.818182 | 0.063361 | 0 | 0 | 0 | 0 | 0.173134 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0 | 0.25 | 0 | 0.375 | 0.25 | 0 | 0 | 0 | null | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
8cf8d6f44600fb995dd1f41219e9e6510db6f3d8 | 998 | py | Python | test/test_util.py | konfiger/konfiger-python | 294fb2fed8a46f7e242825fc0b723b0ff7132c8c | [
"MIT"
] | 4 | 2019-09-25T02:18:43.000Z | 2020-01-21T19:16:05.000Z | test/test_util.py | keyvaluedb/key-value-db-python | 294fb2fed8a46f7e242825fc0b723b0ff7132c8c | [
"MIT"
] | null | null | null | test/test_util.py | keyvaluedb/key-value-db-python | 294fb2fed8a46f7e242825fc0b723b0ff7132c8c | [
"MIT"
] | null | null | null | #!python
import unittest
import os
import sys
sys.path.insert(0, os.getcwd())
from src import escape_string, un_escape_string
class TestKonfigerUtil(unittest.TestCase):
def test_check_escape_and_unescape_separator(self):
actual_str = "\\,Hello¬W\n-\t-\torld"
t1 = escape_string(actual_str, '¬')
t2 = un_escape_string(actual_str)
self.assertNotEqual(actual_str, t1)
self.assertEqual(t1, "\\,Hello^¬W\n-\t-\torld")
self.assertNotEqual(t1, un_escape_string(t1, '¬'))
self.assertNotEqual(actual_str, un_escape_string(t1))
self.assertEqual(un_escape_string(t1, '¬'), actual_str)
self.assertNotEqual(t1, t2)
self.assertEqual(t2, "\\,Hello¬W\n-\t-\torld")
self.assertNotEqual(t2, un_escape_string(t1))
self.assertEqual(actual_str, un_escape_string(t2))
self.assertEqual(un_escape_string(t1, '¬'), actual_str)
if __name__ == '__main__':
unittest.main()
| 33.266667 | 64 | 0.655311 | 134 | 998 | 4.641791 | 0.291045 | 0.192926 | 0.180064 | 0.128617 | 0.411576 | 0.332797 | 0.234727 | 0.234727 | 0.131833 | 0 | 0 | 0.020279 | 0.209419 | 998 | 29 | 65 | 34.413793 | 0.759189 | 0.007014 | 0 | 0.090909 | 0 | 0 | 0.079798 | 0.067677 | 0 | 0 | 0 | 0 | 0.454545 | 1 | 0.045455 | false | 0 | 0.181818 | 0 | 0.272727 | 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 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
8cfdf25e9a8b70f9400ed44ee8c791ade7d45ab5 | 1,117 | py | Python | farnsworth/peewee_extensions.py | mechaphish/farnsworth | 7d6bcbd94ab5ab521c29309fe3c47a0f6005a5d3 | [
"BSD-2-Clause"
] | 6 | 2016-08-20T23:39:42.000Z | 2020-11-06T23:08:03.000Z | farnsworth/peewee_extensions.py | mechaphish/farnsworth | 7d6bcbd94ab5ab521c29309fe3c47a0f6005a5d3 | [
"BSD-2-Clause"
] | null | null | null | farnsworth/peewee_extensions.py | mechaphish/farnsworth | 7d6bcbd94ab5ab521c29309fe3c47a0f6005a5d3 | [
"BSD-2-Clause"
] | 5 | 2016-08-21T13:16:00.000Z | 2020-11-06T23:08:17.000Z | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from peewee import Field, SQL
import itertools
"""Extend Peewee basic types."""
class EnumField(Field):
"""Define a EnumField type"""
db_field = "enum"
def __init__(self, *args, **kwargs):
self.enum_name = kwargs.pop('enum_name')
super(self.__class__, self).__init__(*args, **kwargs)
def pre_field_create(self, model):
cursor = self.get_database().get_conn().cursor()
cursor.execute("DROP TYPE IF EXISTS {};".format(self.enum_name))
choices_str = ", ".join(itertools.repeat("%s", len(self.choices)))
query = "CREATE TYPE {} AS ENUM ({});".format(self.enum_name, choices_str)
cursor.execute(query, self.choices)
self.db_field = self.enum_name
def coerce(self, value):
if value not in self.choices:
raise Exception("Invalid Enum Value `%s`", value)
return str(value)
def get_column_type(self):
return "enum"
def __ddl_column__(self, ctype):
return SQL(self.enum_name)
| 28.641026 | 82 | 0.642793 | 145 | 1,117 | 4.682759 | 0.455172 | 0.070692 | 0.088365 | 0.053019 | 0.082474 | 0.082474 | 0 | 0 | 0 | 0 | 0 | 0.002291 | 0.218442 | 1,117 | 38 | 83 | 29.394737 | 0.775487 | 0.059982 | 0 | 0 | 0 | 0 | 0.093966 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.217391 | false | 0 | 0.130435 | 0.086957 | 0.565217 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
507554c410c6294385578ca1eb9a80f4ffa123e6 | 683 | py | Python | tests/telemetry/decorators_test.py | trevorgrayson/telemetry | efeca1b2062f40a2557f2c030dc687f546f3c60b | [
"MIT"
] | 3 | 2020-03-20T20:04:37.000Z | 2021-08-23T20:11:10.000Z | tests/telemetry/decorators_test.py | trevorgrayson/telemetry | efeca1b2062f40a2557f2c030dc687f546f3c60b | [
"MIT"
] | 2 | 2019-06-10T08:02:05.000Z | 2019-06-10T08:02:22.000Z | tests/telemetry/decorators_test.py | trevorgrayson/telemetry | efeca1b2062f40a2557f2c030dc687f546f3c60b | [
"MIT"
] | null | null | null | from pytest import raises
import telemetry
REPORT_NAME = 'some.key'
meter = telemetry.get_telemeter(__name__)
@meter.catch('some_report')
def exception_prone(ii):
return 1/ii
class TestsExcept:
def test_catch_pass(self):
assert exception_prone(2) == 0.5
def test_catch_throws(self):
with raises(ZeroDivisionError):
exception_prone(0)
@meter.runtime(REPORT_NAME)
def a_slow_function(a, b):
return a + b
class TestRuntime:
def test_constants(self):
a, b = 1, 2
result = a_slow_function(a, b)
assert result == a + b
# assert PROBE.name == REPORT_NAME
# assert PROBE.value != 0
| 18.459459 | 42 | 0.645681 | 92 | 683 | 4.565217 | 0.445652 | 0.02381 | 0.057143 | 0.066667 | 0.071429 | 0 | 0 | 0 | 0 | 0 | 0 | 0.015779 | 0.257687 | 683 | 36 | 43 | 18.972222 | 0.812623 | 0.081991 | 0 | 0 | 0 | 0 | 0.030449 | 0 | 0 | 0 | 0 | 0 | 0.095238 | 1 | 0.238095 | false | 0.047619 | 0.095238 | 0.095238 | 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 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
5078d56ccc790f70f1e43a28737794a0f83dfcac | 1,022 | py | Python | creel_portal/api/filters/FN125Tag_Filter.py | AdamCottrill/CreelPortal | 5ec867c4f11b4231c112e8209116b6b96c2830ec | [
"MIT"
] | null | null | null | creel_portal/api/filters/FN125Tag_Filter.py | AdamCottrill/CreelPortal | 5ec867c4f11b4231c112e8209116b6b96c2830ec | [
"MIT"
] | null | null | null | creel_portal/api/filters/FN125Tag_Filter.py | AdamCottrill/CreelPortal | 5ec867c4f11b4231c112e8209116b6b96c2830ec | [
"MIT"
] | null | null | null | import django_filters
from .filter_utils import ValueInFilter
from ...models import FN125_Tag
from .FishAttr_Filter import FishAttrFilters
class FN125TagFilter(FishAttrFilters):
"""A filter set class for lamprey data. Inherits all of the filters in
FishAttrs and add some that are specific to Tag attributes.
"""
tagid = ValueInFilter(field_name="tagid")
tagid__like = ValueInFilter(field_name="tagid")
tagid__not_like = ValueInFilter(field_name="tagid", exclude=True)
tagdoc = ValueInFilter(field_name="tagdoc")
tagdoc__like = ValueInFilter(field_name="tagdoc")
tagdoc__not_like = ValueInFilter(field_name="tagdoc", exclude=True)
tagstat = ValueInFilter(field_name="tagstat")
tagstat__not = ValueInFilter(field_name="tagstat", exclude=True)
# consider splitting up tagdoc into consitiuent fields to make it
# easier to filter by colour, placement tag type and agency.
class Meta:
model = FN125_Tag
fields = ["tagstat", "tagid", "tagdoc"]
| 30.969697 | 74 | 0.736791 | 126 | 1,022 | 5.777778 | 0.460317 | 0.197802 | 0.241758 | 0.142857 | 0.287088 | 0 | 0 | 0 | 0 | 0 | 0 | 0.010714 | 0.178082 | 1,022 | 32 | 75 | 31.9375 | 0.855952 | 0.245597 | 0 | 0 | 0 | 0 | 0.086093 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.875 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
5093de6bb237feb29997a009c2a055d96c61745b | 221 | py | Python | src/atc/etl/__init__.py | atc-net/atc-dataplatform | 4614efbbc9a5b2b4e063cc12211aa5c697cad115 | [
"MIT"
] | 6 | 2021-09-10T09:50:20.000Z | 2022-02-12T09:30:47.000Z | src/atc/etl/__init__.py | atc-net/atc-dataplatform | 4614efbbc9a5b2b4e063cc12211aa5c697cad115 | [
"MIT"
] | 40 | 2021-09-10T11:20:42.000Z | 2022-03-25T08:26:57.000Z | src/atc/etl/__init__.py | atc-net/atc-dataplatform | 4614efbbc9a5b2b4e063cc12211aa5c697cad115 | [
"MIT"
] | 2 | 2021-09-10T10:07:04.000Z | 2022-02-16T17:49:08.000Z | from .loader import Loader
from .extractor import Extractor
from .transformer import Transformer
from .orchestrator import Orchestrator
__all__ = [
"Loader",
"Extractor",
"Transformer",
"Orchestrator",
]
| 18.416667 | 38 | 0.728507 | 21 | 221 | 7.47619 | 0.333333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.18552 | 221 | 11 | 39 | 20.090909 | 0.872222 | 0 | 0 | 0 | 0 | 0 | 0.171946 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 0.4 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
509a3e7b6cd578f69b49591849f510331b44efb2 | 8,780 | py | Python | test/test_gg_snippets.py | ooz/ggpy | a222299c3fc23739576ae0d3dfc75362fb1152cd | [
"MIT"
] | null | null | null | test/test_gg_snippets.py | ooz/ggpy | a222299c3fc23739576ae0d3dfc75362fb1152cd | [
"MIT"
] | 2 | 2020-05-13T22:12:39.000Z | 2021-05-01T22:41:55.000Z | test/test_gg_snippets.py | ooz/ggpy | a222299c3fc23739576ae0d3dfc75362fb1152cd | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import gg
from ggconfig import config
##############################################################################
# CONTENT SNIPPETS
##############################################################################
def test_logo_url():
assert gg.logo_url(config) == 'https://oliz.io/ggpy/static/gg.png'
assert gg.logo_url() == ''
def test_pagetitle():
assert gg.pagetitle('Good Generator.py', config) == 'Good Generator.py'
assert gg.pagetitle('Some Page', config) == 'Some Page | Good Generator.py'
assert gg.pagetitle('Title with default config') == 'Title with default config'
assert gg.pagetitle('') == ''
assert gg.pagetitle() == ''
assert gg.pagetitle('', config) == 'Good Generator.py'
def test_meta():
meta = gg.meta('oz', 'Nice text!', '__draft__, foo, __inline__, bar, tags, __no_header__')
assert meta == \
'''<meta name="author" content="oz">
<meta name="description" content="Nice text!">
<meta name="keywords" content="foo, bar, tags">'''
def test_meta_single_special_tag():
meta = gg.meta('oz', 'Nice text!', '__draft__')
assert meta == \
'''<meta name="author" content="oz">
<meta name="description" content="Nice text!">'''
def test_opengraph():
opengraph = gg.opengraph('Title!', 'https://oliz.io/ggpy/', 'Nice text!', '2020-02-20', config)
assert opengraph == \
'''<meta property="og:title" content="Title!">
<meta property="og:type" content="article">
<meta property="og:url" content="https://oliz.io/ggpy/">
<meta property="og:description" content="Nice text!">
<meta property="og:image" content="https://oliz.io/ggpy/static/gg.png">
<meta property="og:locale" content="en-US">
<meta property="article:published_time" content="2020-02-20">'''
opengraph_default_config = gg.opengraph('Title!', 'https://oliz.io/ggpy/', 'Nice text!', '2020-02-20')
assert opengraph_default_config == \
'''<meta property="og:title" content="Title!">
<meta property="og:type" content="article">
<meta property="og:url" content="https://oliz.io/ggpy/">
<meta property="og:description" content="Nice text!">
<meta property="og:locale" content="en-US">
<meta property="article:published_time" content="2020-02-20">'''
def test_json_ld():
json_ld = gg.json_ld('Title! "BAM!"', 'https://oliz.io/ggpy/', 'It says "BAM!"', config)
assert json_ld == \
'''<script type="application/ld+json">
{"@context":"http://schema.org","@type":"WebSite","headline":"Title! \\"BAM!\\"","url":"https://oliz.io/ggpy/","name":"Good Generator.py","description":"It says \\"BAM!\\""}</script>'''
json_ld_default_config = gg.json_ld('Title! "BAM!"', 'https://oliz.io/ggpy/', 'It says "BAM!"')
assert json_ld_default_config == \
'''<script type="application/ld+json">
{"@context":"http://schema.org","@type":"WebSite","headline":"Title! \\"BAM!\\"","url":"https://oliz.io/ggpy/","description":"It says \\"BAM!\\""}</script>'''
def test_header():
header = gg.header('https://example.com/logo.png', '<h1>Title!</h1>', '2021-03-27', config)
assert header == \
'''<a href="https://oliz.io/ggpy"><img src="https://example.com/logo.png" class="avatar" /></a>
<div style="text-align:right;">
<h1>Title!</h1>
<small><a href="https://oliz.io/ggpy">Good Gen</a>, 2021-03-27</small>
</div>'''
header_default_config = gg.header('', '<h1>Title!</h1>', '2021-03-27')
assert header_default_config == \
'''<div style="text-align:right;">
<h1>Title!</h1>
<small>2021-03-27</small>
</div>'''
def test_post_header():
post_header = gg.post_header('<h1 id="title">Title!</h1>', '2020-02-20', config)
assert post_header == \
'''<div style="text-align:right;">
<h1 id="title">Title!</h1>
<small><a href="https://oliz.io/ggpy">Good Gen</a>, 2020-02-20</small>
</div>'''
post_header_default_config = gg.post_header('<h1 id="title">Title!</h1>', '2020-02-20')
assert post_header_default_config == \
'''<div style="text-align:right;">
<h1 id="title">Title!</h1>
<small>2020-02-20</small>
</div>'''
def test_footer_navigation():
footer_nav = gg.footer_navigation()
assert footer_nav == \
'''<a href="#" class="nav">top</a>
<a href="javascript:toggleTheme()" class="nav">🌓</a>
<a href="javascript:toggleFontSize()" class="nav">aA</a>'''
def test_about_and_social_icons():
about_and_social = gg.about_and_social_icons(config)
assert about_and_social == \
'''<a href="mailto:example@example.com" class="social">email</a>
<a href="https://nitter.net/" class="social">twitter</a>
<a href="https://github.com/ooz/ggpy" class="social">github</a>
<a href="https://oliz.io/about.html" class="social">about</a>'''
about_and_social_default_config = gg.about_and_social_icons()
assert about_and_social_default_config == ''
def test_posts_index():
'''Generate index without inlined posts.
'''
posts = gg.scan_posts(['.'])
posts = [post for post in posts if gg.TAG_INLINE not in post['tags']]
posts_index = gg.posts_index(posts)
assert posts_index == \
'''<div>
<div class="card"><small class="social">2021-04-04</small><a href="test/features/meta.html"><b>Markdown Meta Data</b></a></div>
<div class="card"><small class="social">2018-03-17</small><a href="test/some-post.html"><b>Some Post</b></a></div>
<div class="card"><small class="social">1996-06-06</small><a href="test/features/"><b>Markdown Feature Test without "quotes bug"</b></a></div>
</div>'''
def test_posts_index_inline():
'''Generate index with inlined posts.
Four cases:
1. Lots of content but not description -> details block with title as summary
2. Lots of content with description -> details block with description as summary
3. Has description but no content -> only show description
4. Else -> show content directly
'''
posts = gg.scan_posts(['test/features/index-inline-posts/'])
posts_index = gg.posts_index(posts)
assert posts_index == \
'''<div>
<div class="card"><small class="social">2021-07-17</small>
<a href="little-inline-content-no-description.html"><b>Little inline content, no description</b></a>
<div>
<p>This shows directly on the card, without details+summary blocks.</p>
</div>
</div>
<div class="card"><small class="social">2021-07-17</small>
<a href="no-content-with-description.html"><b>No content, but with description</b></a>
<div>
Just some more minor text from the description
</div>
</div>
<div class="card"><small class="social">2021-07-17</small>
<a href="lots-of-content-with-description.html"><b>Lots of content, with description</b></a>
<details><summary>Click here to expand...</summary>
<ul>
<li>One</li>
<li>Two</li>
<li>Three</li>
<li>Four</li>
<li>Five</li>
<li>Six</li>
<li>Seven</li>
<li>Eight</li>
<li>Nine</li>
<li>Ten</li>
</ul>
<p>... and some more lines.</p>
</details>
</div>
<div class="card"><small class="social">2021-07-17</small>
<details><summary><a href="lots-of-content-no-description.html"><b>Lots of content, no description</b></a></summary>
<ul>
<li>One</li>
<li>Two</li>
<li>Three</li>
<li>Four</li>
<li>Five</li>
<li>Six</li>
<li>Seven</li>
<li>Eight</li>
<li>Nine</li>
<li>Ten</li>
</ul>
<p>... and some more lines.</p>
</details>
</div>
</div>'''
##############################################################################
# HTML SNIPPETS
##############################################################################
def test_html_opening_boilerplate():
assert gg.html_opening_boilerplate() == \
'''<!DOCTYPE html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1">'''
def test_html_head_body_boilerplate():
assert gg.html_head_body_boilerplate() == \
'''</head>
<body onload="initTheme()">'''
def test_html_tag_line():
assert gg.html_tag_line('title', 'Nice!') == '<title>Nice!</title>'
def test_html_tag_block():
assert gg.html_tag_block('footer', '<p>in closing</p>') == \
'''<footer>
<p>in closing</p>
</footer>'''
def test_html_tag_empty():
link_tag = gg.html_tag_empty('link', [('rel', 'canonical'), ('href','https://example.com')])
assert link_tag == '<link rel="canonical" href="https://example.com">'
omit_empty_tag = gg.html_tag_empty('link', [])
assert omit_empty_tag == ''
def test_html_closing_boilerplate():
assert gg.html_closing_boilerplate() == \
'''</body>
</html>
'''
def test_inline_style():
style = gg.inline_style()
assert 'body {' in style
assert '.dark-mode' in style
assert '.avatar' in style
assert '.nav' in style
assert '.social' in style
def test_inline_javascript():
js = gg.inline_javascript()
assert 'function toggleTheme' in js
assert 'function initTheme' in js
| 37.20339 | 185 | 0.637813 | 1,252 | 8,780 | 4.353834 | 0.176518 | 0.025683 | 0.028252 | 0.035773 | 0.53403 | 0.434232 | 0.378279 | 0.346725 | 0.346725 | 0.316639 | 0 | 0.022686 | 0.116401 | 8,780 | 235 | 186 | 37.361702 | 0.679814 | 0.051708 | 0 | 0.074074 | 0 | 0 | 0.229857 | 0.020749 | 0 | 0 | 0 | 0 | 0.45679 | 1 | 0.246914 | false | 0 | 0.024691 | 0 | 0.271605 | 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 | 0 | 0 | 0 | 2 |
50a7e0a80d5cef9b4bb80a0f46b84c78195b8ae4 | 527 | py | Python | FaceLandmarking.LearningProcess/readers/regressor_example_reader.py | TomaszRewak/FaceLandmarking | 74bc5cbcdb61cd9835e5bfc61e978fad256940f4 | [
"MIT"
] | 78 | 2018-02-09T14:30:06.000Z | 2020-10-01T08:43:32.000Z | FaceLandmarking.LearningProcess/readers/regressor_example_reader.py | YoungerGao/Face-Landmarking | 74bc5cbcdb61cd9835e5bfc61e978fad256940f4 | [
"MIT"
] | 1 | 2019-03-20T00:16:47.000Z | 2019-03-24T09:12:25.000Z | FaceLandmarking.LearningProcess/readers/regressor_example_reader.py | YoungerGao/Face-Landmarking | 74bc5cbcdb61cd9835e5bfc61e978fad256940f4 | [
"MIT"
] | 8 | 2019-03-03T11:57:43.000Z | 2021-07-01T09:27:20.000Z | import csv
def read_regressor_examples(num_of_features, num_of_decisions, file_path):
xs = []
ys = []
with open(file_path, mode='r', encoding='utf-8') as file:
reader = csv.reader(file, delimiter=' ')
for row in reader:
x = [float(value) for value in row[0 : num_of_features]]
y = [float(value) for value in row[num_of_features : num_of_features + num_of_decisions]]
xs.append(x)
ys.append(y)
return {
'x': xs,
'y': ys
}
| 23.954545 | 101 | 0.571157 | 74 | 527 | 3.851351 | 0.459459 | 0.105263 | 0.182456 | 0.168421 | 0.396491 | 0.350877 | 0 | 0 | 0 | 0 | 0 | 0.005479 | 0.3074 | 527 | 21 | 102 | 25.095238 | 0.775342 | 0 | 0 | 0 | 0 | 0 | 0.017078 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.066667 | false | 0 | 0.066667 | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
50b2c8b6eb4eb1e401d69a4ec9a24c73d1dd8ed4 | 220 | py | Python | Exercices/Secao04/exercicio46.py | Guilt-tech/PythonExercices | e59bffae997a1974d3e3cdcfff7700afbed65e6e | [
"MIT"
] | null | null | null | Exercices/Secao04/exercicio46.py | Guilt-tech/PythonExercices | e59bffae997a1974d3e3cdcfff7700afbed65e6e | [
"MIT"
] | null | null | null | Exercices/Secao04/exercicio46.py | Guilt-tech/PythonExercices | e59bffae997a1974d3e3cdcfff7700afbed65e6e | [
"MIT"
] | null | null | null | print('Digite um número inteiro positivo de três dígitos (100 a 999), para gerar o número invertido')
num = int(input('Número: '))
num = str(num)
reverso = num[::-1]
print(f'O número ao contrário de: {num} é: {reverso}') | 44 | 101 | 0.695455 | 37 | 220 | 4.135135 | 0.702703 | 0.091503 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.037433 | 0.15 | 220 | 5 | 102 | 44 | 0.780749 | 0 | 0 | 0 | 0 | 0 | 0.651584 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.4 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
50c5e0a8570cdd739aa3c8e994e48c1fd64e8100 | 196 | py | Python | lambda/python/ip/what_is_my_ip.py | enrikiko/AWS | e8984e5fc5d015285ef2cc3f4295a273d1994e22 | [
"MIT"
] | null | null | null | lambda/python/ip/what_is_my_ip.py | enrikiko/AWS | e8984e5fc5d015285ef2cc3f4295a273d1994e22 | [
"MIT"
] | null | null | null | lambda/python/ip/what_is_my_ip.py | enrikiko/AWS | e8984e5fc5d015285ef2cc3f4295a273d1994e22 | [
"MIT"
] | null | null | null | import json
def lambda_handler(event, context):
ip = event["requestContext"]["identity"]["sourceIp"]
return {
'statusCode': 200,
'body': json.dumps(ip)
}
| 21.777778 | 57 | 0.561224 | 19 | 196 | 5.736842 | 0.842105 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.021583 | 0.290816 | 196 | 8 | 58 | 24.5 | 0.76259 | 0 | 0 | 0 | 0 | 0 | 0.22449 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0.142857 | 0 | 0.428571 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
50c9aef6ef070fdd9753a4e730c01e945a86b51c | 3,581 | py | Python | qtpp/views/auth.py | xzdylyh/qtppy | baa37c59082863ace3cddb09c30a55a92d64f656 | [
"Apache-2.0"
] | 2 | 2020-04-23T06:10:05.000Z | 2021-01-21T08:56:09.000Z | qtpp/views/auth.py | xzdylyh/qtppy | baa37c59082863ace3cddb09c30a55a92d64f656 | [
"Apache-2.0"
] | 2 | 2020-04-22T10:11:29.000Z | 2020-05-12T10:02:14.000Z | qtpp/views/auth.py | xzdylyh/qtppy | baa37c59082863ace3cddb09c30a55a92d64f656 | [
"Apache-2.0"
] | 4 | 2020-04-22T09:35:14.000Z | 2020-12-19T08:15:25.000Z | import functools
from flask import (
Blueprint, flash, g, redirect, render_template, request, session, url_for, jsonify, abort
)
from werkzeug.security import check_password_hash, generate_password_hash
from qtpp import db
from qtpp.libs.framework.operate_db import OperationDB
from qtpp.libs.framework.constant import Const
from qtpp.models.user import User
'''
这里创建了一个名称为 'auth' 的 Blueprint 。和应用对象一样,
蓝图需要知道是在哪里定义的,因此把 __name__ 作为函数的第二个参数。
url_prefix 会添加到所有与该蓝图关联的 URL 前面。
'''
bp = Blueprint('auth', __name__, url_prefix='/auth')
odb = OperationDB()
'''
认证蓝图将包括注册新用户、登录和注销视图。
'''
@bp.route('/register', methods=('GET', 'POST'))
def register():
'''
当用访问 /auth/register URL 时, register 视图会返回用于填写注册 内容的表单的 HTML 。
当用户提交表单时,视图会验证表单内容,然后要么再次 显示表单并显示一个出错信息,
要么创建新用户并显示登录页面。
'''
if request.method == 'POST':
username = request.json['username']
password = request.json['password']
# 带有 ? 占位符 的 SQL 查询语句。占位符可以代替后面的元组参数中相应的值。
# 使用占位符的 好处是会自动帮你转义输入值,以抵御 SQL 注入攻击 。
# fetchone() 根据查询返回一个记录行。 如果查询没有结果,则返回 None 。
# 后面还用到 fetchall() ,它返回包括所有结果的列表。
# 使用 generate_password_hash() 生成安全的哈希值并储存 到数据库中。
# url_for() 根据登录视图的名称生成相应的 URL
if not (username and password):
return jsonify(Const.errcode('1003'))
elif odb.query_per(User, 'username', username) is not None:
return jsonify(Const.errcode('1004', res={"username": username}))
odb.add(User(username, generate_password_hash(password)))
return jsonify(Const.errcode('0'))
return abort(404)
@bp.route('/login', methods=('GET', 'POST'))
def login():
if request.method == 'POST':
username = request.json['username']
password = request.json['password']
error = None
user = odb.query_per(User, 'username', username)
# check_password_hash() 以相同的方式哈希提交的 密码并安全的比较哈希值。
# 如果匹配成功,那么密码就是正确的。
# session 是一个 dict ,它用于储存横跨请求的值。
# 当验证 成功后,用户的 id 被储存于一个新的会话中。
# 会话数据被储存到一个 向浏览器发送的 cookie 中,在后继请求中,浏览器会返回它。
# Flask 会安全对数据进行 签名 以防数据被篡改。
if (user is None) or (not check_password_hash(user.password, password)):
return jsonify(Const.errcode('1003'))
if error is None:
session.clear()
session['user_id'] = user.uid
session['user_name'] = user.username
res = {
"user_id": user.uid,
"name": user.username
}
return jsonify(Const.errcode('0', res=res))
# flash(error)
return abort(404)
'''
bp.before_app_request() 注册一个 在视图函数之前运行的函数,不论其 URL 是什么。
load_logged_in_user 检查用户 id 是否已经储存在 session 中,并从数据库中获取用户数据,
然后储存在 g.user 中。 g.user 的持续时间比请求要长。 如果没有用户 id ,或者 id 不存在,
那么 g.user 将会是 None 。
'''
@bp.before_app_request
def load_logged_in_user():
user_id = session.get('user_id')
if user_id is None:
g.user = None
else:
g.user = odb.query_per(User, 'uid', user_id)
'''
注销的时候需要把用户 id 从 session 中移除。
然后 load_logged_in_user 就不会在后继请求中载入用户了。
'''
@bp.route('/logout', methods=('GET', 'POST'))
def logout():
session.clear()
return jsonify(Const.errcode('0'))
'''
用户登录以后才能创建、编辑和删除。
在每个视图中可以使用 装饰器 来完成这个工作。
装饰器返回一个新的视图,该视图包含了传递给装饰器的原视图。
新的函数检查用户 是否已载入。如果已载入,那么就继续正常执行原视图,
否则就重定向到登录页面。 我们会在应用视图中使用这个装饰器。
'''
def login_required(view):
@functools.wraps(view)
def wrapped_view(**kwargs):
if g.user is None:
return jsonify(Const.errcode('1001'))
return view(**kwargs)
return wrapped_view | 26.330882 | 93 | 0.647584 | 427 | 3,581 | 5.309133 | 0.405152 | 0.040141 | 0.05558 | 0.077195 | 0.198059 | 0.124393 | 0.064402 | 0.064402 | 0.064402 | 0.064402 | 0 | 0.009104 | 0.233175 | 3,581 | 136 | 94 | 26.330882 | 0.81646 | 0.155822 | 0 | 0.233333 | 1 | 0 | 0.071222 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.1 | false | 0.1 | 0.116667 | 0 | 0.4 | 0.033333 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
50dff37f03053b54880a5058a34de49805426364 | 671 | py | Python | python_base/binary_array_to_number.py | GlacierBo/python_learn | f604029a1ec449d8d24bb5d40215f25df2a2b027 | [
"MIT"
] | 1 | 2018-02-12T04:56:08.000Z | 2018-02-12T04:56:08.000Z | python_base/binary_array_to_number.py | GlacierBo/python_learn | f604029a1ec449d8d24bb5d40215f25df2a2b027 | [
"MIT"
] | null | null | null | python_base/binary_array_to_number.py | GlacierBo/python_learn | f604029a1ec449d8d24bb5d40215f25df2a2b027 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2017/12/15 11:26
# @Author : glacier
# @Site : 二进制计算
# @File : binary_array_to_number.py
# @Software: PyCharm Edu
# def binary_array_to_number(arr):
# sum = 0
# index = len(arr)-1
# i = 0
# while(index >= 0):
# sum += mul(arr[i],index)
# i += 1
# index -=1
# print(sum)
#
# def mul(index,arg2):
# print(index,arg2)
# for i in range(arg2):
# index = index * 2
# return index
def binary_array_to_number(arr):
# return int("".join(map(str,arr)),2)
print("".join(map(str,arr)),2)
binary_array_to_number([0,0,1,1])
| 19.171429 | 42 | 0.535022 | 98 | 671 | 3.540816 | 0.479592 | 0.126801 | 0.149856 | 0.21902 | 0.224784 | 0.144092 | 0 | 0 | 0 | 0 | 0 | 0.060543 | 0.28614 | 671 | 34 | 43 | 19.735294 | 0.663883 | 0.710879 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | false | 0 | 0 | 0 | 0.333333 | 0.333333 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
50e51c505990ca8f05a03573ffb38d38c07be03c | 3,776 | py | Python | data_toy/bnmtf/generate_bnmtf.py | ThomasBrouwer/BNMTF | 34df0c3cebc5e67a5e39762b9305b75d73a2a0e0 | [
"Apache-2.0"
] | 16 | 2017-04-19T12:04:47.000Z | 2021-12-03T00:50:43.000Z | data_toy/bnmtf/generate_bnmtf.py | ThomasBrouwer/BNMTF | 34df0c3cebc5e67a5e39762b9305b75d73a2a0e0 | [
"Apache-2.0"
] | 1 | 2017-04-20T11:26:16.000Z | 2017-04-20T11:26:16.000Z | data_toy/bnmtf/generate_bnmtf.py | ThomasBrouwer/BNMTF | 34df0c3cebc5e67a5e39762b9305b75d73a2a0e0 | [
"Apache-2.0"
] | 8 | 2015-12-15T05:29:43.000Z | 2019-06-05T03:14:11.000Z | """
Generate a toy dataset for the matrix tri-factorisation case, and store it.
We use dimensions 100 by 50 for the dataset, 10 row clusters, and 5 column clusters.
As the prior for F, G we take value 1 for all entries (so exp 1), and for S value 2 (so exp 1/2).
As a result, each value in R has a value of around 25, and a variance of .
For contrast, the Sanger dataset is as follows:
Shape: (622,139). Fraction observed: 0.811307224317.
Mean: 11.9726909789. Variance: 34.1503768785. Maximum: 23.5959612058.
We add Gaussian noise of precision tau = 1 (prior for gamma: alpha=1,beta=1).
(Simply using the expectation of our Gamma distribution over tau)
"""
import sys, os
project_location = os.path.dirname(__file__)+"/../../../"
sys.path.append(project_location)
from BNMTF.code.models.distributions.exponential import exponential_draw
from BNMTF.code.models.distributions.normal import normal_draw
from BNMTF.code.cross_validation.mask import generate_M
import numpy, itertools, matplotlib.pyplot as plt
def generate_dataset(I,J,K,L,lambdaF,lambdaS,lambdaG,tau):
# Generate U, V
F = numpy.zeros((I,K))
for i,k in itertools.product(xrange(0,I),xrange(0,K)):
F[i,k] = exponential_draw(lambdaF[i,k])
S = numpy.zeros((K,L))
for k,l in itertools.product(xrange(0,K),xrange(0,L)):
S[k,l] = exponential_draw(lambdaS[k,l])
G = numpy.zeros((J,L))
for j,l in itertools.product(xrange(0,J),xrange(0,L)):
G[j,l] = exponential_draw(lambdaG[j,l])
# Generate R
true_R = numpy.dot(F,numpy.dot(S,G.T))
R = add_noise(true_R,tau)
return (F,S,G,tau,true_R,R)
def add_noise(true_R,tau):
if numpy.isinf(tau):
return numpy.copy(true_R)
(I,J) = true_R.shape
R = numpy.zeros((I,J))
for i,j in itertools.product(xrange(0,I),xrange(0,J)):
R[i,j] = normal_draw(true_R[i,j],tau)
return R
def try_generate_M(I,J,fraction_unknown,attempts):
for attempt in range(1,attempts+1):
try:
M = generate_M(I,J,fraction_unknown)
sums_columns = M.sum(axis=0)
sums_rows = M.sum(axis=1)
for i,c in enumerate(sums_rows):
assert c != 0, "Fully unobserved row in M, row %s. Fraction %s." % (i,fraction_unknown)
for j,c in enumerate(sums_columns):
assert c != 0, "Fully unobserved column in M, column %s. Fraction %s." % (j,fraction_unknown)
print "Took %s attempts to generate M." % attempt
return M
except AssertionError:
pass
raise Exception("Tried to generate M %s times, with I=%s, J=%s, fraction=%s, but failed." % (attempts,I,J,fraction_unknown))
##########
if __name__ == "__main__":
output_folder = project_location+"BNMTF/data_toy/bnmtf/"
I,J,K,L = 100, 80, 5, 5
fraction_unknown = 0.1
alpha, beta = 1., 1.
lambdaF = numpy.ones((I,K))
lambdaS = numpy.ones((K,L))
lambdaG = numpy.ones((J,L))
tau = alpha / beta
(F,S,G,tau,true_R,R) = generate_dataset(I,J,K,L,lambdaF,lambdaS,lambdaG,tau)
# Try to generate M
M = try_generate_M(I,J,fraction_unknown,attempts=1000)
# Store all matrices in text files
numpy.savetxt(open(output_folder+"F.txt",'w'),F)
numpy.savetxt(open(output_folder+"S.txt",'w'),S)
numpy.savetxt(open(output_folder+"G.txt",'w'),G)
numpy.savetxt(open(output_folder+"R_true.txt",'w'),true_R)
numpy.savetxt(open(output_folder+"R.txt",'w'),R)
numpy.savetxt(open(output_folder+"M.txt",'w'),M)
print "Mean R: %s. Variance R: %s. Min R: %s. Max R: %s." % (numpy.mean(R),numpy.var(R),R.min(),R.max())
fig = plt.figure()
plt.hist(R.flatten(),bins=range(0,int(R.max())+1))
plt.show() | 37.019608 | 128 | 0.640625 | 624 | 3,776 | 3.778846 | 0.285256 | 0.010178 | 0.040712 | 0.05598 | 0.272265 | 0.176421 | 0.106022 | 0.095844 | 0.036472 | 0.036472 | 0 | 0.034888 | 0.21054 | 3,776 | 102 | 129 | 37.019608 | 0.756122 | 0.019862 | 0 | 0 | 1 | 0.03125 | 0.109712 | 0.006961 | 0 | 0 | 0 | 0 | 0.046875 | 0 | null | null | 0.015625 | 0.078125 | null | null | 0.03125 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
50ee3e8e00f618a16eddadbc990257d3c3594577 | 244 | py | Python | example/src/pythonSnippet.py | hansehe/DockerBuildManagement | 774ddfb5184dc9c9ae0c307c7d5963a4ccb104f8 | [
"MIT"
] | 8 | 2019-04-03T13:40:30.000Z | 2020-11-29T09:20:13.000Z | example/src/pythonSnippet.py | hansehe/DockerBuildManagement | 774ddfb5184dc9c9ae0c307c7d5963a4ccb104f8 | [
"MIT"
] | 1 | 2019-02-06T16:05:06.000Z | 2019-02-24T22:59:43.000Z | example/src/pythonSnippet.py | hansehe/DockerBuildManagement | 774ddfb5184dc9c9ae0c307c7d5963a4ccb104f8 | [
"MIT"
] | 5 | 2018-12-15T19:03:25.000Z | 2021-09-22T23:42:33.000Z | def GetInfoMsg():
infoMsg = "This python snippet is triggered by the 'cmd' property.\r\n"
infoMsg += "Any command line may be triggered with the 'cmd' property.\r\n"
return infoMsg
if __name__ == "__main__":
print(GetInfoMsg()) | 34.857143 | 79 | 0.684426 | 34 | 244 | 4.676471 | 0.735294 | 0.075472 | 0.176101 | 0.188679 | 0.201258 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.196721 | 244 | 7 | 80 | 34.857143 | 0.811224 | 0 | 0 | 0 | 0 | 0 | 0.526531 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0 | 0 | 0.333333 | 0.166667 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
0f9d62c9fc903008351f564ece40e730aa1af67b | 412 | py | Python | old/accent_analyser/rules/VoicedFricative1.py | stefantaubert/eng2ipa-accent-transformer | d620c70b06c83119402e255085046747ade87444 | [
"MIT"
] | null | null | null | old/accent_analyser/rules/VoicedFricative1.py | stefantaubert/eng2ipa-accent-transformer | d620c70b06c83119402e255085046747ade87444 | [
"MIT"
] | null | null | null | old/accent_analyser/rules/VoicedFricative1.py | stefantaubert/eng2ipa-accent-transformer | d620c70b06c83119402e255085046747ade87444 | [
"MIT"
] | null | null | null | from accent_analyser.rules.IpaRule import IpaRule
def replace(word: str):
return word.replace("v", "w")
class VoicedFricative1(IpaRule):
def __init__(self, likelihood=0.51):
super().__init__(likelihood)
self.name = "Voiced Fricative: [w] instead of /v/"
def _convert_core(self, words: list, current_index: int):
word = words[current_index].content
word = replace(word)
return word
| 24.235294 | 59 | 0.708738 | 55 | 412 | 5.072727 | 0.618182 | 0.071685 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.011662 | 0.167476 | 412 | 16 | 60 | 25.75 | 0.801749 | 0 | 0 | 0 | 0 | 0 | 0.092233 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.272727 | false | 0 | 0.090909 | 0.090909 | 0.636364 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
0f9f167571a194f1bc7acb964cd47daad5d38e0c | 146 | py | Python | mamonsu/plugins/system/linux/__init__.py | sgrinko/mamonsu | 03b8e1217b08e6580e08129fddd64dbc20265fd4 | [
"BSD-3-Clause"
] | 188 | 2016-01-31T09:05:59.000Z | 2022-03-22T16:49:12.000Z | mamonsu/plugins/system/linux/__init__.py | sgrinko/mamonsu | 03b8e1217b08e6580e08129fddd64dbc20265fd4 | [
"BSD-3-Clause"
] | 162 | 2016-02-02T13:49:14.000Z | 2022-02-22T08:45:42.000Z | mamonsu/plugins/system/linux/__init__.py | sgrinko/mamonsu | 03b8e1217b08e6580e08129fddd64dbc20265fd4 | [
"BSD-3-Clause"
] | 46 | 2016-01-31T21:23:37.000Z | 2022-02-07T10:59:54.000Z | __all__ = [
'proc_stat', 'disk_stats', 'disk_sizes',
'memory', 'uptime', 'open_files', 'net', 'la'
,'pg_probackup'
]
from . import *
| 18.25 | 49 | 0.582192 | 17 | 146 | 4.470588 | 0.941176 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.205479 | 146 | 7 | 50 | 20.857143 | 0.655172 | 0 | 0 | 0 | 0 | 0 | 0.465753 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.166667 | 0 | 0.166667 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
0f9f1cf0e2224146473d97b789d2a857c46d01b2 | 164 | py | Python | config.py | stultus/Flask-wado | 997c4b54640be121e9436950c053df60054b2c13 | [
"Apache-2.0"
] | 3 | 2015-07-09T18:49:20.000Z | 2021-04-19T03:20:12.000Z | config.py | stultus/Flask-wado | 997c4b54640be121e9436950c053df60054b2c13 | [
"Apache-2.0"
] | 1 | 2016-07-20T23:19:03.000Z | 2016-07-20T23:19:03.000Z | config.py | stultus/Flask-wado | 997c4b54640be121e9436950c053df60054b2c13 | [
"Apache-2.0"
] | 4 | 2015-05-13T07:26:57.000Z | 2022-01-25T23:19:00.000Z | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import os
basedir = os.path.abspath(os.path.dirname(__file__))
CSRF_ENABLED = True
SECRET_KEY='parayan-manasilla'
| 16.4 | 52 | 0.707317 | 24 | 164 | 4.583333 | 0.875 | 0.109091 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.006944 | 0.121951 | 164 | 9 | 53 | 18.222222 | 0.756944 | 0.262195 | 0 | 0 | 0 | 0 | 0.145299 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.25 | 0 | 0.25 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
0fa25074fb0a3f8683d33c168968750fc928e7ea | 1,198 | py | Python | tests/data/view.py | Forumouth/flask-simple | 0764559fbbc4348cc146aa4dddbc1f90d91bc840 | [
"MIT",
"Unlicense"
] | null | null | null | tests/data/view.py | Forumouth/flask-simple | 0764559fbbc4348cc146aa4dddbc1f90d91bc840 | [
"MIT",
"Unlicense"
] | 5 | 2016-01-30T13:32:23.000Z | 2016-02-06T13:34:11.000Z | tests/data/view.py | Forumouth/flask-simple | 0764559fbbc4348cc146aa4dddbc1f90d91bc840 | [
"MIT",
"Unlicense"
] | null | null | null | #!/usr/bin/env python
# coding=utf-8
from flask.ext.simple import FlaskEasyView
from .model import ExampleModel
from .form import generate_example_form
from .testapp import app
class SimpleView(FlaskEasyView):
'''
Simple Example View for test
'''
trailing_slash = False
model = ExampleModel
form = generate_example_form()
list_name = "simple"
class SimpleValidationFailureView(SimpleView):
'''
Simple Example view, but failures validation
'''
route_base = "/invalid"
expected_err = {"error": ["Something happend"]}
form = generate_example_form(False, expected_err)
list_name = "simple_validation_failure"
class SimpleTemplateView(SimpleView):
'''
Simple Example View with render_template
'''
route_base = "/templated"
template = "test.jinja"
list_name = "simple_templated"
class WithoutFormView(FlaskEasyView):
'''
Simple Example View without form
'''
route_base = "/noform"
trailing_slash = False
model = ExampleModel
list_name = "simple_no_form"
SimpleView.register(app)
SimpleTemplateView.register(app)
WithoutFormView.register(app)
SimpleValidationFailureView.register(app)
| 22.185185 | 53 | 0.716194 | 128 | 1,198 | 6.523438 | 0.421875 | 0.062275 | 0.081437 | 0.071856 | 0.083832 | 0 | 0 | 0 | 0 | 0 | 0 | 0.001032 | 0.191152 | 1,198 | 53 | 54 | 22.603774 | 0.860681 | 0.151085 | 0 | 0.148148 | 1 | 0 | 0.12356 | 0.026178 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.148148 | 0 | 0.851852 | 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 | 0 | 0 | 1 | 0 | 0 | 2 |
0fb6d81fdcc4a6f92216d10fda5840c9b15c50e3 | 295 | py | Python | tests/data/formulas/five/five-1.0.py | pmuller/ipkg | 9e3df803e0f16035a7552f63bbf54886244827d8 | [
"MIT"
] | 3 | 2016-04-20T21:24:59.000Z | 2021-11-17T10:58:49.000Z | tests/data/formulas/five/five-1.0.py | pmuller/ipkg | 9e3df803e0f16035a7552f63bbf54886244827d8 | [
"MIT"
] | null | null | null | tests/data/formulas/five/five-1.0.py | pmuller/ipkg | 9e3df803e0f16035a7552f63bbf54886244827d8 | [
"MIT"
] | null | null | null | from os.path import dirname
from ipkg.build import Formula, File
class five(Formula):
name = 'five'
version = '1.0'
sources = File(dirname(__file__) + '/../../sources/five-1.0.tar.gz')
platform = 'any'
dependencies = ('four > 1.0',)
def install(self):
pass
| 17.352941 | 72 | 0.6 | 39 | 295 | 4.435897 | 0.666667 | 0.034682 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.026786 | 0.240678 | 295 | 16 | 73 | 18.4375 | 0.745536 | 0 | 0 | 0 | 0 | 0 | 0.169492 | 0.101695 | 0 | 0 | 0 | 0 | 0 | 1 | 0.1 | false | 0.1 | 0.2 | 0 | 0.9 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 2 |
0fbcbe12ef9216cd827006560b9e93c286ad369b | 531 | py | Python | activity/views.py | AkshayVKumar/ActivityManager | e87987a532b8441b41ecc038b51e4614b8d1a526 | [
"BSD-3-Clause"
] | null | null | null | activity/views.py | AkshayVKumar/ActivityManager | e87987a532b8441b41ecc038b51e4614b8d1a526 | [
"BSD-3-Clause"
] | 5 | 2020-06-06T01:47:24.000Z | 2022-02-10T14:42:15.000Z | activity/views.py | AkshayVKumar/ActivityManager | e87987a532b8441b41ecc038b51e4614b8d1a526 | [
"BSD-3-Clause"
] | null | null | null | from rest_framework import viewsets
from .serializers import MemberSerializer, ActivityPeriodSerializer
from activity.models import UserProfile, ActivityPeriod
from django.http import JsonResponse
#class for displaying members
class MemberViewSet(viewsets.ModelViewSet):
queryset = UserProfile.objects.all()
serializer_class = MemberSerializer
#class for taking activity input
class ActivityPeriodViewSet(viewsets.ModelViewSet):
queryset = ActivityPeriod.objects.all()
serializer_class = ActivityPeriodSerializer
| 35.4 | 67 | 0.834275 | 52 | 531 | 8.461538 | 0.538462 | 0.036364 | 0.127273 | 0.113636 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.114878 | 531 | 14 | 68 | 37.928571 | 0.93617 | 0.111111 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.4 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
0fc78435f35004709d8d5a9264257cf022be0b7d | 4,337 | py | Python | Posts/migrations/0001_initial.py | rosekairu/Neighbourly | 3381b4472cd9d7de988ea57f1ecd931976e95853 | [
"MIT"
] | null | null | null | Posts/migrations/0001_initial.py | rosekairu/Neighbourly | 3381b4472cd9d7de988ea57f1ecd931976e95853 | [
"MIT"
] | 6 | 2021-03-30T13:56:43.000Z | 2021-09-22T19:26:50.000Z | Posts/migrations/0001_initial.py | rosekairu/Neighbourly | 3381b4472cd9d7de988ea57f1ecd931976e95853 | [
"MIT"
] | null | null | null | # Generated by Django 3.0.8 on 2020-07-19 17:34
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import phone_field.models
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='Neighborhood',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('location', models.CharField(max_length=100)),
('hood_name', models.CharField(max_length=100)),
('population', models.PositiveIntegerField(null=True)),
('user', models.ForeignKey(default=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
migrations.CreateModel(
name='Profile',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('prof_pic', models.ImageField(blank=True, upload_to='images/')),
('bio', models.CharField(max_length=250, null=True)),
('email', models.EmailField(max_length=100)),
('date_joined', models.DateTimeField(auto_now_add=True)),
('neighborhood', models.ForeignKey(default=2, null=True, on_delete=django.db.models.deletion.CASCADE, to='Posts.Neighborhood')),
('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
migrations.CreateModel(
name='Police',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('station_name', models.CharField(max_length=100)),
('email', models.EmailField(max_length=100)),
('tel', phone_field.models.PhoneField(blank=True, help_text='Police Station Phone Number', max_length=31)),
('neighborhood', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='Posts.Neighborhood')),
],
),
migrations.CreateModel(
name='Notice',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('notice_title', models.CharField(max_length=100, null=True)),
('notice_pic', models.ImageField(blank=True, null=True, upload_to='images/')),
('notice_details', models.CharField(max_length=250, null=True)),
('post_date', models.DateField(auto_now_add=True, null=True)),
('neighborhood', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='Posts.Neighborhood')),
('user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
migrations.CreateModel(
name='HealthCenter',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('hospital_name', models.CharField(max_length=100)),
('email', models.EmailField(max_length=100)),
('tel', phone_field.models.PhoneField(blank=True, help_text='Hospital Phone Number', max_length=31)),
('neighborhood', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='Posts.Neighborhood')),
],
),
migrations.CreateModel(
name='Business',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('bsns_name', models.CharField(max_length=250)),
('bsns_email', models.EmailField(max_length=100)),
('neighborhood', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='Posts.Neighborhood')),
('user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
]
| 52.253012 | 144 | 0.611944 | 459 | 4,337 | 5.620915 | 0.20915 | 0.048837 | 0.054264 | 0.085271 | 0.735271 | 0.68062 | 0.643023 | 0.615891 | 0.615891 | 0.615891 | 0 | 0.017157 | 0.247406 | 4,337 | 82 | 145 | 52.890244 | 0.773284 | 0.010376 | 0 | 0.52 | 1 | 0 | 0.107692 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.053333 | 0 | 0.106667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
0fd3b9d2e66fa26e441f1b047f98378e175a4aff | 231 | py | Python | python_3/aula21c.py | felipesch92/CursoEmVideo | df443e4771adc4506c96d8f419aa7acb97b28366 | [
"MIT"
] | null | null | null | python_3/aula21c.py | felipesch92/CursoEmVideo | df443e4771adc4506c96d8f419aa7acb97b28366 | [
"MIT"
] | null | null | null | python_3/aula21c.py | felipesch92/CursoEmVideo | df443e4771adc4506c96d8f419aa7acb97b28366 | [
"MIT"
] | null | null | null | # Programa Principal
def teste():
x = 8
print(f'Na função teste, n vale {n}')
print(f'Na função teste x vale {x}')
n = 2
print(f'No programa principal, n vale {n}')
teste()
print(f'No programa principal, x vale {x}')
| 19.25 | 43 | 0.632035 | 41 | 231 | 3.560976 | 0.341463 | 0.164384 | 0.109589 | 0.191781 | 0.60274 | 0 | 0 | 0 | 0 | 0 | 0 | 0.01105 | 0.21645 | 231 | 11 | 44 | 21 | 0.79558 | 0.077922 | 0 | 0 | 0 | 0 | 0.563981 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | false | 0 | 0 | 0 | 0.125 | 0.5 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 2 |
0fdc8f057905c0da9456649de2bde8f06dd894eb | 1,984 | py | Python | cohesity_management_sdk/models/object_status_enum.py | nick6655/management-sdk-python | 88e792cb83e5c24a22af495b220c145d0c45841d | [
"Apache-2.0"
] | 18 | 2019-09-24T17:35:53.000Z | 2022-03-25T08:08:47.000Z | cohesity_management_sdk/models/object_status_enum.py | nick6655/management-sdk-python | 88e792cb83e5c24a22af495b220c145d0c45841d | [
"Apache-2.0"
] | 18 | 2019-03-29T19:32:29.000Z | 2022-01-03T23:16:45.000Z | cohesity_management_sdk/models/object_status_enum.py | nick6655/management-sdk-python | 88e792cb83e5c24a22af495b220c145d0c45841d | [
"Apache-2.0"
] | 16 | 2019-02-27T06:54:12.000Z | 2021-11-16T18:10:24.000Z | # -*- coding: utf-8 -*-
# Copyright 2021 Cohesity Inc.
class ObjectStatusEnum(object):
"""Implementation of the 'ObjectStatus' enum.
Specifies the status of an object during a Restore Task.
'kFilesCloned' indicates that the cloning has completed.
'kFetchedEntityInfo' indicates that information about the object was
fetched from the primary source.
'kVMCreated' indicates that the new VM was created.
'kRelocationStarted' indicates that restoring to a different
resource pool has started.
'kFinished' indicates that the Restore Task has finished.
Whether it was successful or not is indicated by the error code that
that is stored with the Restore Task.
'kAborted' indicates that the Restore Task was aborted before
trying to restore this object. This can happen if the
Restore Task encounters a global error.
For example during a 'kCloneVMs' Restore Task, the datastore
could not be mounted. The entire Restore Task is aborted
before trying to create VMs on the primary source.
'kDataCopyStarted' indicates that the disk copy is started.
'kInProgress' captures a generic in-progress state and can be used by
restore
operations that don't track individual states.
Attributes:
KFILESCLONED: TODO: type description here.
KFETCHEDENTITYINFO: TODO: type description here.
KVMCREATED: TODO: type description here.
KRELOCATIONSTARTED: TODO: type description here.
KFINISHED: TODO: type description here.
KABORTED: TODO: type description here.
KDATACOPYSTARTED: TODO: type description here.
KINPROGRESS: TODO: type description here.
"""
KFILESCLONED = 'kFilesCloned'
KFETCHEDENTITYINFO = 'kFetchedEntityInfo'
KVMCREATED = 'kVMCreated'
KRELOCATIONSTARTED = 'kRelocationStarted'
KFINISHED = 'kFinished'
KABORTED = 'kAborted'
KDATACOPYSTARTED = 'kDataCopyStarted'
KINPROGRESS = 'kInProgress'
| 34.807018 | 73 | 0.724294 | 230 | 1,984 | 6.247826 | 0.452174 | 0.044537 | 0.105776 | 0.128045 | 0.037578 | 0 | 0 | 0 | 0 | 0 | 0 | 0.00324 | 0.222278 | 1,984 | 56 | 74 | 35.428571 | 0.928062 | 0.766633 | 0 | 0 | 0 | 0 | 0.306306 | 0 | 0 | 0 | 0 | 0.142857 | 0 | 1 | 0 | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
0fe028e53da10f567941d0206c9d2ffff90acae0 | 418 | py | Python | prometheus_redis_client/helpers.py | ChielWH/prometheus_redis_client | 90852fb0eaf3aee1937a74cad6181c304dc6999a | [
"Apache-2.0"
] | 19 | 2019-04-02T11:46:45.000Z | 2022-03-21T03:38:56.000Z | prometheus_redis_client/helpers.py | ChielWH/prometheus_redis_client | 90852fb0eaf3aee1937a74cad6181c304dc6999a | [
"Apache-2.0"
] | 12 | 2019-08-17T05:55:23.000Z | 2022-02-10T07:37:38.000Z | prometheus_redis_client/helpers.py | ChielWH/prometheus_redis_client | 90852fb0eaf3aee1937a74cad6181c304dc6999a | [
"Apache-2.0"
] | 6 | 2019-11-20T15:12:38.000Z | 2022-03-21T03:36:44.000Z | import time
from typing import Callable
from functools import wraps
def timeit(metric_callback: Callable, **labels):
def wrapper(func):
@wraps(func)
def func_wrapper(*args, **kwargs):
start = time.time()
result = func(*args, **kwargs)
metric_callback(time.time() - start, labels=labels)
return result
return func_wrapper
return wrapper
| 26.125 | 63 | 0.62201 | 47 | 418 | 5.446809 | 0.404255 | 0.109375 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.284689 | 418 | 15 | 64 | 27.866667 | 0.856187 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.230769 | false | 0 | 0.230769 | 0 | 0.692308 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
0fe648b3645c63c3137ac9f66876140376501f31 | 3,513 | py | Python | ebrains_drive/repo.py | apdavison/ebrains-drive | 8ff11fc60e77c1b605485f550efc350c1a5f443a | [
"Apache-2.0"
] | 5 | 2020-12-20T16:12:18.000Z | 2022-03-29T09:56:34.000Z | ebrains_drive/repo.py | apdavison/ebrains-drive | 8ff11fc60e77c1b605485f550efc350c1a5f443a | [
"Apache-2.0"
] | 9 | 2020-09-25T08:27:41.000Z | 2022-01-03T08:41:48.000Z | ebrains_drive/repo.py | apdavison/ebrains-drive | 8ff11fc60e77c1b605485f550efc350c1a5f443a | [
"Apache-2.0"
] | 2 | 2020-09-18T17:32:38.000Z | 2020-10-13T13:34:38.000Z | from urllib.parse import urlencode
from ebrains_drive.files import SeafDir, SeafFile
from ebrains_drive.utils import raise_does_not_exist
class Repo(object):
"""
A seafile library
"""
def __init__(self, client, **kwargs):
self.client = client
allowed_keys = ['encrypted', 'group_name', 'groupid', 'head_commit_id', 'id', 'modifier_contact_email', 'modifier_email', 'modifier_name', 'mtime', 'mtime_relative', 'name', 'owner', 'owner_contact_email', 'owner_name', 'permission', 'root', 'share_from', 'share_from_contact_email', 'share_from_name', 'share_type', 'size', 'size_formatted', 'type', 'version', 'virtual']
# Update __dict__ but only for keys that have been predefined
# (silently ignore others)
self.__dict__.update((key, value) for key, value in kwargs.items() if key in allowed_keys)
# To NOT silently ignore rejected keys
# rejected_keys = set(kwargs.keys()) - set(allowed_keys)
# if rejected_keys:
# raise ValueError("Invalid arguments in constructor:{}".format(rejected_keys))
def __str__(self):
return "(id='{}', name='{}')".format(self.id, self.name)
def __repr__(self):
return "ebrains_drive.repo.Repo(id='{}', name='{}')".format(self.id, self.name)
@classmethod
def from_json(cls, client, repo_json):
return cls(client, **repo_json)
def is_readonly(self):
return 'w' not in self.perm
@raise_does_not_exist('The requested file does not exist')
def get_file(self, path):
"""Get the file object located in `path` in this repo.
Return a :class:`SeafFile` object
"""
assert path.startswith('/')
url = '/api2/repos/%s/file/detail/' % self.id
query = '?' + urlencode(dict(p=path))
file_json = self.client.get(url + query).json()
return SeafFile(self, path, file_json['id'], "file", file_json['size'])
@raise_does_not_exist('The requested dir does not exist')
def get_dir(self, path):
"""Get the dir object located in `path` in this repo.
Return a :class:`SeafDir` object
"""
assert path.startswith('/')
url = '/api2/repos/%s/dir/' % self.id
query = '?' + urlencode(dict(p=path))
resp = self.client.get(url + query)
dir_id = resp.headers['oid']
dir_json = resp.json()
dir = SeafDir(self, path, dir_id, "dir")
dir.load_entries(dir_json)
return dir
def delete(self):
"""Remove this repo. Only the repo owner can do this"""
self.client.delete('/api2/repos/' + self.id)
def list_history(self):
"""List the history of this repo
Returns a list of :class:`RepoRevision` object.
"""
pass
## Operations only the repo owner can do:
def update(self, name=None):
"""Update the name of this repo. Only the repo owner can do
this.
"""
pass
def get_settings(self):
"""Get the settings of this repo. Returns a dict containing the following
keys:
`history_limit`: How many days of repo history to keep.
"""
pass
def restore(self, commit_id):
pass
class RepoRevision(object):
def __init__(self, client, repo, commit_id):
self.client = client
self.repo = repo
self.commit_id = commit_id
def restore(self):
"""Restore the repo to this revision"""
self.repo.revert(self.commit_id)
| 34.441176 | 380 | 0.618275 | 458 | 3,513 | 4.561135 | 0.281659 | 0.033509 | 0.028722 | 0.024414 | 0.253231 | 0.19866 | 0.160843 | 0.108186 | 0.070847 | 0.039253 | 0 | 0.001142 | 0.252206 | 3,513 | 101 | 381 | 34.782178 | 0.794062 | 0.246798 | 0 | 0.192308 | 0 | 0 | 0.185972 | 0.042084 | 0 | 0 | 0 | 0 | 0.038462 | 1 | 0.269231 | false | 0.076923 | 0.057692 | 0.076923 | 0.480769 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
ba041d9f4395da9615d70dc1c9b697b6dd747f7f | 1,903 | py | Python | config.py | SoCaTel/backend-storage | 11667d1868dc0d031bf0c6e938724bf2ba6f9343 | [
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null | config.py | SoCaTel/backend-storage | 11667d1868dc0d031bf0c6e938724bf2ba6f9343 | [
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null | config.py | SoCaTel/backend-storage | 11667d1868dc0d031bf0c6e938724bf2ba6f9343 | [
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null | #--------------------------------------------------------------------------------
# SoCaTel - Backend data storage API endpoints docker container
# These tokens are needed for database access.
#--------------------------------------------------------------------------------
#===============================================================================
# SoCaTel Knowledge Base Deployment
#===============================================================================
# The following are the pre-defined names of elasticsearch indices for the SoCaTel project which
# host data shared with the front-end.
elastic_user_index = "so_user"
elastic_group_index = "so_group"
elastic_organisation_index = "so_organisation"
elastic_service_index = "so_service"
elastic_host = "<insert_elastic_host>" # e.g. "127.0.0.1"
elastic_port = "9200" # Default Elasticsearch port, change accordingly
elastic_user = "<insert_elasticsearch_username>"
elastic_passwd = "<insert_elasticsearch_password>"
#===============================================================================
#===============================================================================
# Linked Pipes ETL Configuration
#===============================================================================
# The following correspond to the URLs corresponding to the linked pipes executions,
# which need to be setup beforehand. They are set to localhost, change according to deployment details
path = "http://127.0.0.1:32800/resources/executions"
user_pipeline = "http://127.0.0.1:32800/resources/pipelines/1578586195746"
group_pipeline = "http://127.0.0.1:32800/resources/pipelines/1578586045942"
organisation_pipeline = "http://127.0.0.1:32800/resources/pipelines/1575531753483"
service_pipeline = "http://127.0.0.1:32800/resources/pipelines/1565080262463"
#===============================================================================
| 55.970588 | 102 | 0.524435 | 175 | 1,903 | 5.554286 | 0.468571 | 0.024691 | 0.030864 | 0.037037 | 0.193416 | 0.193416 | 0.193416 | 0.168724 | 0.168724 | 0 | 0 | 0.066477 | 0.075145 | 1,903 | 33 | 103 | 57.666667 | 0.485795 | 0.623752 | 0 | 0 | 0 | 0 | 0.56447 | 0.118911 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.076923 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
ba0b04b4ada95663d8638daf31f1153f553fb61f | 912 | py | Python | src/abaqus/Calibration/CalibrationModel.py | Haiiliin/PyAbaqus | f20db6ebea19b73059fe875a53be370253381078 | [
"MIT"
] | 7 | 2022-01-21T09:15:45.000Z | 2022-02-15T09:31:58.000Z | src/abaqus/Calibration/CalibrationModel.py | Haiiliin/PyAbaqus | f20db6ebea19b73059fe875a53be370253381078 | [
"MIT"
] | null | null | null | src/abaqus/Calibration/CalibrationModel.py | Haiiliin/PyAbaqus | f20db6ebea19b73059fe875a53be370253381078 | [
"MIT"
] | null | null | null | from ..Calibration.Calibration import Calibration
from ..Model.ModelBase import ModelBase
class CalibrationModel(ModelBase):
"""Abaqus creates a Model object named `Model-1` when a session is started.
Notes
-----
This object can be accessed by:
.. code-block:: python
mdb.models[name]
"""
def Calibration(self, name: str) -> Calibration:
"""This method creates a Calibration object.
Notes
-----
This function can be accessed by:
.. code-block:: python
mdb.models[name].Calibration
Parameters
----------
name
A String specifying the name of the new calibration.
Returns
-------
A Calibration object.
"""
self.calibrations[name] = calibration = Calibration(name)
return calibration
| 22.8 | 79 | 0.557018 | 88 | 912 | 5.772727 | 0.488636 | 0.086614 | 0.051181 | 0.059055 | 0.169291 | 0.169291 | 0.169291 | 0.169291 | 0.169291 | 0.169291 | 0 | 0.001678 | 0.346491 | 912 | 39 | 80 | 23.384615 | 0.850671 | 0.502193 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.166667 | false | 0 | 0.333333 | 0 | 0.833333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
ba1793e21f50164606de991114f96e7cddb49ec8 | 1,331 | py | Python | test_tree.py | lightmanca/InterviewPrep | d77d6b8a1d9dd4f4d5b2d5ef38a5d1c9b2e50f07 | [
"Apache-2.0"
] | null | null | null | test_tree.py | lightmanca/InterviewPrep | d77d6b8a1d9dd4f4d5b2d5ef38a5d1c9b2e50f07 | [
"Apache-2.0"
] | null | null | null | test_tree.py | lightmanca/InterviewPrep | d77d6b8a1d9dd4f4d5b2d5ef38a5d1c9b2e50f07 | [
"Apache-2.0"
] | null | null | null | import pytest
from Tree import Tree
class TestClass:
def setup_class(self):
pass
def test_tree(self):
tree = Tree()
tree.add(3)
tree.add(4)
tree.add(0)
tree.add(8)
tree.add(2)
tree.print_tree()
assert True
def test_compare_trees(self):
tree1 = Tree()
tree2 = Tree()
assert tree1.compare_tree(tree2) is True
tree1.add(3)
assert tree1.compare_tree(tree2) is False
tree1.add(4)
tree1.add(0)
tree1.add(8)
tree1.add(2)
tree2.add(3)
tree2.add(4)
tree2.add(0)
tree2.add(8)
tree2.add(2)
assert tree1.compare_tree(tree2) is True
tree2.add(10)
assert tree1.compare_tree(tree2) is False
tree1.add(10)
assert tree1.compare_tree(tree2) is True
tree1.add(-1)
assert tree1.compare_tree(tree2) is False
tree2.add(-1)
assert tree1.compare_tree(tree2) is True
tree1.add(-5)
tree2.add(-3)
assert tree1.compare_tree(tree2) is False
tree2.add(-5)
tree1.add(-3)
tree1.print_tree()
# tree2.rebalance_tree()
#tree1.rebalance_tree()
#tree1.print_tree()
# assert tree1.compare_tree(tree2) is True
| 21.819672 | 50 | 0.555222 | 177 | 1,331 | 4.073446 | 0.169492 | 0.137309 | 0.224688 | 0.274619 | 0.525659 | 0.525659 | 0.525659 | 0.479889 | 0.410541 | 0 | 0 | 0.076223 | 0.339594 | 1,331 | 60 | 51 | 22.183333 | 0.744027 | 0.077385 | 0 | 0.181818 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.204545 | 1 | 0.068182 | false | 0.022727 | 0.045455 | 0 | 0.136364 | 0.045455 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
ba184328b10f564a0cd03008486c8ac39964d140 | 158 | py | Python | 03_Day_Operators/10.py | diegofregolente/30-Days-Of-Python | e0cad31f6d5ab1384ad6fa5a5d24a84771d6c267 | [
"Apache-2.0"
] | null | null | null | 03_Day_Operators/10.py | diegofregolente/30-Days-Of-Python | e0cad31f6d5ab1384ad6fa5a5d24a84771d6c267 | [
"Apache-2.0"
] | null | null | null | 03_Day_Operators/10.py | diegofregolente/30-Days-Of-Python | e0cad31f6d5ab1384ad6fa5a5d24a84771d6c267 | [
"Apache-2.0"
] | null | null | null | x1 = 1
y1 = 0
x2 = 0
y2 = -2
m1 = (y2 / x1)
x1 = 2
y1 = 2
x2 = 6
y2 = 10
m2 = (y2 - y1 / x2 - x1)
diff = m1 - m2
print(f'Diff of 8 and 9: {diff:.2f}') # 10 | 11.285714 | 43 | 0.468354 | 37 | 158 | 2 | 0.513514 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.304762 | 0.335443 | 158 | 14 | 43 | 11.285714 | 0.4 | 0.012658 | 0 | 0 | 0 | 0 | 0.174194 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.083333 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
ba19b202492740345b68fb765ce97ad817af8b04 | 560 | py | Python | application/migrations/0002_auto_20200901_2057.py | KMaina/counselling-app | 16991dd0ede0e60e6f9886de283178cedd4ab58a | [
"MIT"
] | null | null | null | application/migrations/0002_auto_20200901_2057.py | KMaina/counselling-app | 16991dd0ede0e60e6f9886de283178cedd4ab58a | [
"MIT"
] | null | null | null | application/migrations/0002_auto_20200901_2057.py | KMaina/counselling-app | 16991dd0ede0e60e6f9886de283178cedd4ab58a | [
"MIT"
] | null | null | null | # Generated by Django 3.1 on 2020-09-01 17:57
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('application', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='client',
name='link',
field=models.URLField(blank=True, null=True),
),
migrations.AlterField(
model_name='client',
name='time',
field=models.DateTimeField(blank=True, max_length=50, null=True),
),
]
| 23.333333 | 77 | 0.575 | 57 | 560 | 5.578947 | 0.666667 | 0.125786 | 0.157233 | 0.18239 | 0.245283 | 0.245283 | 0 | 0 | 0 | 0 | 0 | 0.051414 | 0.305357 | 560 | 23 | 78 | 24.347826 | 0.766067 | 0.076786 | 0 | 0.352941 | 1 | 0 | 0.083495 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.058824 | 0 | 0.235294 | 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 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
ba21d65b7d1cc8f2d7ea73d9ecfaf83200df9067 | 709 | py | Python | launch/gl_ros2_driver_udp.py | soslab-project/gl_ros2_driver_udp | 40382327a433a5feff4f2bb09d6228129eaa6ee3 | [
"BSD-3-Clause"
] | 3 | 2021-09-15T04:54:08.000Z | 2021-12-21T06:47:40.000Z | launch/gl_ros2_driver_udp.py | soslab-project/gl_ros2_driver_udp | 40382327a433a5feff4f2bb09d6228129eaa6ee3 | [
"BSD-3-Clause"
] | 1 | 2021-10-15T08:55:47.000Z | 2021-10-15T08:55:47.000Z | launch/gl_ros2_driver_udp.py | soslab-project/gl_ros2_driver_udp | 40382327a433a5feff4f2bb09d6228129eaa6ee3 | [
"BSD-3-Clause"
] | null | null | null | import os
import launch
from launch_ros.actions import Node
from ament_index_python.packages import get_package_share_directory
def generate_launch_description():
gl_ros2_driver_udp = Node(
node_name = 'gl_ros2_driver_udp',
package = 'gl_ros2_driver_udp',
node_executable = 'gl_ros2_driver_udp_node',
output = 'screen',
parameters = [
{'gl_ip': '10.110.1.2'},
{'gl_port': 2000},
{'pc_port': 3000},
{'frame_id': 'laser'},
{'pub_topicname_lidar': 'scan'},
{'angle_offset': 0.0},
],
)
ld = launch.LaunchDescription()
ld.add_action( gl_ros2_driver_udp )
return ld
| 25.321429 | 67 | 0.599436 | 85 | 709 | 4.6 | 0.6 | 0.076726 | 0.153453 | 0.191816 | 0.14578 | 0 | 0 | 0 | 0 | 0 | 0 | 0.043478 | 0.286319 | 709 | 27 | 68 | 26.259259 | 0.729249 | 0 | 0 | 0 | 1 | 0 | 0.200282 | 0.03244 | 0 | 0 | 0 | 0 | 0 | 1 | 0.045455 | false | 0 | 0.181818 | 0 | 0.272727 | 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 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
ba247ac7c75341abffe46b2c862326f4b1bcfefb | 275 | py | Python | COPS.py | abphilip-codes/Codechef_Practice | 21fd52e03df8a0f72a08b0e2a0b48dbd508aac95 | [
"MIT"
] | 2 | 2021-07-26T03:32:24.000Z | 2021-07-31T02:32:14.000Z | COPS.py | abphilip-codes/Codechef_Practice | 21fd52e03df8a0f72a08b0e2a0b48dbd508aac95 | [
"MIT"
] | null | null | null | COPS.py | abphilip-codes/Codechef_Practice | 21fd52e03df8a0f72a08b0e2a0b48dbd508aac95 | [
"MIT"
] | 1 | 2021-07-14T17:45:33.000Z | 2021-07-14T17:45:33.000Z | # https://www.codechef.com/problems/COPS
for T in range(int(input())):
M,x,y=map(int,input().split())
m,a = list(map(int,input().split())),list(range(1,101))
for i in m:
for j in range(i-x*y,i+1+x*y):
if(j in a): a.remove(j)
print(len(a)) | 30.555556 | 59 | 0.552727 | 55 | 275 | 2.763636 | 0.490909 | 0.157895 | 0.144737 | 0.210526 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.023148 | 0.214545 | 275 | 9 | 60 | 30.555556 | 0.680556 | 0.138182 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.142857 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
e83a10c3bd7787fb995d7f3409fbe97fa6a48414 | 7,597 | py | Python | cisco-ios-xr/ydk/models/cisco_ios_xr/_meta/_Cisco_IOS_XR_fretta_bcm_dpa_drop_stats_oper.py | tkamata-test/ydk-py | b637e7853a8edbbd31fbc05afa3aa4110b31c5f9 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | cisco-ios-xr/ydk/models/cisco_ios_xr/_meta/_Cisco_IOS_XR_fretta_bcm_dpa_drop_stats_oper.py | tkamata-test/ydk-py | b637e7853a8edbbd31fbc05afa3aa4110b31c5f9 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | cisco-ios-xr/ydk/models/cisco_ios_xr/_meta/_Cisco_IOS_XR_fretta_bcm_dpa_drop_stats_oper.py | tkamata-test/ydk-py | b637e7853a8edbbd31fbc05afa3aa4110b31c5f9 | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null |
import re
import collections
from enum import Enum
from ydk._core._dm_meta_info import _MetaInfoClassMember, _MetaInfoClass, _MetaInfoEnum
from ydk.types import Empty, YList, YLeafList, DELETE, Decimal64, FixedBitsDict
from ydk._core._dm_meta_info import ATTRIBUTE, REFERENCE_CLASS, REFERENCE_LIST, REFERENCE_LEAFLIST, REFERENCE_IDENTITY_CLASS, REFERENCE_ENUM_CLASS, REFERENCE_BITS, REFERENCE_UNION
from ydk.errors import YPYError, YPYModelError
from ydk.providers._importer import _yang_ns
_meta_table = {
'Drop.Nodes.Node.NpuNumberForDropStats.NpuNumberForDropStat.DropSpecificStatsData' : {
'meta_info' : _MetaInfoClass('Drop.Nodes.Node.NpuNumberForDropStats.NpuNumberForDropStat.DropSpecificStatsData',
False,
[
_MetaInfoClassMember('drop-data', ATTRIBUTE, 'int' , None, None,
[('-2147483648', '2147483647')], [],
''' Drop ID
''',
'drop_data',
'Cisco-IOS-XR-fretta-bcm-dpa-drop-stats-oper', True),
_MetaInfoClassMember('count', ATTRIBUTE, 'int' , None, None,
[('0', '18446744073709551615')], [],
''' count
''',
'count',
'Cisco-IOS-XR-fretta-bcm-dpa-drop-stats-oper', False),
_MetaInfoClassMember('id', ATTRIBUTE, 'int' , None, None,
[('0', '4294967295')], [],
''' id
''',
'id',
'Cisco-IOS-XR-fretta-bcm-dpa-drop-stats-oper', False),
_MetaInfoClassMember('name', ATTRIBUTE, 'str' , None, None,
[], [],
''' name
''',
'name',
'Cisco-IOS-XR-fretta-bcm-dpa-drop-stats-oper', False),
],
'Cisco-IOS-XR-fretta-bcm-dpa-drop-stats-oper',
'drop-specific-stats-data',
_yang_ns._namespaces['Cisco-IOS-XR-fretta-bcm-dpa-drop-stats-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_fretta_bcm_dpa_drop_stats_oper'
),
},
'Drop.Nodes.Node.NpuNumberForDropStats.NpuNumberForDropStat' : {
'meta_info' : _MetaInfoClass('Drop.Nodes.Node.NpuNumberForDropStats.NpuNumberForDropStat',
False,
[
_MetaInfoClassMember('npu-id', ATTRIBUTE, 'int' , None, None,
[('-2147483648', '2147483647')], [],
''' NPU number
''',
'npu_id',
'Cisco-IOS-XR-fretta-bcm-dpa-drop-stats-oper', True),
_MetaInfoClassMember('drop-specific-stats-data', REFERENCE_LIST, 'DropSpecificStatsData' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_fretta_bcm_dpa_drop_stats_oper', 'Drop.Nodes.Node.NpuNumberForDropStats.NpuNumberForDropStat.DropSpecificStatsData',
[], [],
''' Second argument to the module
''',
'drop_specific_stats_data',
'Cisco-IOS-XR-fretta-bcm-dpa-drop-stats-oper', False),
],
'Cisco-IOS-XR-fretta-bcm-dpa-drop-stats-oper',
'npu-number-for-drop-stat',
_yang_ns._namespaces['Cisco-IOS-XR-fretta-bcm-dpa-drop-stats-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_fretta_bcm_dpa_drop_stats_oper'
),
},
'Drop.Nodes.Node.NpuNumberForDropStats' : {
'meta_info' : _MetaInfoClass('Drop.Nodes.Node.NpuNumberForDropStats',
False,
[
_MetaInfoClassMember('npu-number-for-drop-stat', REFERENCE_LIST, 'NpuNumberForDropStat' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_fretta_bcm_dpa_drop_stats_oper', 'Drop.Nodes.Node.NpuNumberForDropStats.NpuNumberForDropStat',
[], [],
''' All drop stats for a particular NPU
''',
'npu_number_for_drop_stat',
'Cisco-IOS-XR-fretta-bcm-dpa-drop-stats-oper', False),
],
'Cisco-IOS-XR-fretta-bcm-dpa-drop-stats-oper',
'npu-number-for-drop-stats',
_yang_ns._namespaces['Cisco-IOS-XR-fretta-bcm-dpa-drop-stats-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_fretta_bcm_dpa_drop_stats_oper'
),
},
'Drop.Nodes.Node' : {
'meta_info' : _MetaInfoClass('Drop.Nodes.Node',
False,
[
_MetaInfoClassMember('node-name', ATTRIBUTE, 'str' , None, None,
[], ['([a-zA-Z0-9_]*\\d+/){1,2}([a-zA-Z0-9_]*\\d+)'],
''' Node ID
''',
'node_name',
'Cisco-IOS-XR-fretta-bcm-dpa-drop-stats-oper', True),
_MetaInfoClassMember('npu-number-for-drop-stats', REFERENCE_CLASS, 'NpuNumberForDropStats' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_fretta_bcm_dpa_drop_stats_oper', 'Drop.Nodes.Node.NpuNumberForDropStats',
[], [],
''' NPU drop stats
''',
'npu_number_for_drop_stats',
'Cisco-IOS-XR-fretta-bcm-dpa-drop-stats-oper', False),
],
'Cisco-IOS-XR-fretta-bcm-dpa-drop-stats-oper',
'node',
_yang_ns._namespaces['Cisco-IOS-XR-fretta-bcm-dpa-drop-stats-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_fretta_bcm_dpa_drop_stats_oper'
),
},
'Drop.Nodes' : {
'meta_info' : _MetaInfoClass('Drop.Nodes',
False,
[
_MetaInfoClassMember('node', REFERENCE_LIST, 'Node' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_fretta_bcm_dpa_drop_stats_oper', 'Drop.Nodes.Node',
[], [],
''' Drop stats data for a particular node
''',
'node',
'Cisco-IOS-XR-fretta-bcm-dpa-drop-stats-oper', False),
],
'Cisco-IOS-XR-fretta-bcm-dpa-drop-stats-oper',
'nodes',
_yang_ns._namespaces['Cisco-IOS-XR-fretta-bcm-dpa-drop-stats-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_fretta_bcm_dpa_drop_stats_oper'
),
},
'Drop' : {
'meta_info' : _MetaInfoClass('Drop',
False,
[
_MetaInfoClassMember('nodes', REFERENCE_CLASS, 'Nodes' , 'ydk.models.cisco_ios_xr.Cisco_IOS_XR_fretta_bcm_dpa_drop_stats_oper', 'Drop.Nodes',
[], [],
''' Drop data per node
''',
'nodes',
'Cisco-IOS-XR-fretta-bcm-dpa-drop-stats-oper', False),
],
'Cisco-IOS-XR-fretta-bcm-dpa-drop-stats-oper',
'drop',
_yang_ns._namespaces['Cisco-IOS-XR-fretta-bcm-dpa-drop-stats-oper'],
'ydk.models.cisco_ios_xr.Cisco_IOS_XR_fretta_bcm_dpa_drop_stats_oper'
),
},
}
_meta_table['Drop.Nodes.Node.NpuNumberForDropStats.NpuNumberForDropStat.DropSpecificStatsData']['meta_info'].parent =_meta_table['Drop.Nodes.Node.NpuNumberForDropStats.NpuNumberForDropStat']['meta_info']
_meta_table['Drop.Nodes.Node.NpuNumberForDropStats.NpuNumberForDropStat']['meta_info'].parent =_meta_table['Drop.Nodes.Node.NpuNumberForDropStats']['meta_info']
_meta_table['Drop.Nodes.Node.NpuNumberForDropStats']['meta_info'].parent =_meta_table['Drop.Nodes.Node']['meta_info']
_meta_table['Drop.Nodes.Node']['meta_info'].parent =_meta_table['Drop.Nodes']['meta_info']
_meta_table['Drop.Nodes']['meta_info'].parent =_meta_table['Drop']['meta_info']
| 49.012903 | 258 | 0.576938 | 795 | 7,597 | 5.227673 | 0.109434 | 0.086622 | 0.108277 | 0.130895 | 0.774302 | 0.714629 | 0.664341 | 0.623195 | 0.568094 | 0.520693 | 0 | 0.014738 | 0.285507 | 7,597 | 154 | 259 | 49.331169 | 0.750921 | 0 | 0 | 0.433824 | 0 | 0.007353 | 0.475775 | 0.403887 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.058824 | 0 | 0.058824 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
e83e7031289be7e749092a0b52442c696186785d | 5,091 | py | Python | src/python/src/grpc/framework/foundation/_later_test.py | iMilind/grpc | f5b20ce8ec0c1dde684840f6ea8dcf80822bbb1d | [
"BSD-3-Clause"
] | 1 | 2021-04-24T08:18:15.000Z | 2021-04-24T08:18:15.000Z | src/python/src/grpc/framework/foundation/_later_test.py | iMilind/grpc | f5b20ce8ec0c1dde684840f6ea8dcf80822bbb1d | [
"BSD-3-Clause"
] | 3 | 2020-12-31T09:08:34.000Z | 2021-09-28T05:42:02.000Z | third_party/grpc/src/python/src/grpc/framework/foundation/_later_test.py | acidburn0zzz/kythe | 6cd4e9c81a1158de43ec783607a4d7edd9b7e4a0 | [
"Apache-2.0"
] | 1 | 2022-01-14T04:25:02.000Z | 2022-01-14T04:25:02.000Z | # Copyright 2015, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# * Neither the name of Google Inc. nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""Tests of the later module."""
import threading
import time
import unittest
from grpc.framework.foundation import later
TICK = 0.1
class LaterTest(unittest.TestCase):
def test_simple_delay(self):
lock = threading.Lock()
cell = [0]
return_value = object()
def computation():
with lock:
cell[0] += 1
return return_value
computation_future = later.later(TICK * 2, computation)
self.assertFalse(computation_future.done())
self.assertFalse(computation_future.cancelled())
time.sleep(TICK)
self.assertFalse(computation_future.done())
self.assertFalse(computation_future.cancelled())
with lock:
self.assertEqual(0, cell[0])
time.sleep(TICK * 2)
self.assertTrue(computation_future.done())
self.assertFalse(computation_future.cancelled())
with lock:
self.assertEqual(1, cell[0])
self.assertEqual(return_value, computation_future.result())
def test_callback(self):
lock = threading.Lock()
cell = [0]
callback_called = [False]
future_passed_to_callback = [None]
def computation():
with lock:
cell[0] += 1
computation_future = later.later(TICK * 2, computation)
def callback(outcome):
with lock:
callback_called[0] = True
future_passed_to_callback[0] = outcome
computation_future.add_done_callback(callback)
time.sleep(TICK)
with lock:
self.assertFalse(callback_called[0])
time.sleep(TICK * 2)
with lock:
self.assertTrue(callback_called[0])
self.assertTrue(future_passed_to_callback[0].done())
callback_called[0] = False
future_passed_to_callback[0] = None
computation_future.add_done_callback(callback)
with lock:
self.assertTrue(callback_called[0])
self.assertTrue(future_passed_to_callback[0].done())
def test_cancel(self):
lock = threading.Lock()
cell = [0]
callback_called = [False]
future_passed_to_callback = [None]
def computation():
with lock:
cell[0] += 1
computation_future = later.later(TICK * 2, computation)
def callback(outcome):
with lock:
callback_called[0] = True
future_passed_to_callback[0] = outcome
computation_future.add_done_callback(callback)
time.sleep(TICK)
with lock:
self.assertFalse(callback_called[0])
computation_future.cancel()
self.assertTrue(computation_future.cancelled())
self.assertFalse(computation_future.running())
self.assertTrue(computation_future.done())
with lock:
self.assertTrue(callback_called[0])
self.assertTrue(future_passed_to_callback[0].cancelled())
def test_result(self):
lock = threading.Lock()
cell = [0]
callback_called = [False]
future_passed_to_callback_cell = [None]
return_value = object()
def computation():
with lock:
cell[0] += 1
return return_value
computation_future = later.later(TICK * 2, computation)
def callback(future_passed_to_callback):
with lock:
callback_called[0] = True
future_passed_to_callback_cell[0] = future_passed_to_callback
computation_future.add_done_callback(callback)
returned_value = computation_future.result()
self.assertEqual(return_value, returned_value)
# The callback may not yet have been called! Sleep a tick.
time.sleep(TICK)
with lock:
self.assertTrue(callback_called[0])
self.assertEqual(return_value, future_passed_to_callback_cell[0].result())
if __name__ == '__main__':
unittest.main()
| 33.493421 | 80 | 0.719112 | 653 | 5,091 | 5.445636 | 0.264931 | 0.095613 | 0.051181 | 0.080427 | 0.556805 | 0.498594 | 0.45613 | 0.45613 | 0.444601 | 0.441507 | 0 | 0.01122 | 0.194657 | 5,091 | 151 | 81 | 33.715232 | 0.856098 | 0.305637 | 0 | 0.737864 | 0 | 0 | 0.002285 | 0 | 0 | 0 | 0 | 0 | 0.223301 | 1 | 0.106796 | false | 0.116505 | 0.038835 | 0 | 0.174757 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
e8417c90203dc931182a576771783829d860eca2 | 608 | py | Python | kubernetes_typed/client/models/v2beta2_metric_status.py | sobolevn/kubernetes-typed | 5f0a770631c73a9831fbeaeebac188e8f4a52c54 | [
"Apache-2.0"
] | 22 | 2020-12-10T13:06:02.000Z | 2022-02-13T21:58:15.000Z | kubernetes_typed/client/models/v2beta2_metric_status.py | sobolevn/kubernetes-typed | 5f0a770631c73a9831fbeaeebac188e8f4a52c54 | [
"Apache-2.0"
] | 4 | 2021-03-08T07:06:12.000Z | 2022-03-29T23:41:45.000Z | kubernetes_typed/client/models/v2beta2_metric_status.py | sobolevn/kubernetes-typed | 5f0a770631c73a9831fbeaeebac188e8f4a52c54 | [
"Apache-2.0"
] | 2 | 2021-09-05T19:18:28.000Z | 2022-03-14T02:56:17.000Z | # Code generated by `typeddictgen`. DO NOT EDIT.
"""V2beta2MetricStatusDict generated type."""
from typing import TypedDict
from kubernetes_typed.client import V2beta2ExternalMetricStatusDict, V2beta2ObjectMetricStatusDict, V2beta2PodsMetricStatusDict, V2beta2ResourceMetricStatusDict
V2beta2MetricStatusDict = TypedDict(
"V2beta2MetricStatusDict",
{
"external": V2beta2ExternalMetricStatusDict,
"object": V2beta2ObjectMetricStatusDict,
"pods": V2beta2PodsMetricStatusDict,
"resource": V2beta2ResourceMetricStatusDict,
"type": str,
},
total=False,
)
| 33.777778 | 160 | 0.761513 | 38 | 608 | 12.157895 | 0.710526 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.043137 | 0.161184 | 608 | 17 | 161 | 35.764706 | 0.862745 | 0.143092 | 0 | 0 | 1 | 0 | 0.102913 | 0.04466 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.153846 | 0 | 0.153846 | 0 | 0 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
e8449bc93dc7b2136a3c89b249e0217f67fedec5 | 723 | py | Python | day-07.py | analuisadev/100-Days-Of-Code | b1dafabc335cd2c3c9b1cecd50597b42d8959d4a | [
"MIT"
] | 2 | 2021-01-08T22:13:21.000Z | 2021-03-17T10:44:12.000Z | day-07.py | analuisadev/100-Days-Of-Code | b1dafabc335cd2c3c9b1cecd50597b42d8959d4a | [
"MIT"
] | null | null | null | day-07.py | analuisadev/100-Days-Of-Code | b1dafabc335cd2c3c9b1cecd50597b42d8959d4a | [
"MIT"
] | null | null | null | from random import randint
from time import sleep
print ('=' * 18)
print ('\033[1mSTONE PAPER AND SCISSORS\033[m')
print ('=' * 18)
print ('I already chose mine now missing you')
sleep (1)
computer = randint (1, 3)
player = int(input('\033[1mChoose between\033[m \033[1;33m1) Stone 2) Paper and 3) Scissors\033[m : '))
sleep(1)
if (player < computer):
print ('\033[1;33mThought about {}\033[m'.format(computer))
print ('\033[1;32mI WIN HEHE :D\033[m')
elif (player == computer):
print ('\033[1;33mThought about {}\033[m'.format(computer))
print ('\033[1;31mTIE, LET´S GO AGAIN\033[m')
else:
print ('\033[1;33mThought about {}\033[m'.format(computer))
print ('\033[1;36mYOUR LOST HAHAHA:D\033[m ')
| 36.15 | 104 | 0.658368 | 118 | 723 | 4.042373 | 0.432203 | 0.075472 | 0.113208 | 0.178197 | 0.379455 | 0.379455 | 0.379455 | 0.379455 | 0.379455 | 0.379455 | 0 | 0.144026 | 0.15491 | 723 | 19 | 105 | 38.052632 | 0.635025 | 0 | 0 | 0.368421 | 0 | 0.052632 | 0.485477 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.105263 | 0 | 0.105263 | 0.526316 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 2 |
e856d28ae91acdab7a6956c6e1799773dfe4c394 | 994 | py | Python | bleak/backends/device.py | virantha/bleak | 0226cdef0af2d6bcdf5a84d87c437ed75aaa7726 | [
"MIT"
] | null | null | null | bleak/backends/device.py | virantha/bleak | 0226cdef0af2d6bcdf5a84d87c437ed75aaa7726 | [
"MIT"
] | 1 | 2019-04-01T02:31:45.000Z | 2019-04-01T02:31:45.000Z | bleak/backends/device.py | virantha/bleak | 0226cdef0af2d6bcdf5a84d87c437ed75aaa7726 | [
"MIT"
] | 1 | 2019-04-01T01:34:42.000Z | 2019-04-01T01:34:42.000Z | # -*- coding: utf-8 -*-
"""
Wrapper class for Bluetooth LE servers returned from calling
:py:meth:`bleak.discover`.
Created on 2018-04-23 by hbldh <henrik.blidh@nedomkull.com>
"""
class BLEDevice(object):
"""A simple wrapper class representing a BLE server detected during
a `discover` call.
- When using Windows backend, `details` attribute is a
`Windows.Devices.Bluetooth.Advertisement.BluetoothLEAdvertisement` object.
- When using Linux backend, `details` attribute is a
string path to the DBus device object.
- When using macOS backend, `details` attribute will be
something else.
"""
def __init__(self, address, name, details=None, uuids=[], manufacturer_data={}):
self.address = address
self.name = name if name else "Unknown"
self.details = details
self.uuids = uuids
self.manufacturer_data = manufacturer_data
def __str__(self):
return "{0}: {1}".format(self.address, self.name)
| 30.121212 | 84 | 0.678068 | 124 | 994 | 5.346774 | 0.604839 | 0.040724 | 0.104072 | 0.075415 | 0.078431 | 0 | 0 | 0 | 0 | 0 | 0 | 0.014121 | 0.216298 | 994 | 32 | 85 | 31.0625 | 0.83697 | 0.559356 | 0 | 0 | 0 | 0 | 0.038462 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.222222 | false | 0 | 0 | 0.111111 | 0.444444 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 2 |
e85746131b4e0732b56b704dfb01f9cc40207e1c | 3,195 | py | Python | diffrax/solver/kvaerno5.py | FedericoV/diffrax | 98b010242394491fea832e77dc94f456b48495fa | [
"Apache-2.0"
] | 377 | 2022-02-07T11:13:56.000Z | 2022-03-31T18:35:51.000Z | diffrax/solver/kvaerno5.py | FedericoV/diffrax | 98b010242394491fea832e77dc94f456b48495fa | [
"Apache-2.0"
] | 25 | 2022-02-08T23:08:11.000Z | 2022-03-30T21:21:18.000Z | diffrax/solver/kvaerno5.py | FedericoV/diffrax | 98b010242394491fea832e77dc94f456b48495fa | [
"Apache-2.0"
] | 15 | 2022-02-08T04:46:23.000Z | 2022-03-30T20:53:10.000Z | import numpy as np
from ..local_interpolation import ThirdOrderHermitePolynomialInterpolation
from .runge_kutta import AbstractESDIRK, ButcherTableau
γ = 0.26
a21 = γ
a31 = 0.13
a32 = 0.84033320996790809
a41 = 0.22371961478320505
a42 = 0.47675532319799699
a43 = -0.06470895363112615
a51 = 0.16648564323248321
a52 = 0.10450018841591720
a53 = 0.03631482272098715
a54 = -0.13090704451073998
a61 = 0.13855640231268224
a62 = 0
a63 = -0.04245337201752043
a64 = 0.02446657898003141
a65 = 0.61943039072480676
a71 = 0.13659751177640291
a72 = 0
a73 = -0.05496908796538376
a74 = -0.04118626728321046
a75 = 0.62993304899016403
a76 = 0.06962479448202728
# Predictors taken from
# https://github.com/SciML/OrdinaryDiffEq.jl/blob/54fb35870fa402fc95d665cd5f9502e2759ea436/src/tableaus/sdirk_tableaus.jl#L1444 # noqa: E501
# https://github.com/SciML/OrdinaryDiffEq.jl/blob/54fb35870fa402fc95d665cd5f9502e2759ea436/src/perform_step/kencarp_kvaerno_perform_step.jl#L1123 # noqa: E501
# This is with the exception of α21, which is mistakenly set to zero.
#
# See also /devdocs/predictor_dirk.md
α21 = 1.0
α31 = -1.366025403784441
α32 = 2.3660254037844357
α41 = -0.19650552613122207
α42 = 0.8113579546496623
α43 = 0.38514757148155954
α51 = 0.10375304369958693
α52 = 0.937994698066431
α53 = -0.04174774176601781
α61 = -0.17281112873898072
α62 = 0.6235784481025847
α63 = 0.5492326806363959
α71 = a61
α72 = a62
α73 = a63
α74 = a64
α75 = a65
α76 = γ
_kvaerno5_tableau = ButcherTableau(
a_lower=(
np.array([a21]),
np.array([a31, a32]),
np.array([a41, a42, a43]),
np.array([a51, a52, a53, a54]),
np.array([a61, a62, a63, a64, a65]),
np.array([a71, a72, a73, a74, a75, a76]),
),
a_diagonal=np.array([0, γ, γ, γ, γ, γ, γ]),
a_predictor=(
np.array([α21]),
np.array([α31, α32]),
np.array([α41, α42, α43]),
np.array([α51, α52, α53, 0]),
np.array([α61, α62, α63, 0, 0]),
np.array([α71, α72, α73, α74, α75, α76]),
),
b_sol=np.array([a71, a72, a73, a74, a75, a76, γ]),
b_error=np.array(
[a71 - a61, a72 - a62, a73 - a63, a74 - a64, a75 - a65, a76 - γ, γ]
),
c=np.array(
[0.52, 1.230333209967908, 0.8957659843500759, 0.43639360985864756, 1.0, 1.0]
),
)
class Kvaerno5(AbstractESDIRK):
r"""Kvaerno's 5/4 method.
A-L stable stiffly accurate 5th order ESDIRK method. Has an embedded 4th order
method for adaptive step sizing. Uses 7 stages.
When solving an ODE over the interval $[t_0, t_1]$, note that this method will make
some evaluations slightly past $t_1$.
??? cite "Reference"
```bibtex
@article{kvaerno2004singly,
title={Singly diagonally implicit Runge--Kutta methods with an explicit first
stage},
author={Kv{\ae}rn{\o}, Anne},
journal={BIT Numerical Mathematics},
volume={44},
number={3},
pages={489--502},
year={2004},
publisher={Springer}
}
```
"""
tableau = _kvaerno5_tableau
interpolation_cls = ThirdOrderHermitePolynomialInterpolation.from_k
def order(self, terms):
return 5
| 28.274336 | 159 | 0.662285 | 416 | 3,195 | 5.033654 | 0.514423 | 0.053486 | 0.005731 | 0.005731 | 0.105062 | 0.102197 | 0.102197 | 0.102197 | 0.078319 | 0 | 0 | 0.345694 | 0.215023 | 3,195 | 112 | 160 | 28.526786 | 0.489234 | 0.333959 | 0 | 0.053333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.013333 | false | 0 | 0.04 | 0.013333 | 0.106667 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
e865943b38c7fa0a91f989744dd08a3debd48239 | 400 | py | Python | ecommerce/cart/migrations/0023_auto_20210314_1656.py | MirjahonMirsaidov/ecommerce-web-app | 22d0fe5648b7acb5f819f7634abcf61b6bc12ed9 | [
"Unlicense"
] | null | null | null | ecommerce/cart/migrations/0023_auto_20210314_1656.py | MirjahonMirsaidov/ecommerce-web-app | 22d0fe5648b7acb5f819f7634abcf61b6bc12ed9 | [
"Unlicense"
] | null | null | null | ecommerce/cart/migrations/0023_auto_20210314_1656.py | MirjahonMirsaidov/ecommerce-web-app | 22d0fe5648b7acb5f819f7634abcf61b6bc12ed9 | [
"Unlicense"
] | null | null | null | # Generated by Django 3.1.2 on 2021-03-14 11:56
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cart', '0022_delete_sendpassword'),
]
operations = [
migrations.AlterField(
model_name='orderbeta',
name='finish_price',
field=models.PositiveIntegerField(default=0),
),
]
| 21.052632 | 57 | 0.6125 | 41 | 400 | 5.878049 | 0.853659 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.069204 | 0.2775 | 400 | 18 | 58 | 22.222222 | 0.764706 | 0.1125 | 0 | 0 | 1 | 0 | 0.13881 | 0.067989 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.083333 | 0.083333 | 0 | 0.333333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
e8a6d1ef969a737bdcd7f9ccf6c5ef2da1f6db6f | 268 | py | Python | src/utils/utils.py | chokyzhou/gym-flappy-bird | ffe1089501f3e2e113a8868cd27480653dbe0ef7 | [
"MIT"
] | null | null | null | src/utils/utils.py | chokyzhou/gym-flappy-bird | ffe1089501f3e2e113a8868cd27480653dbe0ef7 | [
"MIT"
] | null | null | null | src/utils/utils.py | chokyzhou/gym-flappy-bird | ffe1089501f3e2e113a8868cd27480653dbe0ef7 | [
"MIT"
] | null | null | null | import math
def obs2state(obs, multiplier=1000):
x_pos = int(math.floor(obs[0]*multiplier))
y_pos = int(math.floor(obs[1]*multiplier))
y_vel = y_vel = int(obs[2])
state_string = str(x_pos) + '_' + str(y_pos) + '_' + str(y_vel)
return state_string | 29.777778 | 67 | 0.649254 | 44 | 268 | 3.704545 | 0.454545 | 0.07362 | 0.122699 | 0.184049 | 0.220859 | 0 | 0 | 0 | 0 | 0 | 0 | 0.036697 | 0.186567 | 268 | 9 | 68 | 29.777778 | 0.711009 | 0 | 0 | 0 | 0 | 0 | 0.007435 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0.142857 | 0 | 0.428571 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 |
e8be64b0dcdd575acf275b088a14909677a52a3e | 1,627 | py | Python | DataAnalysis/test.py | yuxiang-zhou/MarketAnalysor | 4d19d2589d07409cd699f394921d1a95f3097e94 | [
"MIT"
] | null | null | null | DataAnalysis/test.py | yuxiang-zhou/MarketAnalysor | 4d19d2589d07409cd699f394921d1a95f3097e94 | [
"MIT"
] | null | null | null | DataAnalysis/test.py | yuxiang-zhou/MarketAnalysor | 4d19d2589d07409cd699f394921d1a95f3097e94 | [
"MIT"
] | null | null | null | import urllib2
import threading
from bs4 import BeautifulSoup
import re
import json
import sys
import os
import django
from stock_list import getlist, getLSEList
from extract_stock_info import get_info, getLSEInfo
from extract_stock_history import get_historical_info
from extract_sector_history import get_sector_history, get_sector_dict
from extract_stock_news import get_stock_news
from extract_NT_transactions import get_NT_transactions
import time
from pymongo import MongoClient
import warnings
import exceptions
warnings.filterwarnings("ignore", category=exceptions.RuntimeWarning, module='django.db.backends.sqlite3.base', lineno=53)
if __name__ == '__main__':
path = os.path.abspath(os.path.join(os.path.dirname(__file__), '../MADjangoProject'))
if not path in sys.path:
sys.path.insert(1, path)
del path
os.environ['DJANGO_SETTINGS_MODULE'] = 'MADjangoProject.settings'
django.setup()
from market.models import Stock, StockHistory, SectorHistory
sec_dict = get_sector_dict()
print 'Fethcing Indices...'
ALL_Stocks = getLSEList(collection=Stock)
def get_share_info():
for share in ALL_Stocks:
print 'Fetching info of ' + share['name']
info = getLSEInfo(share['query'], share['symbol'],collection=Stock, sector_dict=sec_dict)
import threading
print 'Distributing Jobs ...'
threads = []
# callables = [get_nt]
callables = [get_share_info]
for f in callables:
t = threading.Thread(target=f)
t.setDaemon(True)
threads.append(t)
t.start()
for t in threads:
t.join()
| 29.053571 | 122 | 0.728949 | 211 | 1,627 | 5.393365 | 0.421801 | 0.04833 | 0.042179 | 0.026362 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.004525 | 0.185003 | 1,627 | 55 | 123 | 29.581818 | 0.853695 | 0.012293 | 0 | 0.044444 | 0 | 0 | 0.112773 | 0.047975 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0.444444 | null | null | 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 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
e8c391255b56e4ff6feefeae210b186373cc9c99 | 372 | py | Python | pyml/crawler/minispider/mini_spider.py | onehao/opensource | e34784fcc294094a4ce0decd0e6809c11a96bbf7 | [
"Apache-2.0"
] | null | null | null | pyml/crawler/minispider/mini_spider.py | onehao/opensource | e34784fcc294094a4ce0decd0e6809c11a96bbf7 | [
"Apache-2.0"
] | 1 | 2015-07-15T02:11:41.000Z | 2015-07-15T02:30:34.000Z | pyml/crawler/minispider/mini_spider.py | onehao/opensource | e34784fcc294094a4ce0decd0e6809c11a96bbf7 | [
"Apache-2.0"
] | 1 | 2018-09-11T12:52:30.000Z | 2018-09-11T12:52:30.000Z | # -*- coding:utf-8 -*-
'''
Created on 2015年3月2日
@author: wanhao01
'''
import sys
from crawler.minispider import logerror
import main
reload(sys)
sys.setdefaultencoding('utf-8')
if __name__ == '__main__':
try:
main.main()
except Exception as exception:
logerror("error during running, details: " + str(exception))
pass | 16.909091 | 69 | 0.629032 | 41 | 372 | 5.512195 | 0.707317 | 0.035398 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.035842 | 0.25 | 372 | 22 | 70 | 16.909091 | 0.774194 | 0.163978 | 0 | 0 | 0 | 0 | 0.155477 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.090909 | 0.272727 | 0 | 0.272727 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 2 |
e8d389d59d2e598814e8742d6ed48d600f563413 | 436 | py | Python | cape_privacy/pandas/transformations/test_utils.py | vismaya-Kalaiselvan/cape-python | 2b93696cec43c4bab9098c35eccf6f2f66d9e5c0 | [
"Apache-2.0"
] | 144 | 2020-06-23T21:31:49.000Z | 2022-02-25T15:51:00.000Z | cape_privacy/pandas/transformations/test_utils.py | vismaya-Kalaiselvan/cape-python | 2b93696cec43c4bab9098c35eccf6f2f66d9e5c0 | [
"Apache-2.0"
] | 44 | 2020-06-24T14:42:23.000Z | 2022-02-21T03:30:58.000Z | cape_privacy/pandas/transformations/test_utils.py | vismaya-Kalaiselvan/cape-python | 2b93696cec43c4bab9098c35eccf6f2f66d9e5c0 | [
"Apache-2.0"
] | 16 | 2020-06-26T20:05:51.000Z | 2022-01-12T05:23:58.000Z | import pandas as pd
class PlusN:
"""A sample transform that adds n to a specific field.
Attributes:
field: The field that this transform will be applied to.
n: The value to add to the field.
"""
identifier = "plusN"
type_signature = "col->col"
def __init__(self, n: int = 1) -> None:
self.n = n
def __call__(self, column: pd.Series) -> pd.Series:
return column + self.n
| 21.8 | 64 | 0.607798 | 63 | 436 | 4.063492 | 0.587302 | 0.058594 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.003257 | 0.295872 | 436 | 19 | 65 | 22.947368 | 0.830619 | 0.373853 | 0 | 0 | 0 | 0 | 0.052 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.125 | 0.125 | 0.875 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 2 |
2cdb285432c69bfe1c1fbf5662fc9c8781add56e | 766 | py | Python | tests/fixtures.py | luisfmcalado/coinoxr | e7cf95d717aa9b58e458332bfd6fd2d4172d175f | [
"MIT"
] | 2 | 2020-09-05T20:48:54.000Z | 2022-03-28T11:00:15.000Z | tests/fixtures.py | luisfmcalado/coinoxr | e7cf95d717aa9b58e458332bfd6fd2d4172d175f | [
"MIT"
] | null | null | null | tests/fixtures.py | luisfmcalado/coinoxr | e7cf95d717aa9b58e458332bfd6fd2d4172d175f | [
"MIT"
] | null | null | null | import pytest
from tests.stub_client import StubHttpClient
from coinoxr.requestor import Requestor
from coinoxr.response import Response
def content(file):
return StubHttpClient.json(file)["content"]
@pytest.fixture
def client():
client = StubHttpClient()
client.add_app_id("fake_app_id")
client.add_date("2012-07-10")
client.add_date("2012-07-12")
return client
@pytest.fixture
def client_get_mock(mocker):
def client_get_mock(status_code, json):
response = Response(status_code, json)
client = mocker.Mock(StubHttpClient)
client.get = mocker.Mock(return_value=response)
return client
return client_get_mock
@pytest.fixture
def requestor(client):
return Requestor("fake_app_id", client)
| 21.885714 | 55 | 0.73107 | 100 | 766 | 5.42 | 0.31 | 0.066421 | 0.088561 | 0.081181 | 0.070111 | 0 | 0 | 0 | 0 | 0 | 0 | 0.025276 | 0.173629 | 766 | 34 | 56 | 22.529412 | 0.830964 | 0 | 0 | 0.208333 | 0 | 0 | 0.063969 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.208333 | false | 0 | 0.166667 | 0.083333 | 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 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
2cf7266e9b31c455b918042035a8554f33eeaf4b | 143 | py | Python | test/unit/__init__.py | comtravo/grafana-dashboards | cd0e6f46408aebd2941ae4abc5b94e45124006a2 | [
"MIT"
] | 8 | 2020-12-09T13:14:53.000Z | 2022-01-29T01:56:30.000Z | test/unit/__init__.py | comtravo/grafana-dashboards | cd0e6f46408aebd2941ae4abc5b94e45124006a2 | [
"MIT"
] | 4 | 2021-02-24T08:49:14.000Z | 2022-01-22T18:17:32.000Z | test/unit/__init__.py | comtravo/grafana-dashboards | cd0e6f46408aebd2941ae4abc5b94e45124006a2 | [
"MIT"
] | null | null | null | """
tests module
"""
import os
import sys
import sure
ROOT_DIR = os.path.join(os.path.dirname(__file__), "../..")
sys.path.append(ROOT_DIR)
| 11.916667 | 59 | 0.685315 | 22 | 143 | 4.181818 | 0.590909 | 0.152174 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.125874 | 143 | 11 | 60 | 13 | 0.736 | 0.083916 | 0 | 0 | 0 | 0 | 0.04065 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.6 | 0 | 0.6 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 2 |
2cf913172f053454c3779f2bdd6081d51582533f | 175 | py | Python | blog/templatetags/markdownify.py | darkLord19/blog | 16c3b72fef9d22ccfa606934c8b94fc0feb82103 | [
"MIT"
] | 12 | 2018-01-30T00:44:06.000Z | 2020-07-13T05:20:48.000Z | blog/templatetags/markdownify.py | darkLord19/blog | 16c3b72fef9d22ccfa606934c8b94fc0feb82103 | [
"MIT"
] | 36 | 2018-03-06T17:49:50.000Z | 2020-06-23T19:26:00.000Z | web/templatetags/markdown.py | odinje/yactff | d55ece2905ca49114f7ec15bbcd354cacb49b973 | [
"MIT"
] | 3 | 2018-08-03T07:03:09.000Z | 2020-07-09T20:21:10.000Z | from django import template
import mistune
register = template.Library()
@register.filter
def markdown(value):
markdown = mistune.Markdown()
return markdown(value)
| 15.909091 | 33 | 0.754286 | 20 | 175 | 6.6 | 0.6 | 0.19697 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.16 | 175 | 10 | 34 | 17.5 | 0.897959 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.142857 | false | 0 | 0.285714 | 0 | 0.571429 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 2 |
fa01295cd72e1cc24e99fe0b555865e4e352a352 | 844 | py | Python | cqi_cpp/src/wrapper/discrete.py | AMR-/Conservative-Q-Improvement | f9d47b33fe757475d3216d3c406d147206738c90 | [
"MIT"
] | null | null | null | cqi_cpp/src/wrapper/discrete.py | AMR-/Conservative-Q-Improvement | f9d47b33fe757475d3216d3c406d147206738c90 | [
"MIT"
] | null | null | null | cqi_cpp/src/wrapper/discrete.py | AMR-/Conservative-Q-Improvement | f9d47b33fe757475d3216d3c406d147206738c90 | [
"MIT"
] | null | null | null | import numpy as np
from .space import Space
class Discrete(Space):
r"""A discrete space in :math:`\{ 0, 1, \\dots, n-1 \}`.
Example::
>>> Discrete(2)
"""
def __init__(self, n):
assert n >= 0
self.n = n
super(Discrete, self).__init__((), np.int64)
def sample(self):
return self.np_random.randint(self.n)
def contains(self, x):
if isinstance(x, int):
as_int = x
elif isinstance(x, (np.generic, np.ndarray)) and (x.dtype.kind in np.typecodes['AllInteger'] and x.shape == ()):
as_int = int(x)
else:
return False
return as_int >= 0 and as_int < self.n
def __repr__(self):
return "Discrete(%d)" % self.n
def __eq__(self, other):
return isinstance(other, Discrete) and self.n == other.n
| 24.823529 | 120 | 0.555687 | 117 | 844 | 3.82906 | 0.410256 | 0.066964 | 0.053571 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.013605 | 0.303318 | 844 | 33 | 121 | 25.575758 | 0.748299 | 0.099526 | 0 | 0 | 0 | 0 | 0.02973 | 0 | 0 | 0 | 0 | 0 | 0.045455 | 1 | 0.227273 | false | 0 | 0.090909 | 0.136364 | 0.590909 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 2 |
fa0387e8bd74f0b0f503dfeea41eb47cd54c1fe4 | 1,331 | py | Python | src/lockstep/models/arheaderinfomodel.py | sfwatanabe/lockstep-sdk-python | b388c818663a4b090debb68c65c18728a082fec0 | [
"MIT"
] | 1 | 2022-03-17T00:23:24.000Z | 2022-03-17T00:23:24.000Z | src/lockstep/models/arheaderinfomodel.py | sfwatanabe/lockstep-sdk-python | b388c818663a4b090debb68c65c18728a082fec0 | [
"MIT"
] | null | null | null | src/lockstep/models/arheaderinfomodel.py | sfwatanabe/lockstep-sdk-python | b388c818663a4b090debb68c65c18728a082fec0 | [
"MIT"
] | null | null | null | #
# Lockstep Software Development Kit for Python
#
# (c) 2021-2022 Lockstep, Inc.
#
# For the full copyright and license information, please view the LICENSE
# file that was distributed with this source code.
#
# @author Ted Spence <tspence@lockstep.io>
# @copyright 2021-2022 Lockstep, Inc.
# @version 2022.4
# @link https://github.com/Lockstep-Network/lockstep-sdk-python
#
from dataclasses import dataclass
@dataclass
class ArHeaderInfoModel:
"""
Aggregated Accounts Receivable information.
"""
groupKey: str = None
reportPeriod: str = None
totalCustomers: int = None
totalInvoices: int = None
totalInvoicedAmount: float = None
totalUnappliedPayments: float = None
totalCollected: float = None
totalArAmount: float = None
totalInvoicesPaid: int = None
totalInvoicesPastDue: int = None
totalInvoices90DaysPastDue: int = None
totalPastDueAmount: float = None
totalPastDueAmount90Days: float = None
percentageOfTotalAr: float = None
dso: float = None
totalInvoiceAmountCurrentYear: float = None
totalInvoiceAmountPreviousYear: float = None
totalPaymentAmountCurrentYear: float = None
totalCollectedPastThirtyDays: int = None
totalInvoicesPaidPastThirtyDays: int = None
percentageOfTotalAr90DaysPastDue: float = None
| 28.934783 | 73 | 0.731029 | 127 | 1,331 | 7.661417 | 0.574803 | 0.110997 | 0.032888 | 0.039054 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.025352 | 0.19985 | 1,331 | 45 | 74 | 29.577778 | 0.888263 | 0.306536 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.041667 | 0 | 0.958333 | 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 | 0 | 0 | 1 | 0 | 0 | 2 |
fa1043f553e1c60667839cc0926b5837cdef559f | 576 | py | Python | api/views.py | AktanKasymaliev/django_blog_site_fullstack | 146a03a58c12bf61ff32cadfbb66e7f0ecbcf6b1 | [
"MIT"
] | 1 | 2021-06-29T15:17:06.000Z | 2021-06-29T15:17:06.000Z | api/views.py | AktanKasymaliev/django_blog_site_fullstack | 146a03a58c12bf61ff32cadfbb66e7f0ecbcf6b1 | [
"MIT"
] | null | null | null | api/views.py | AktanKasymaliev/django_blog_site_fullstack | 146a03a58c12bf61ff32cadfbb66e7f0ecbcf6b1 | [
"MIT"
] | null | null | null | from rest_framework import generics
from blogs.models import Comments
from .serializers import CommentsSerializer, UsersSerializers
from rest_framework.permissions import AllowAny, IsAuthenticated, IsAdminUser
from customUsers.models import User
class CommentsView(generics.CreateAPIView):
serializer_class = CommentsSerializer
queryset = Comments.objects.all()
permission_classes = [IsAuthenticated]
# Users
class UsersView(generics.ListAPIView):
serializer_class = UsersSerializers
queryset = User.objects.all()
permission_classes = [IsAdminUser]
| 33.882353 | 77 | 0.8125 | 57 | 576 | 8.105263 | 0.508772 | 0.034632 | 0.073593 | 0.116883 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.128472 | 576 | 16 | 78 | 36 | 0.920319 | 0.008681 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.384615 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
fa11053785bbc9426fa980dd1bd5615c9a3ba8c5 | 562 | py | Python | client/__init__.py | mycelium-ethereum/punk-offerbook | 5804a27fe26af0d613fd5281f0f17b9c207f1822 | [
"MIT"
] | null | null | null | client/__init__.py | mycelium-ethereum/punk-offerbook | 5804a27fe26af0d613fd5281f0f17b9c207f1822 | [
"MIT"
] | null | null | null | client/__init__.py | mycelium-ethereum/punk-offerbook | 5804a27fe26af0d613fd5281f0f17b9c207f1822 | [
"MIT"
] | null | null | null | from dotenv import load_dotenv
load_dotenv();
import os
import json
import settings
from web3 import Web3
from client.Mongo import Mongo
from client.Webhook import webhook
from client.Opensea import Opensea
def get_raw_abis(abi_paths):
raw_abis = {}
for abi_key, abi_path in abi_paths.items():
with open(abi_path, "r") as f:
raw_abis[abi_key] = json.loads(f.read())['abi']
return raw_abis
abis = get_raw_abis(settings.ABI_PATHS)
web3 = Web3(Web3.HTTPProvider(os.environ.get("ETH_HTTP_URL")))
mongo = Mongo()
opensea = Opensea() | 25.545455 | 62 | 0.731317 | 89 | 562 | 4.41573 | 0.404494 | 0.089059 | 0.050891 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.010661 | 0.16548 | 562 | 22 | 63 | 25.545455 | 0.827292 | 0 | 0 | 0 | 0 | 0 | 0.028419 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.052632 | false | 0 | 0.421053 | 0 | 0.526316 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.