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
0c9b6c9c5f4b186068f0fcfe5f2c329ce7772e4d
740
py
Python
Module 2/Chapter08/template_simple.py
real-slim-chadi/Python_Master-the-Art-of-Design-Patterns
95ec92272374e330b04d931208abbb184c7c7908
[ "MIT" ]
73
2016-09-15T23:07:04.000Z
2022-03-05T15:09:48.000Z
Module 2/Chapter08/template_simple.py
real-slim-chadi/Python_Master-the-Art-of-Design-Patterns
95ec92272374e330b04d931208abbb184c7c7908
[ "MIT" ]
null
null
null
Module 2/Chapter08/template_simple.py
real-slim-chadi/Python_Master-the-Art-of-Design-Patterns
95ec92272374e330b04d931208abbb184c7c7908
[ "MIT" ]
51
2016-10-07T20:47:51.000Z
2021-12-22T21:00:24.000Z
__author__ = 'Chetan' from abc import ABCMeta, abstractmethod class AbstractClass(metaclass=ABCMeta): def __init__(self): pass @abstractmethod def operation1(self): pass @abstractmethod def operation2(self): pass def template_method(self): print("Defining the Algorithm. Operation1 follows Operation2") self.operation2() self.operation1() class ConcreteClass(AbstractClass): def operation1(self): print("My Concrete Operation1") def operation2(self): print("Operation 2 remains same") class Client: def main(self): self.concreate = ConcreteClass() self.concreate.template_method() client = Client() client.main()
19.473684
70
0.660811
74
740
6.472973
0.445946
0.11691
0.091858
0.104384
0
0
0
0
0
0
0
0.017953
0.247297
740
38
71
19.473684
0.842011
0
0
0.346154
0
0
0.1417
0
0
0
0
0
0
1
0.269231
false
0.115385
0.038462
0
0.423077
0.115385
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
0
0
0
2
0cb6a5d9b64c81ee9b97838a133419cdba2cb50d
326
py
Python
benchmark/mysql_benchmark.py
AlonFischer/SpatialDatabaseBench
1fe933bd4196ba17c687f04c37cb5a34acc6d824
[ "Apache-2.0" ]
1
2020-11-17T22:56:56.000Z
2020-11-17T22:56:56.000Z
benchmark/mysql_benchmark.py
AlonFischer/SpatialDatabaseBench
1fe933bd4196ba17c687f04c37cb5a34acc6d824
[ "Apache-2.0" ]
null
null
null
benchmark/mysql_benchmark.py
AlonFischer/SpatialDatabaseBench
1fe933bd4196ba17c687f04c37cb5a34acc6d824
[ "Apache-2.0" ]
null
null
null
from benchmark.benchmark import Benchmark from mysqlutils.mysqladapter import MySQLAdapter class MysqlBenchmark(Benchmark): """Abstract parent class for mysql benchmarks""" def __init__(self, adapter, title, repeat_count=7): super().__init__(title, repeat_count=repeat_count) self.adapter = adapter
29.636364
58
0.754601
37
326
6.351351
0.567568
0.140426
0.13617
0
0
0
0
0
0
0
0
0.003663
0.162577
326
10
59
32.6
0.857143
0.128834
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
0cc0715c89b9cf37ccc8268295889e035e429cd7
4,118
py
Python
forms.py
godsgift/gdohs
fc7fa4e010b7c508c3c1154255fa2ded0534fb1d
[ "MIT" ]
null
null
null
forms.py
godsgift/gdohs
fc7fa4e010b7c508c3c1154255fa2ded0534fb1d
[ "MIT" ]
null
null
null
forms.py
godsgift/gdohs
fc7fa4e010b7c508c3c1154255fa2ded0534fb1d
[ "MIT" ]
null
null
null
from flask_wtf import Form from wtforms import TextField, PasswordField, validators, IntegerField, BooleanField, SelectField, SubmitField from wtforms.validators import Required, Length, Email, ValidationError, Regexp, EqualTo, NumberRange from wtforms.widgets import SubmitInput class SignUp(Form): username = TextField("Username", validators=[Required("Please provide a username without any spaces"), Length(min=4, max=20), Regexp(r'^[\w.@+-]+$', message="Please provide a username without any spaces")]) password = PasswordField("Password", validators=[Required("Please pick a secure password"), Regexp(r'^[\w.@+-]+$', message="Please provide a password without any spaces")]) email = TextField("Email", validators=[Required("Please provide a valid email address"), Length(min=6, max=35), Email(message="That is not a valid email address"), Regexp(r'^[\w.@+-]+$', message="Please provide an email without any spaces")]) firstname = TextField("First Name", validators=[Required("Please provide your first name"), Regexp(r'^[\w.@+-]+$', message="Please enter your first name without any spaces")]) lastname = TextField("Last Name", validators=[Required("Please provide your last name"), Regexp(r'^[\w.@+-]+$', message="Please enter your last name without any spaces")]) class Login(Form): username = TextField("Username", validators=[Required("Please provide a username without any spaces"), Length(min=4, max=20), Regexp(r'^[\w.@+-]+$', message="Please provide a username without any spaces")]) password = PasswordField("Password", validators=[Required("Please pick a secure password"), Regexp(r'^[\w.@+-]+$', message="Please provide a password without any spaces")]) class ForgotPassword(Form): email = TextField("Email", validators=[Required("Please provide a valid email address"), Length(min=6, max=35), Email(message="That is not a valid email address"), Regexp(r'^[\w.@+-]+$', message="Please provide an email without any spaces")]) class NewPassword(Form): password = PasswordField("Password", validators=[Required("Please pick a secure password"), Regexp(r'^[\w.@+-]+$', message="Please provide a password without any spaces")]) confirm_password = PasswordField("Confirm Password", validators=[Required("Required"), Regexp(r'^[\w.@+-]+$', message="Please provide a password without any spaces"), EqualTo("password", message="Passwords must match")]) class ChangePassword(Form): current_password = PasswordField("Current Password", validators=[Required("Please type in your current password"), Regexp(r'^[\w.@+-]+$', message="Please provide a password without any spaces")]) password = PasswordField("New Password", validators=[Required("Please pick a secure password"), Regexp(r'^[\w.@+-]+$', message="Please provide a password without any spaces")]) confirm_password = PasswordField("Confirm Password", validators=[Required("Password must match with new password"), Regexp(r'^[\w.@+-]+$', message="Please provide a password without any spaces"), EqualTo("password", message="Password must match with new password")]) class CamSettings(Form): brightness = IntegerField("Brightness", default=50, validators=[Required("Please choose a number between 0 and 100"), NumberRange(min=0, max=100, message="Please choose a number between 0 and 100")]) resolution = SelectField("Video/Image Resolution: ", choices=[("320x240", "320 x 240"), ("640x480", "640 x 480"), ("800x600", "800 x 600")], default="640x480", validators=[(Required("Required"))]) hflip = BooleanField("Horizontal Flip: ", default=False) vflip = BooleanField("Vertical Flip: ", default=False) class Recording(Form): start = SubmitField("Start Recording") stop = SubmitField("Stop Recording") class LicensePlate(Form): license = TextField("License Plate", validators=[Required("Please provide a license plate without any spaces"), Length(min=4, max=10), Regexp(r'^[\w.@+-]+$', message="Please provide a license plate without any spaces")]) class ForceLock(Form): forcelock = SubmitField("Force Lock") class GarageDoor(Form): opengarage = SubmitField("Open Garage")
52.126582
118
0.723409
513
4,118
5.79922
0.220273
0.083025
0.091429
0.070588
0.63563
0.622521
0.577479
0.568067
0.49479
0.49479
0
0.019505
0.116076
4,118
78
119
52.794872
0.797802
0
0
0.357143
0
0
0.432492
0
0
0
0
0
0
1
0
false
0.357143
0.071429
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
1
0
0
1
0
0
2
0cc31eec76a99a4705096b18e21f9ea4dd88bce8
523
py
Python
web/pyshop/admin.py
Andrew7891-kip/Ecommerce-pyshop
2eaa7b553789b65992cbd80f80a68fcf25ef0efd
[ "Apache-2.0" ]
null
null
null
web/pyshop/admin.py
Andrew7891-kip/Ecommerce-pyshop
2eaa7b553789b65992cbd80f80a68fcf25ef0efd
[ "Apache-2.0" ]
null
null
null
web/pyshop/admin.py
Andrew7891-kip/Ecommerce-pyshop
2eaa7b553789b65992cbd80f80a68fcf25ef0efd
[ "Apache-2.0" ]
null
null
null
from django.contrib import admin from .models import * class ProductAdmin(admin.ModelAdmin): list_display=['name','category','price_is'] prepopulated_fields = {"slug": ("name",)} class CartAdmin(admin.ModelAdmin): list_display=['item','user','created'] class OrderAdmin(admin.ModelAdmin): list_display=['user','ordered'] admin.site.register(Product,ProductAdmin) admin.site.register(Cart,CartAdmin) admin.site.register(Order,OrderAdmin) admin.site.register(Checkout) # Register your models here.
20.115385
47
0.743786
62
523
6.193548
0.516129
0.09375
0.177083
0.203125
0
0
0
0
0
0
0
0
0.108987
523
25
48
20.92
0.824034
0.049713
0
0
0
0
0.109091
0
0
0
0
0
0
1
0
false
0
0.153846
0
0.692308
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
0ccde3d4f64a774d9d8fa84b6c6fe3d0ad69c35d
3,997
py
Python
backup/guitemplates/custominvocationcutdurationdialog.py
calebtrahan/KujiIn_Python
0599d36993fa1d5988a4cf3206a12fdbe63781d8
[ "MIT" ]
null
null
null
backup/guitemplates/custominvocationcutdurationdialog.py
calebtrahan/KujiIn_Python
0599d36993fa1d5988a4cf3206a12fdbe63781d8
[ "MIT" ]
null
null
null
backup/guitemplates/custominvocationcutdurationdialog.py
calebtrahan/KujiIn_Python
0599d36993fa1d5988a4cf3206a12fdbe63781d8
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'custominvocationcutdurationdialog.ui' # # Created by: PyQt4 UI code generator 4.11.2 # # WARNING! All changes made in this file will be lost! from PyQt4 import QtCore, QtGui try: _fromUtf8 = QtCore.QString.fromUtf8 except AttributeError: def _fromUtf8(s): return s try: _encoding = QtGui.QApplication.UnicodeUTF8 def _translate(context, text, disambig): return QtGui.QApplication.translate(context, text, disambig, _encoding) except AttributeError: def _translate(context, text, disambig): return QtGui.QApplication.translate(context, text, disambig) class Ui_custominvocationcutdurationdialog(object): def setupUi(self, custominvocationcutdurationdialog): custominvocationcutdurationdialog.setObjectName(_fromUtf8("custominvocationcutdurationdialog")) custominvocationcutdurationdialog.resize(400, 213) self.custominvocationtopLabel = QtGui.QLabel(custominvocationcutdurationdialog) self.custominvocationtopLabel.setGeometry(QtCore.QRect(90, 10, 221, 16)) self.custominvocationtopLabel.setObjectName(_fromUtf8("custominvocationtopLabel")) self.custominvocationcutsLabel = QtGui.QLabel(custominvocationcutdurationdialog) self.custominvocationcutsLabel.setGeometry(QtCore.QRect(11, 30, 381, 20)) self.custominvocationcutsLabel.setAlignment(QtCore.Qt.AlignCenter) self.custominvocationcutsLabel.setObjectName(_fromUtf8("custominvocationcutsLabel")) self.horizontalLayoutWidget = QtGui.QWidget(custominvocationcutdurationdialog) self.horizontalLayoutWidget.setGeometry(QtCore.QRect(130, 60, 160, 80)) self.horizontalLayoutWidget.setObjectName(_fromUtf8("horizontalLayoutWidget")) self.custominvocationLayout = QtGui.QHBoxLayout(self.horizontalLayoutWidget) self.custominvocationLayout.setMargin(0) self.custominvocationLayout.setObjectName(_fromUtf8("custominvocationLayout")) self.custominvocationValue = QtGui.QSpinBox(self.horizontalLayoutWidget) self.custominvocationValue.setObjectName(_fromUtf8("custominvocationValue")) self.custominvocationLayout.addWidget(self.custominvocationValue) self.custominvocationminLabel = QtGui.QLabel(self.horizontalLayoutWidget) self.custominvocationminLabel.setObjectName(_fromUtf8("custominvocationminLabel")) self.custominvocationLayout.addWidget(self.custominvocationminLabel) self.custominvocationaddButton = QtGui.QPushButton(custominvocationcutdurationdialog) self.custominvocationaddButton.setGeometry(QtCore.QRect(160, 170, 131, 30)) self.custominvocationaddButton.setObjectName(_fromUtf8("custominvocationaddButton")) self.custominvocationcancelButton = QtGui.QPushButton(custominvocationcutdurationdialog) self.custominvocationcancelButton.setGeometry(QtCore.QRect(300, 170, 84, 30)) self.custominvocationcancelButton.setObjectName(_fromUtf8("custominvocationcancelButton")) self.retranslateUi(custominvocationcutdurationdialog) QtCore.QMetaObject.connectSlotsByName(custominvocationcutdurationdialog) def retranslateUi(self, custominvocationcutdurationdialog): custominvocationcutdurationdialog.setWindowTitle(_translate("custominvocationcutdurationdialog", "Dialog", None)) self.custominvocationtopLabel.setText(_translate("custominvocationcutdurationdialog", "How Long Would You Like To Invoke:", None)) self.custominvocationcutsLabel.setText(_translate("custominvocationcutdurationdialog", "Cuts Here", None)) self.custominvocationminLabel.setText(_translate("custominvocationcutdurationdialog", "min", None)) self.custominvocationaddButton.setText(_translate("custominvocationcutdurationdialog", "ADD TO SESSION", None)) self.custominvocationcancelButton.setText(_translate("custominvocationcutdurationdialog", "CANCEL", None))
60.560606
138
0.788341
305
3,997
10.259016
0.360656
0.060403
0.035155
0.035794
0.052413
0.052413
0.052413
0.052413
0.052413
0.052413
0
0.021789
0.127346
3,997
65
139
61.492308
0.875287
0.051789
0
0.117647
1
0
0.130619
0.111581
0
0
0
0
0
1
0.098039
false
0
0.019608
0.058824
0.196078
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
0cd1d7ce809f4555127103b9f2ebc53cd22fdca6
2,885
py
Python
Curso Python Completo - Udemy/Teste/core/poo1.py
Cauenumo/Python
6414ee2013c651e9d45cd328a381a476c6c9073b
[ "Apache-2.0" ]
null
null
null
Curso Python Completo - Udemy/Teste/core/poo1.py
Cauenumo/Python
6414ee2013c651e9d45cd328a381a476c6c9073b
[ "Apache-2.0" ]
null
null
null
Curso Python Completo - Udemy/Teste/core/poo1.py
Cauenumo/Python
6414ee2013c651e9d45cd328a381a476c6c9073b
[ "Apache-2.0" ]
null
null
null
# class Circle(object): # pi = 3.14 # # O círculo é instanciado com um raio (o padrão é 1) # def __init__(self, radius=1): # self.radius = radius # # Método de cálculo da área. Observe o uso de si mesmo. # def area(self): # return self.radius * self.radius * Circle.pi # # Método que redefine a área # def setRadius(self, radius): # self.radius = radius # # Método para obter raio (Mesmo que apenas chamar .radius) # def getRadius(self): # return self.radius # c = Circle() # c.setRadius(3) # print('O raio é: ',c.getRadius()) # print('A área é: ', c.area()) # l = [1,2,3] # t = (1,2,3) # print(type(t)) # def funcao(a,b): # somei = a + b # return somei # print(funcao(1,2)) # print(type(funcao)) # class Dog(object): # def __init__(self,raça): # self.raça = raça # sam = Dog(raça='Labrador') # frank = Dog(raça = 'Pitbull') # print(frank.raça) # class Dog(object): # species = 'mamifero' # def __init__(self,raça): # self.raça = raça # print(len(self.species)) # def latir(self): # print("au au") # sam = Dog(raça = 'Labrador') # print(sam.latir()) # class Circulo(object): # pi = 3.14 # def __init__(self, raio = 1): # self.raio = raio # def area(self): # return self.raio ** 2 * self.pi # def att(self, raio): # self.raio = raio # def obtemraio(self): # return self.raio # c = Circulo() # print(c.att(52)) # class Animal(object): # def __init__(self): # print('Animal criado.') # def quemsou(self): # print('Eu sou um animal') # def comer(self): # print('Comendo...') # class Cachorro(Animal): # def __init__(self): # Animal.__init__(self) # print('Cachorro criado.') # def quemsou(self): # print('Sou um cachorro.') # def latir(self): # print('Au AU') # sam = Cachorro() # print(sam.quemsou()) # print(sam.latir()) # class book(): # def __init__(self,titulo,autor,paginas): # print('um livro foi criado.') # self.titulo = titulo # self.autor = autor # self.paginas = paginas # def __str__(self): # return "Titulo {}".format(self.titulo) # def __len__(self): # return self.paginas # def __del__(self): # print('livro destruido') # l = [1,2,3] # livro1 = book ('Python', 'Cauê', 100) # class Line(object): # def __init__(Self,coor1,coor2): # self.coor1 = coor1 # self.coor2 = coor2 # def distance(self): # x1,y1 = self.coor1 # x2,y2 = self.coor2 # return ( (x2-x1) ** 2 + (y2-y1) ** 2) ** 0.5 # def slope(self): # x1,y1 = self.coor1 # x2,y2 = self.coo2 # return float((y2-y1))/(x2-x1) # coor
20.316901
64
0.533449
367
2,885
4.06267
0.269755
0.04829
0.059021
0.034205
0.163649
0.101945
0.101945
0.033535
0
0
0
0.02887
0.30364
2,885
141
65
20.460993
0.71329
0.902946
0
null
0
null
0
0
null
0
0
0.007092
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
0cdb9744480da6f8e1b4899b7fcf04b7238e340b
1,551
py
Python
MachineLearning.BayesianNetwork/python-imp/bayes_core.py
JillyMan/decision-tree
8e2efc914aaade9cc97a2c94052bc909e50fdb48
[ "MIT" ]
null
null
null
MachineLearning.BayesianNetwork/python-imp/bayes_core.py
JillyMan/decision-tree
8e2efc914aaade9cc97a2c94052bc909e50fdb48
[ "MIT" ]
1
2019-12-29T13:49:52.000Z
2019-12-29T13:49:52.000Z
MachineLearning.BayesianNetwork/python-imp/bayes_core.py
JillyMan/MachineLerningFramework
8e2efc914aaade9cc97a2c94052bc909e50fdb48
[ "MIT" ]
null
null
null
import math RangeType = 'Range' BinaryType = 'Binary' class Hipothesis: def __init__(self, id, name, p): self.id = id self.name = name self.p = p class Attribute: def __init__(self, id, name, question, _type): self.id = id self.name = name self.question = question self.type = _type class Tag: def __init__(self, hipothesis, attribute, pp, pm): self.pp = pp self.pm = pm self.attribute = attribute self.hipothesis = hipothesis class InputType: def __init__(self, _type, value): self.type = _type self.value = int(value) class Binary(InputType): def __init__(self, value): InputType.__init__(self, BinaryType, value) class Range(InputType): def __init__(self, start, end, value): InputType.__init__(self, RangeType, value) self.start = int(start) self.end = int(end) def normalize(self): l = self.end - self.start v = self.value - self.start return v / l def phe_func(p, pp, pm): return (p * pp) / (p * pp + (1-p) * pm) def calc_probs(pp, pm, p): phe = phe_func(p, pp, pm) phne = phe_func(p, 1 - pp, 1 - pm) return (phe, phne) def lerp(start, end, t): return start + (end - start) * t def interpolate_result_clamp01(phne, ph, phe, r): if r > 0.5: return lerp(ph, phe, r) elif r < 0.5: return lerp(phne, ph, r) return ph def interpolate_result_binary(phne, phe, r): return phne if r == 0 else phe
23.149254
54
0.588008
218
1,551
3.981651
0.215596
0.073733
0.076037
0.069124
0.152074
0.0553
0.0553
0
0
0
0
0.009132
0.294004
1,551
66
55
23.5
0.783562
0
0
0.115385
0
0
0.007092
0
0
0
0
0
0
1
0.230769
false
0
0.019231
0.057692
0.519231
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
0cdfbe0659d37b3cc8cc00e18f2f0edb48d21d4a
3,410
py
Python
src/scs_airnow/cmd/cmd_csv_join.py
south-coast-science/scs_airnow
7f0657bd434aa3abe667f58bc971edaa00d0c24c
[ "MIT" ]
null
null
null
src/scs_airnow/cmd/cmd_csv_join.py
south-coast-science/scs_airnow
7f0657bd434aa3abe667f58bc971edaa00d0c24c
[ "MIT" ]
null
null
null
src/scs_airnow/cmd/cmd_csv_join.py
south-coast-science/scs_airnow
7f0657bd434aa3abe667f58bc971edaa00d0c24c
[ "MIT" ]
null
null
null
""" Created on 22 Feb 2019 @author: Bruno Beloff (bruno.beloff@southcoastscience.com) source repo: scs_analysis """ import optparse # -------------------------------------------------------------------------------------------------------------------- class CmdCSVJoin(object): """unix command line handler""" def __init__(self): """ Constructor """ self.__parser = optparse.OptionParser(usage="%prog [-t TYPE] [-i] [-v] -l PREFIX PK FILENAME " "-r PREFIX PK FILENAME", version="%prog 1.0") # compulsory... self.__parser.add_option("--left", "-l", type="string", nargs=3, action="store", dest="left", help="output path prefix, primary key and filename for left-hand set") self.__parser.add_option("--right", "-r", type="string", nargs=3, action="store", dest="right", help="output path prefix, primary key and filename for right-hand set") # optional... self.__parser.add_option("--type", "-t", type="string", nargs=1, action="store", dest="type", default='INNER', help="{ 'INNER' | 'LEFT' | 'RIGHT' | 'FULL' } (default 'INNER')") self.__parser.add_option("--iso8601", "-i", action="store_true", dest="iso8601", default=False, help="interpret the primary key as an ISO 8601 datetime") self.__parser.add_option("--verbose", "-v", action="store_true", dest="verbose", default=False, help="report narrative to stderr") self.__opts, self.__args = self.__parser.parse_args() # ---------------------------------------------------------------------------------------------------------------- def is_valid(self): if self.__opts.left is None or self.__opts.right is None: return False return True # ---------------------------------------------------------------------------------------------------------------- @property def type(self): return self.__opts.type @property def left_prefix(self): return None if self.__opts.left is None else self.__opts.left[0] @property def left_pk(self): return None if self.__opts.left is None else self.__opts.left[1] @property def left_filename(self): return None if self.__opts.left is None else self.__opts.left[2] @property def right_prefix(self): return None if self.__opts.right is None else self.__opts.right[0] @property def right_pk(self): return None if self.__opts.right is None else self.__opts.right[1] @property def right_filename(self): return None if self.__opts.right is None else self.__opts.right[2] @property def iso8601(self): return self.__opts.iso8601 @property def verbose(self): return self.__opts.verbose # ---------------------------------------------------------------------------------------------------------------- def print_help(self, file): self.__parser.print_help(file) def __str__(self, *args, **kwargs): return "CmdCSVJoin:{type:%s, left:%s, right:%s, iso8601:%s, verbose:%s}" % \ (self.type, self.__opts.left, self.__opts.right, self.iso8601, self.verbose)
31.284404
118
0.509091
368
3,410
4.48913
0.269022
0.096852
0.058111
0.058111
0.319007
0.307506
0.2954
0.238499
0.238499
0.18523
0
0.017503
0.246041
3,410
108
119
31.574074
0.625049
0.184751
0
0.173077
0
0.038462
0.193501
0
0
0
0
0
0
1
0.25
false
0
0.019231
0.192308
0.519231
0.038462
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
0ce058cd8a6d65a8bc31474a1e02dc8c29923fe6
338
py
Python
test/receive_message.py
unknown-admin/easymq
e29b8f63402e385059ff8c263b0e7bb8e9fbd24b
[ "Apache-2.0" ]
1
2020-04-20T14:01:34.000Z
2020-04-20T14:01:34.000Z
test/receive_message.py
unknown-admin/easymq
e29b8f63402e385059ff8c263b0e7bb8e9fbd24b
[ "Apache-2.0" ]
null
null
null
test/receive_message.py
unknown-admin/easymq
e29b8f63402e385059ff8c263b0e7bb8e9fbd24b
[ "Apache-2.0" ]
1
2022-02-18T08:18:08.000Z
2022-02-18T08:18:08.000Z
import os from easymq.mq import MQ def receive(headers, body): print("---->", body) mq = MQ( mq_user=os.environ.get("mq_user"), password=os.environ.get("password"), host_and_ports=[ (os.environ.get("host"), os.environ.get("port")), ], func=receive, queue_name="/queue/test_queue", ) mq.receive()
16.095238
57
0.612426
47
338
4.276596
0.468085
0.179104
0.238806
0
0
0
0
0
0
0
0
0
0.195266
338
20
58
16.9
0.738971
0
0
0
0
0
0.133136
0
0
0
0
0
0
1
0.071429
false
0.071429
0.142857
0
0.214286
0.071429
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
1
0
0
0
0
0
2
0cf0a226855cb91425b2c33151d95bfc025b95b0
624
py
Python
tests/retrieve/test_segment.py
openghg/openghg
9a05dd6fe3cee6123898b8f390cfaded08dbb408
[ "Apache-2.0" ]
5
2021-03-02T09:04:07.000Z
2022-01-25T09:58:16.000Z
tests/retrieve/test_segment.py
openghg/openghg
9a05dd6fe3cee6123898b8f390cfaded08dbb408
[ "Apache-2.0" ]
229
2020-09-30T15:08:39.000Z
2022-03-31T14:23:55.000Z
tests/retrieve/test_segment.py
openghg/openghg
9a05dd6fe3cee6123898b8f390cfaded08dbb408
[ "Apache-2.0" ]
null
null
null
# import os # import uuid # import numpy as np # import pandas as pd # import pytest # mocked_uuid = "00000000-0000-1111-00000-000000000000" # @pytest.fixture(scope="session") # def data(): # filename = "bsd.picarro.1minute.248m.dat" # dir_path = os.path.dirname(__file__) # test_data = "../data/proc_test_data/CRDS" # filepath = os.path.join(dir_path, test_data, filename) # return pd.read_csv(filepath, header=None, skiprows=1, sep=r"\s+") # @pytest.fixture # def mock_uuid(monkeypatch): # def mock_uuid(): # return mocked_uuid # monkeypatch.setattr(uuid, "uuid4", mock_uuid)
21.517241
71
0.674679
85
624
4.764706
0.576471
0.059259
0.054321
0
0
0
0
0
0
0
0
0.076321
0.18109
624
28
72
22.285714
0.716243
0.924679
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
0b3d35d3fa9e0c6688b8c47ccf07458bfaa3bde8
231
py
Python
engine/core/it_singleton.py
torrotitans/torro_community
a3f153e69a860f0d6c831145f529d9e92193a0ae
[ "MIT" ]
1
2022-01-12T08:31:59.000Z
2022-01-12T08:31:59.000Z
engine/core/it_singleton.py
torrotitans/torro_community
a3f153e69a860f0d6c831145f529d9e92193a0ae
[ "MIT" ]
null
null
null
engine/core/it_singleton.py
torrotitans/torro_community
a3f153e69a860f0d6c831145f529d9e92193a0ae
[ "MIT" ]
2
2022-01-19T06:26:32.000Z
2022-01-26T15:25:15.000Z
#!/usr/bin/python # -*- coding: UTF-8 -* from db.it.db_it_mgr import it_mgr __all__ = {"itSingleton"} class itSingleton(): def get_cmd_sql(self, sql): return it_mgr.get_cmd_sql(sql) it_singleton = itSingleton()
13.588235
38
0.670996
35
231
4.057143
0.6
0.105634
0.126761
0
0
0
0
0
0
0
0
0.005319
0.186147
231
16
39
14.4375
0.75
0.160173
0
0
0
0
0.057292
0
0
0
0
0
0
1
0.166667
false
0
0.166667
0.166667
0.666667
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
1
1
0
0
2
0b4a7fb8ebee09432022b77e8750863d12e69e9f
134
py
Python
python/pangram.py
emiliot/hackerrank
7a3081f6b0a33f8402c63b94a6a54728a9adf47e
[ "MIT" ]
null
null
null
python/pangram.py
emiliot/hackerrank
7a3081f6b0a33f8402c63b94a6a54728a9adf47e
[ "MIT" ]
null
null
null
python/pangram.py
emiliot/hackerrank
7a3081f6b0a33f8402c63b94a6a54728a9adf47e
[ "MIT" ]
null
null
null
s = input().strip() res = [c for c in set(s.lower()) if c.isalpha()] if len(res) == 26: print("pangram") else: print("not pangram")
19.142857
48
0.604478
24
134
3.375
0.708333
0
0
0
0
0
0
0
0
0
0
0.017857
0.164179
134
6
49
22.333333
0.705357
0
0
0
0
0
0.134328
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
0b4afb977af41e7750f169c98501350be4fa6ae6
247
py
Python
app/db/connection.py
melhin/streamchat
8a3e7ffdcf4bc84045df71259556f4267a755351
[ "MIT" ]
null
null
null
app/db/connection.py
melhin/streamchat
8a3e7ffdcf4bc84045df71259556f4267a755351
[ "MIT" ]
3
2020-09-16T13:30:17.000Z
2020-09-19T09:56:50.000Z
app/db/connection.py
melhin/streamchat
8a3e7ffdcf4bc84045df71259556f4267a755351
[ "MIT" ]
null
null
null
import logging import aioredis from app.core.config import REDIS_DSN, REDIS_PASSWORD logger = logging.getLogger(__name__) async def get_redis_pool(): return await aioredis.create_redis(REDIS_DSN, encoding='utf-8', password=REDIS_PASSWORD)
22.454545
92
0.805668
35
247
5.371429
0.657143
0.085106
0
0
0
0
0
0
0
0
0
0.004566
0.11336
247
10
93
24.7
0.853881
0
0
0
0
0
0.020243
0
0
0
0
0
0
1
0
false
0.333333
0.5
0
0.666667
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
1
0
0
0
0
2
0b5cea9d906ea2c35bda5ccee23fdca482e7e9b4
335
py
Python
atest/testresources/testlibs/objecttoreturn.py
userzimmermann/robotframework
7aa16338ce2120cb082605cf548c0794956ec901
[ "Apache-2.0" ]
7
2015-02-25T10:55:02.000Z
2015-11-04T03:20:05.000Z
atest/testresources/testlibs/objecttoreturn.py
userzimmermann/robotframework
7aa16338ce2120cb082605cf548c0794956ec901
[ "Apache-2.0" ]
12
2015-02-24T17:00:06.000Z
2015-07-31T08:32:07.000Z
atest/testresources/testlibs/objecttoreturn.py
userzimmermann/robotframework
7aa16338ce2120cb082605cf548c0794956ec901
[ "Apache-2.0" ]
2
2015-12-15T11:00:35.000Z
2018-02-24T18:11:24.000Z
try: import exceptions except ImportError: # Python 3 import builtins as exceptions class ObjectToReturn: def __init__(self, name): self.name = name def __str__(self): return self.name def exception(self, name, msg=""): exception = getattr(exceptions, name) raise exception(msg)
19.705882
45
0.647761
38
335
5.5
0.552632
0.15311
0
0
0
0
0
0
0
0
0
0.004082
0.268657
335
16
46
20.9375
0.84898
0.023881
0
0
0
0
0
0
0
0
0
0
0
1
0.25
false
0
0.25
0.083333
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
0
1
0
0
2
0b61cadfab29026982ee72c19310998fdc907aa6
1,312
py
Python
aio_binance/futures/usdt/api/methods/stream.py
GRinvest/aiobinance
49ce0bdf955d9fa9363c41eb9cec3da2f121e611
[ "MIT" ]
5
2022-01-30T19:32:16.000Z
2022-03-12T15:00:13.000Z
aio_binance/futures/usdt/api/methods/stream.py
GRinvest/aio-binance-library
49ce0bdf955d9fa9363c41eb9cec3da2f121e611
[ "MIT" ]
null
null
null
aio_binance/futures/usdt/api/methods/stream.py
GRinvest/aio-binance-library
49ce0bdf955d9fa9363c41eb9cec3da2f121e611
[ "MIT" ]
null
null
null
class DataStream: async def create_private_listen_key(self) -> dict: """**Create a ListenKey (USER_STREAM)** Notes: ``POST /fapi/v1/listenKey`` See Also: https://binance-docs.github.io/apidocs/futures/en/#start-user-data-stream-user_stream """ return await self._fetch( 'POST', 'create_private_listen_key', '/fapi/v1/listenKey' ) async def update_private_listen_key(self) -> dict: """**Ping/Keep-alive a ListenKey (USER_STREAM)** Notes: ``PUT /fapi/v1/listenKey`` See Also: https://binance-docs.github.io/apidocs/futures/en/#keepalive-user-data-stream-user_stream """ return await self._fetch( 'PUT', 'update_private_listen_key', '/fapi/v1/listenKey' ) async def delete_private_listen_key(self) -> dict: """**Close a ListenKey (USER_STREAM)** Notes: ``DELETE /fapi/v1/listenKey`` See Also: https://binance-docs.github.io/apidocs/futures/en/#close-user-data-stream-user_stream """ return await self._fetch( 'DELETE', 'delete_private_listen_key', '/fapi/v1/listenKey' )
29.155556
101
0.55564
142
1,312
4.943662
0.288732
0.111111
0.136752
0.08547
0.817664
0.608262
0.564103
0.564103
0.452991
0.264957
0
0.006689
0.316311
1,312
44
102
29.818182
0.77592
0
0
0.315789
0
0
0.226115
0.119427
0
0
0
0
0
1
0
true
0
0
0
0.210526
0
0
0
0
null
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
2
0b71623dce279f8394f45396a0c88a69e51e39e7
272
py
Python
3d_cnn/src/constants/particles.py
mrmattuschka/DeePiCt
ef3e81ea25705076f340175d97ccff98f8d11799
[ "Apache-2.0" ]
null
null
null
3d_cnn/src/constants/particles.py
mrmattuschka/DeePiCt
ef3e81ea25705076f340175d97ccff98f8d11799
[ "Apache-2.0" ]
2
2022-03-08T09:22:23.000Z
2022-03-20T21:13:07.000Z
3d_cnn/src/constants/particles.py
ZauggGroup/DeePiCt
0bdf1cd845cc306e66e30face1010c12ca3a38d0
[ "Apache-2.0" ]
null
null
null
from os.path import join def create_particle_file_name(folder_path: str, img_number: int, coord_indx: int, ext: str) -> str: file_name = str(img_number) + 'particle' + str(coord_indx) + '.' + ext return join(folder_path, file_name)
34
74
0.636029
38
272
4.263158
0.5
0.148148
0.148148
0
0
0
0
0
0
0
0
0
0.253676
272
7
75
38.857143
0.79803
0
0
0
0
0
0.033088
0
0
0
0
0
0
1
0.2
false
0
0.2
0
0.6
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
2
0ba8551d5076fefbf31d48a58d0338bdc2763c0b
181
py
Python
src/misc/helpers.py
dnmarkon/kaggle_elo_merchant
92ac552d72234455455c95f53e6091017f048504
[ "MIT" ]
null
null
null
src/misc/helpers.py
dnmarkon/kaggle_elo_merchant
92ac552d72234455455c95f53e6091017f048504
[ "MIT" ]
null
null
null
src/misc/helpers.py
dnmarkon/kaggle_elo_merchant
92ac552d72234455455c95f53e6091017f048504
[ "MIT" ]
null
null
null
import pandas as pd def one_hot(df, column): df = pd.concat([df, pd.get_dummies(df[column], prefix=column)], axis=1) df.drop([column], axis=1, inplace=True) return df
22.625
75
0.662983
31
181
3.806452
0.612903
0.135593
0.186441
0
0
0
0
0
0
0
0
0.013423
0.176796
181
7
76
25.857143
0.778523
0
0
0
0
0
0
0
0
0
0
0
0
1
0.2
false
0
0.2
0
0.6
0
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
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
0baa80eb9ba40c6d66b4f05785427f91545460d9
81
py
Python
Extensions/BabaGUI/config.py
siva-msft/baba-is-auto
3237b5b70167130558827979bde7dcee14ef39f3
[ "MIT" ]
108
2019-09-11T06:31:35.000Z
2022-03-28T13:02:56.000Z
Extensions/BabaGUI/config.py
siva-msft/baba-is-auto
3237b5b70167130558827979bde7dcee14ef39f3
[ "MIT" ]
29
2019-09-12T00:28:04.000Z
2022-02-20T14:56:27.000Z
Extensions/BabaGUI/config.py
utilForever/baba-is-auto
11937742e25b37b1e27de87fe74d10f09062d6ce
[ "MIT" ]
14
2020-02-24T05:41:43.000Z
2022-03-28T12:43:34.000Z
import pygame FPS = 60 BLOCK_SIZE = 48 COLOR_BACKGROUND = pygame.Color(0, 0, 0)
13.5
40
0.728395
14
81
4.071429
0.714286
0.070175
0
0
0
0
0
0
0
0
0
0.104478
0.17284
81
5
41
16.2
0.746269
0
0
0
0
0
0
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
0bab9c96a95c9a1b5bf24f9a433d56e2555e1a77
392
py
Python
simulation/strategies/bucketing.py
kantai/hyperbolic-caching
884c466c311bb5b9fbdd09791d829b04032f3947
[ "MIT" ]
15
2017-07-13T17:30:01.000Z
2021-05-18T11:51:13.000Z
simulation/strategies/bucketing.py
kantai/hyperbolic-caching
884c466c311bb5b9fbdd09791d829b04032f3947
[ "MIT" ]
null
null
null
simulation/strategies/bucketing.py
kantai/hyperbolic-caching
884c466c311bb5b9fbdd09791d829b04032f3947
[ "MIT" ]
6
2017-07-13T21:09:04.000Z
2021-04-12T15:22:57.000Z
class AveragingBucketUpkeep: def __init__(self): self.numer = 0.0 self.denom = 0 def add_cost(self, cost): self.numer += cost self.denom += 1 return self.numer / self.denom def rem_cost(self, cost): self.numer -= cost self.denom -= 1 if self.denom == 0: return 0 return self.numer / self.denom
23.058824
38
0.543367
50
392
4.14
0.28
0.26087
0.096618
0.154589
0.570048
0.338164
0.338164
0.338164
0.338164
0
0
0.027778
0.357143
392
16
39
24.5
0.793651
0
0
0.142857
0
0
0
0
0
0
0
0
0
1
0.214286
false
0
0
0
0.5
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
0baf09cfe2bff0d7d8fbadcb0dcd9e76b3f75e76
284
py
Python
venv/lib/python3.8/site-packages/crispy_forms/templates/uni_form/uni_form.html.py
Solurix/Flashcards-Django
03c863f6722936093927785a2b20b6b668bb743d
[ "MIT" ]
1
2021-05-16T03:20:23.000Z
2021-05-16T03:20:23.000Z
venv/lib/python3.8/site-packages/crispy_forms/templates/uni_form/uni_form.html.py
Solurix/Flashcards-Django
03c863f6722936093927785a2b20b6b668bb743d
[ "MIT" ]
4
2021-03-30T14:06:09.000Z
2021-09-22T19:26:31.000Z
venv/lib/python3.8/site-packages/crispy_forms/templates/uni_form/uni_form.html.py
Solurix/Flashcards-Django
03c863f6722936093927785a2b20b6b668bb743d
[ "MIT" ]
null
null
null
BB BBBBBBBBBBBBBBBBBB BB BBBBBBBBBBBBBBBB BBBBBBB BBBBBBBBBBBBBBBBBBBBBB BBBBB BB BBBBBBBBBB BB BB BB BBBBBBBBBB XXXXXXXXX XXXXXXXXX XXXXXXXXXXXXXXXXX BBBBB BBB BBBBB BB BBBB BBBBBBB BBBBBBBBBBBBBB BBBBBB BB BBBBBBBBBB BB BB BB BBBBBBBBBB XXXXXXXXXXX BBBBB
15.777778
34
0.792254
32
284
7.03125
0.4375
0.213333
0.124444
0.142222
0.248889
0.248889
0
0
0
0
0
0
0.207746
284
17
35
16.705882
1
0
0
0.357143
0
0
0
0
0
0
0
0
0
0
null
null
0
0
null
null
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
1
0
0
0
0
0
0
0
0
2
0bb89e9bc4b11618566c516b525db418c9d0a1b7
742
py
Python
079_039_189/ngram_2/get_10_summary.py
Aditya-AS/Question-Answering-System
22c3fe549c03a3b5ba1f86befef3c9f91278d3fc
[ "MIT" ]
null
null
null
079_039_189/ngram_2/get_10_summary.py
Aditya-AS/Question-Answering-System
22c3fe549c03a3b5ba1f86befef3c9f91278d3fc
[ "MIT" ]
null
null
null
079_039_189/ngram_2/get_10_summary.py
Aditya-AS/Question-Answering-System
22c3fe549c03a3b5ba1f86befef3c9f91278d3fc
[ "MIT" ]
null
null
null
""" Sanjay Reddy S-2013A7PS189P Aditya Sarma -2013A7PS079P Vamsi T -2013A7PS039P Artificial Intelligence Term Project """ import pickle import BeautifulSoup import re import boto from boto.s3.connection import S3Connection from boto.s3.key import Key from google import search def get_10_summary(query, source="google"): """ This function returns the first ten (or less, if 10 are not present) summaries when the query (a string) is run on the source (here google). The return type is a beautifulSoup module's object and is similar to a list """ result = search(query) #calls query on google #print "---------------------------" + str(type(results)) + "---------------------------" return result
25.586207
144
0.669811
99
742
5
0.656566
0.032323
0.040404
0
0
0
0
0
0
0
0
0.051581
0.190027
742
28
145
26.5
0.772047
0.603774
0
0
0
0
0.022642
0
0
0
0
0
0
1
0.1
false
0
0.7
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
0
1
0
1
0
0
2
0bba1e28f68dedeccae5371afea0ac4ab68e2473
68,549
py
Python
tests/examples/minlplib/waterno2_03.py
ouyang-w-19/decogo
52546480e49776251d4d27856e18a46f40c824a1
[ "MIT" ]
2
2021-07-03T13:19:10.000Z
2022-02-06T10:48:13.000Z
tests/examples/minlplib/waterno2_03.py
ouyang-w-19/decogo
52546480e49776251d4d27856e18a46f40c824a1
[ "MIT" ]
1
2021-07-04T14:52:14.000Z
2021-07-15T10:17:11.000Z
tests/examples/minlplib/waterno2_03.py
ouyang-w-19/decogo
52546480e49776251d4d27856e18a46f40c824a1
[ "MIT" ]
null
null
null
# MINLP written by GAMS Convert at 04/21/18 13:55:18 # # Equation counts # Total E G L N X C B # 617 367 103 147 0 0 0 0 # # Variable counts # x b i s1s s2s sc si # Total cont binary integer sos1 sos2 scont sint # 499 472 27 0 0 0 0 0 # FX 6 6 0 0 0 0 0 0 # # Nonzero counts # Total const NL DLL # 1636 1333 303 0 # # Reformulation has removed 1 variable and 1 equation from pyomo.environ import * model = m = ConcreteModel() m.b2 = Var(within=Binary,bounds=(0,1),initialize=0) m.b3 = Var(within=Binary,bounds=(0,1),initialize=0) m.b4 = Var(within=Binary,bounds=(0,1),initialize=0) m.b5 = Var(within=Binary,bounds=(0,1),initialize=0) m.b6 = Var(within=Binary,bounds=(0,1),initialize=0) m.b7 = Var(within=Binary,bounds=(0,1),initialize=0) m.b8 = Var(within=Binary,bounds=(0,1),initialize=0) m.b9 = Var(within=Binary,bounds=(0,1),initialize=0) m.b10 = Var(within=Binary,bounds=(0,1),initialize=0) m.b11 = Var(within=Binary,bounds=(0,1),initialize=0) m.b12 = Var(within=Binary,bounds=(0,1),initialize=0) m.b13 = Var(within=Binary,bounds=(0,1),initialize=0) m.b14 = Var(within=Binary,bounds=(0,1),initialize=0) m.b15 = Var(within=Binary,bounds=(0,1),initialize=0) m.b16 = Var(within=Binary,bounds=(0,1),initialize=0) m.b17 = Var(within=Binary,bounds=(0,1),initialize=0) m.b18 = Var(within=Binary,bounds=(0,1),initialize=0) m.b19 = Var(within=Binary,bounds=(0,1),initialize=0) m.b20 = Var(within=Binary,bounds=(0,1),initialize=0) m.b21 = Var(within=Binary,bounds=(0,1),initialize=0) m.b22 = Var(within=Binary,bounds=(0,1),initialize=0) m.b23 = Var(within=Binary,bounds=(0,1),initialize=0) m.b24 = Var(within=Binary,bounds=(0,1),initialize=0) m.b25 = Var(within=Binary,bounds=(0,1),initialize=0) m.b26 = Var(within=Binary,bounds=(0,1),initialize=0) m.b27 = Var(within=Binary,bounds=(0,1),initialize=0) m.b28 = Var(within=Binary,bounds=(0,1),initialize=0) m.x29 = Var(within=Reals,bounds=(-1000,1000),initialize=0) m.x30 = Var(within=Reals,bounds=(None,None),initialize=0) m.x31 = Var(within=Reals,bounds=(None,None),initialize=0) m.x32 = Var(within=Reals,bounds=(-1000,1000),initialize=0) m.x33 = Var(within=Reals,bounds=(None,None),initialize=0) m.x34 = Var(within=Reals,bounds=(None,None),initialize=0) m.x35 = Var(within=Reals,bounds=(None,None),initialize=0) m.x36 = Var(within=Reals,bounds=(-1000,1000),initialize=0) m.x37 = Var(within=Reals,bounds=(None,None),initialize=0) m.x38 = Var(within=Reals,bounds=(None,None),initialize=0) m.x39 = Var(within=Reals,bounds=(None,None),initialize=0) m.x40 = Var(within=Reals,bounds=(-1000,1000),initialize=0) m.x41 = Var(within=Reals,bounds=(None,None),initialize=0) m.x42 = Var(within=Reals,bounds=(None,None),initialize=0) m.x43 = Var(within=Reals,bounds=(None,None),initialize=0) m.x44 = Var(within=Reals,bounds=(-1000,1000),initialize=0) m.x45 = Var(within=Reals,bounds=(None,None),initialize=0) m.x46 = Var(within=Reals,bounds=(None,None),initialize=0) m.x47 = Var(within=Reals,bounds=(-1000,1000),initialize=0) m.x48 = Var(within=Reals,bounds=(None,None),initialize=0) m.x49 = Var(within=Reals,bounds=(None,None),initialize=0) m.x50 = Var(within=Reals,bounds=(-1000,1000),initialize=0) m.x51 = Var(within=Reals,bounds=(None,None),initialize=0) m.x52 = Var(within=Reals,bounds=(None,None),initialize=0) m.x53 = Var(within=Reals,bounds=(-1000,1000),initialize=0) m.x54 = Var(within=Reals,bounds=(None,None),initialize=0) m.x55 = Var(within=Reals,bounds=(None,None),initialize=0) m.x56 = Var(within=Reals,bounds=(None,None),initialize=0) m.x57 = Var(within=Reals,bounds=(-1000,1000),initialize=0) m.x58 = Var(within=Reals,bounds=(None,None),initialize=0) m.x59 = Var(within=Reals,bounds=(None,None),initialize=0) m.x60 = Var(within=Reals,bounds=(None,None),initialize=0) m.x61 = Var(within=Reals,bounds=(-1000,1000),initialize=0) m.x62 = Var(within=Reals,bounds=(None,None),initialize=0) m.x63 = Var(within=Reals,bounds=(None,None),initialize=0) m.x64 = Var(within=Reals,bounds=(None,None),initialize=0) m.x65 = Var(within=Reals,bounds=(-1000,1000),initialize=0) m.x66 = Var(within=Reals,bounds=(None,None),initialize=0) m.x67 = Var(within=Reals,bounds=(None,None),initialize=0) m.x68 = Var(within=Reals,bounds=(-1000,1000),initialize=0) m.x69 = Var(within=Reals,bounds=(None,None),initialize=0) m.x70 = Var(within=Reals,bounds=(None,None),initialize=0) m.x71 = Var(within=Reals,bounds=(-1000,1000),initialize=0) m.x72 = Var(within=Reals,bounds=(None,None),initialize=0) m.x73 = Var(within=Reals,bounds=(None,None),initialize=0) m.x74 = Var(within=Reals,bounds=(-1000,1000),initialize=0) m.x75 = Var(within=Reals,bounds=(None,None),initialize=0) m.x76 = Var(within=Reals,bounds=(None,None),initialize=0) m.x77 = Var(within=Reals,bounds=(None,None),initialize=0) m.x78 = Var(within=Reals,bounds=(-1000,1000),initialize=0) m.x79 = Var(within=Reals,bounds=(None,None),initialize=0) m.x80 = Var(within=Reals,bounds=(None,None),initialize=0) m.x81 = Var(within=Reals,bounds=(None,None),initialize=0) m.x82 = Var(within=Reals,bounds=(-1000,1000),initialize=0) m.x83 = Var(within=Reals,bounds=(None,None),initialize=0) m.x84 = Var(within=Reals,bounds=(None,None),initialize=0) m.x85 = Var(within=Reals,bounds=(None,None),initialize=0) m.x86 = Var(within=Reals,bounds=(-1000,1000),initialize=0) m.x87 = Var(within=Reals,bounds=(None,None),initialize=0) m.x88 = Var(within=Reals,bounds=(None,None),initialize=0) m.x89 = Var(within=Reals,bounds=(-1000,1000),initialize=0) m.x90 = Var(within=Reals,bounds=(None,None),initialize=0) m.x91 = Var(within=Reals,bounds=(None,None),initialize=0) m.x92 = Var(within=Reals,bounds=(-1000,1000),initialize=0) m.x93 = Var(within=Reals,bounds=(None,None),initialize=0) m.x94 = Var(within=Reals,bounds=(None,None),initialize=0) m.x95 = Var(within=Reals,bounds=(0,5),initialize=0) m.x96 = Var(within=Reals,bounds=(0,5),initialize=0) m.x97 = Var(within=Reals,bounds=(0,5),initialize=0) m.x98 = Var(within=Reals,bounds=(0,5),initialize=0) m.x99 = Var(within=Reals,bounds=(0,2.4),initialize=0) m.x100 = Var(within=Reals,bounds=(0,5),initialize=0) m.x101 = Var(within=Reals,bounds=(0,2.4),initialize=0) m.x102 = Var(within=Reals,bounds=(0,5),initialize=0) m.x103 = Var(within=Reals,bounds=(0,2.4),initialize=0) m.x104 = Var(within=Reals,bounds=(0,5),initialize=0) m.x105 = Var(within=Reals,bounds=(0,2.4),initialize=0) m.x106 = Var(within=Reals,bounds=(0,5),initialize=0) m.x107 = Var(within=Reals,bounds=(0,2.4),initialize=0) m.x108 = Var(within=Reals,bounds=(0,5),initialize=0) m.x109 = Var(within=Reals,bounds=(0,2.4),initialize=0) m.x110 = Var(within=Reals,bounds=(0,5),initialize=0) m.x111 = Var(within=Reals,bounds=(0,5),initialize=0) m.x112 = Var(within=Reals,bounds=(0,5),initialize=0) m.x113 = Var(within=Reals,bounds=(0,5),initialize=0) m.x114 = Var(within=Reals,bounds=(0,1.16),initialize=0) m.x115 = Var(within=Reals,bounds=(0,5),initialize=0) m.x116 = Var(within=Reals,bounds=(0,1.16),initialize=0) m.x117 = Var(within=Reals,bounds=(0,5),initialize=0) m.x118 = Var(within=Reals,bounds=(0,1.16),initialize=0) m.x119 = Var(within=Reals,bounds=(0,5),initialize=0) m.x120 = Var(within=Reals,bounds=(0,5),initialize=0) m.x121 = Var(within=Reals,bounds=(0,5),initialize=0) m.x122 = Var(within=Reals,bounds=(3.5,3.5),initialize=3.5) m.x123 = Var(within=Reals,bounds=(2,5),initialize=2) m.x124 = Var(within=Reals,bounds=(2,5),initialize=2) m.x125 = Var(within=Reals,bounds=(2,5),initialize=2) m.x126 = Var(within=Reals,bounds=(2,5),initialize=2) m.x127 = Var(within=Reals,bounds=(2,5),initialize=2) m.x128 = Var(within=Reals,bounds=(4.1,4.1),initialize=4.1) m.x129 = Var(within=Reals,bounds=(2.5,5),initialize=2.5) m.x130 = Var(within=Reals,bounds=(2.5,5),initialize=2.5) m.x131 = Var(within=Reals,bounds=(2.5,5),initialize=2.5) m.x132 = Var(within=Reals,bounds=(2.5,5),initialize=2.5) m.x133 = Var(within=Reals,bounds=(2.5,5),initialize=2.5) m.x134 = Var(within=Reals,bounds=(4,4),initialize=4) m.x135 = Var(within=Reals,bounds=(2,6),initialize=2) m.x136 = Var(within=Reals,bounds=(2,6),initialize=2) m.x137 = Var(within=Reals,bounds=(2,6),initialize=2) m.x138 = Var(within=Reals,bounds=(2,6),initialize=2) m.x139 = Var(within=Reals,bounds=(2,6),initialize=2) m.x140 = Var(within=Reals,bounds=(0,0.8),initialize=0) m.x141 = Var(within=Reals,bounds=(-1000,1000),initialize=0) m.x142 = Var(within=Reals,bounds=(0,0.8),initialize=0) m.x143 = Var(within=Reals,bounds=(None,None),initialize=0) m.x144 = Var(within=Reals,bounds=(0,0.8),initialize=0) m.x145 = Var(within=Reals,bounds=(None,None),initialize=0) m.x146 = Var(within=Reals,bounds=(0,0.8),initialize=0) m.x147 = Var(within=Reals,bounds=(None,None),initialize=0) m.x148 = Var(within=Reals,bounds=(0,0.8),initialize=0) m.x149 = Var(within=Reals,bounds=(-1000,1000),initialize=0) m.x150 = Var(within=Reals,bounds=(0,0.8),initialize=0) m.x151 = Var(within=Reals,bounds=(None,None),initialize=0) m.x152 = Var(within=Reals,bounds=(0,0.8),initialize=0) m.x153 = Var(within=Reals,bounds=(None,None),initialize=0) m.x154 = Var(within=Reals,bounds=(0,0.8),initialize=0) m.x155 = Var(within=Reals,bounds=(None,None),initialize=0) m.x156 = Var(within=Reals,bounds=(0,0.8),initialize=0) m.x157 = Var(within=Reals,bounds=(-1000,1000),initialize=0) m.x158 = Var(within=Reals,bounds=(0,0.5),initialize=0) m.x159 = Var(within=Reals,bounds=(None,None),initialize=0) m.x160 = Var(within=Reals,bounds=(0,0.5),initialize=0) m.x161 = Var(within=Reals,bounds=(None,None),initialize=0) m.x162 = Var(within=Reals,bounds=(0,0.5),initialize=0) m.x163 = Var(within=Reals,bounds=(None,None),initialize=0) m.x164 = Var(within=Reals,bounds=(0,0.5),initialize=0) m.x165 = Var(within=Reals,bounds=(-1000,1000),initialize=0) m.x166 = Var(within=Reals,bounds=(0,0.5),initialize=0) m.x167 = Var(within=Reals,bounds=(None,None),initialize=0) m.x168 = Var(within=Reals,bounds=(0,0.5),initialize=0) m.x169 = Var(within=Reals,bounds=(None,None),initialize=0) m.x170 = Var(within=Reals,bounds=(0,0.7),initialize=0) m.x171 = Var(within=Reals,bounds=(-1000,1000),initialize=0) m.x172 = Var(within=Reals,bounds=(0,0.7),initialize=0) m.x173 = Var(within=Reals,bounds=(None,None),initialize=0) m.x174 = Var(within=Reals,bounds=(0,0.7),initialize=0) m.x175 = Var(within=Reals,bounds=(None,None),initialize=0) m.x176 = Var(within=Reals,bounds=(0,0.7),initialize=0) m.x177 = Var(within=Reals,bounds=(-1000,1000),initialize=0) m.x178 = Var(within=Reals,bounds=(0,0.7),initialize=0) m.x179 = Var(within=Reals,bounds=(None,None),initialize=0) m.x180 = Var(within=Reals,bounds=(0,0.7),initialize=0) m.x181 = Var(within=Reals,bounds=(None,None),initialize=0) m.x182 = Var(within=Reals,bounds=(0,0.58),initialize=0) m.x183 = Var(within=Reals,bounds=(-1000,1000),initialize=0) m.x184 = Var(within=Reals,bounds=(0,0.58),initialize=0) m.x185 = Var(within=Reals,bounds=(None,None),initialize=0) m.x186 = Var(within=Reals,bounds=(0,0.58),initialize=0) m.x187 = Var(within=Reals,bounds=(None,None),initialize=0) m.x188 = Var(within=Reals,bounds=(0,0.58),initialize=0) m.x189 = Var(within=Reals,bounds=(-1000,1000),initialize=0) m.x190 = Var(within=Reals,bounds=(0,0.58),initialize=0) m.x191 = Var(within=Reals,bounds=(None,None),initialize=0) m.x192 = Var(within=Reals,bounds=(0,0.58),initialize=0) m.x193 = Var(within=Reals,bounds=(None,None),initialize=0) m.x194 = Var(within=Reals,bounds=(62,65),initialize=62) m.x195 = Var(within=Reals,bounds=(62,65),initialize=62) m.x196 = Var(within=Reals,bounds=(62,65),initialize=62) m.x197 = Var(within=Reals,bounds=(92.5,95),initialize=92.5) m.x198 = Var(within=Reals,bounds=(92.5,95),initialize=92.5) m.x199 = Var(within=Reals,bounds=(92.5,95),initialize=92.5) m.x200 = Var(within=Reals,bounds=(105,109),initialize=105) m.x201 = Var(within=Reals,bounds=(105,109),initialize=105) m.x202 = Var(within=Reals,bounds=(105,109),initialize=105) m.x203 = Var(within=Reals,bounds=(0,1000),initialize=0) m.x204 = Var(within=Reals,bounds=(-125,125),initialize=0) m.x205 = Var(within=Reals,bounds=(0,1000),initialize=0) m.x206 = Var(within=Reals,bounds=(-125,125),initialize=0) m.x207 = Var(within=Reals,bounds=(0,1000),initialize=0) m.x208 = Var(within=Reals,bounds=(-125,125),initialize=0) m.x209 = Var(within=Reals,bounds=(0,1000),initialize=0) m.x210 = Var(within=Reals,bounds=(0,1000),initialize=0) m.x211 = Var(within=Reals,bounds=(-100,100),initialize=0) m.x212 = Var(within=Reals,bounds=(0,1000),initialize=0) m.x213 = Var(within=Reals,bounds=(0,1000),initialize=0) m.x214 = Var(within=Reals,bounds=(-100,100),initialize=0) m.x215 = Var(within=Reals,bounds=(0,1000),initialize=0) m.x216 = Var(within=Reals,bounds=(0,1000),initialize=0) m.x217 = Var(within=Reals,bounds=(-100,100),initialize=0) m.x218 = Var(within=Reals,bounds=(0,1000),initialize=0) m.x219 = Var(within=Reals,bounds=(-125,125),initialize=0) m.x220 = Var(within=Reals,bounds=(0,1000),initialize=0) m.x221 = Var(within=Reals,bounds=(-125,125),initialize=0) m.x222 = Var(within=Reals,bounds=(0,1000),initialize=0) m.x223 = Var(within=Reals,bounds=(-125,125),initialize=0) m.x224 = Var(within=Reals,bounds=(49,49),initialize=49) m.x225 = Var(within=Reals,bounds=(-49,1000),initialize=0) m.x226 = Var(within=Reals,bounds=(49,49),initialize=49) m.x227 = Var(within=Reals,bounds=(-49,1000),initialize=0) m.x228 = Var(within=Reals,bounds=(49,49),initialize=49) m.x229 = Var(within=Reals,bounds=(-49,1000),initialize=0) m.x230 = Var(within=Reals,bounds=(-65,1000),initialize=0) m.x231 = Var(within=Reals,bounds=(-65,1000),initialize=0) m.x232 = Var(within=Reals,bounds=(-65,1000),initialize=0) m.x233 = Var(within=Reals,bounds=(-95,1000),initialize=0) m.x234 = Var(within=Reals,bounds=(-95,1000),initialize=0) m.x235 = Var(within=Reals,bounds=(-95,1000),initialize=0) m.x236 = Var(within=Reals,bounds=(0.2,0.8),initialize=0.2) m.x237 = Var(within=Reals,bounds=(0.2,0.8),initialize=0.2) m.x238 = Var(within=Reals,bounds=(0.2,0.8),initialize=0.2) m.x239 = Var(within=Reals,bounds=(0.2,0.8),initialize=0.2) m.x240 = Var(within=Reals,bounds=(0.2,0.8),initialize=0.2) m.x241 = Var(within=Reals,bounds=(0.2,0.8),initialize=0.2) m.x242 = Var(within=Reals,bounds=(0.2,0.8),initialize=0.2) m.x243 = Var(within=Reals,bounds=(0.2,0.8),initialize=0.2) m.x244 = Var(within=Reals,bounds=(0.2,0.8),initialize=0.2) m.x245 = Var(within=Reals,bounds=(0.25,0.5),initialize=0.25) m.x246 = Var(within=Reals,bounds=(0.25,0.5),initialize=0.25) m.x247 = Var(within=Reals,bounds=(0.25,0.5),initialize=0.25) m.x248 = Var(within=Reals,bounds=(0.25,0.5),initialize=0.25) m.x249 = Var(within=Reals,bounds=(0.25,0.5),initialize=0.25) m.x250 = Var(within=Reals,bounds=(0.25,0.5),initialize=0.25) m.x251 = Var(within=Reals,bounds=(0.4,0.7),initialize=0.4) m.x252 = Var(within=Reals,bounds=(0.4,0.7),initialize=0.4) m.x253 = Var(within=Reals,bounds=(0.4,0.7),initialize=0.4) m.x254 = Var(within=Reals,bounds=(0.4,0.7),initialize=0.4) m.x255 = Var(within=Reals,bounds=(0.4,0.7),initialize=0.4) m.x256 = Var(within=Reals,bounds=(0.4,0.7),initialize=0.4) m.x257 = Var(within=Reals,bounds=(0.24,0.58),initialize=0.24) m.x258 = Var(within=Reals,bounds=(0.24,0.58),initialize=0.24) m.x259 = Var(within=Reals,bounds=(0.24,0.58),initialize=0.24) m.x260 = Var(within=Reals,bounds=(0.24,0.58),initialize=0.24) m.x261 = Var(within=Reals,bounds=(0.24,0.58),initialize=0.24) m.x262 = Var(within=Reals,bounds=(0.24,0.58),initialize=0.24) m.x263 = Var(within=Reals,bounds=(0.6,1),initialize=0.6) m.x264 = Var(within=Reals,bounds=(0.6,1),initialize=0.6) m.x265 = Var(within=Reals,bounds=(0.6,1),initialize=0.6) m.x266 = Var(within=Reals,bounds=(0.8,1),initialize=0.8) m.x267 = Var(within=Reals,bounds=(0.8,1),initialize=0.8) m.x268 = Var(within=Reals,bounds=(0.8,1),initialize=0.8) m.x269 = Var(within=Reals,bounds=(0.85,1),initialize=0.85) m.x270 = Var(within=Reals,bounds=(0.85,1),initialize=0.85) m.x271 = Var(within=Reals,bounds=(0.85,1),initialize=0.85) m.x272 = Var(within=Reals,bounds=(0.7,1),initialize=0.7) m.x273 = Var(within=Reals,bounds=(0.7,1),initialize=0.7) m.x274 = Var(within=Reals,bounds=(0.7,1),initialize=0.7) m.x275 = Var(within=Reals,bounds=(100,1000),initialize=100) m.x276 = Var(within=Reals,bounds=(100,1000),initialize=100) m.x277 = Var(within=Reals,bounds=(100,1000),initialize=100) m.x278 = Var(within=Reals,bounds=(0,54.1717996137183),initialize=0) m.x279 = Var(within=Reals,bounds=(None,None),initialize=0) m.x280 = Var(within=Reals,bounds=(None,None),initialize=0) m.x281 = Var(within=Reals,bounds=(None,None),initialize=0) m.x282 = Var(within=Reals,bounds=(None,None),initialize=0) m.x283 = Var(within=Reals,bounds=(0,54.1717996137183),initialize=0) m.x284 = Var(within=Reals,bounds=(None,None),initialize=0) m.x285 = Var(within=Reals,bounds=(None,None),initialize=0) m.x286 = Var(within=Reals,bounds=(None,None),initialize=0) m.x287 = Var(within=Reals,bounds=(None,None),initialize=0) m.x288 = Var(within=Reals,bounds=(0,54.1717996137183),initialize=0) m.x289 = Var(within=Reals,bounds=(None,None),initialize=0) m.x290 = Var(within=Reals,bounds=(None,None),initialize=0) m.x291 = Var(within=Reals,bounds=(None,None),initialize=0) m.x292 = Var(within=Reals,bounds=(None,None),initialize=0) m.x293 = Var(within=Reals,bounds=(0,54.1717996137183),initialize=0) m.x294 = Var(within=Reals,bounds=(None,None),initialize=0) m.x295 = Var(within=Reals,bounds=(None,None),initialize=0) m.x296 = Var(within=Reals,bounds=(None,None),initialize=0) m.x297 = Var(within=Reals,bounds=(None,None),initialize=0) m.x298 = Var(within=Reals,bounds=(0,54.1717996137183),initialize=0) m.x299 = Var(within=Reals,bounds=(None,None),initialize=0) m.x300 = Var(within=Reals,bounds=(None,None),initialize=0) m.x301 = Var(within=Reals,bounds=(None,None),initialize=0) m.x302 = Var(within=Reals,bounds=(None,None),initialize=0) m.x303 = Var(within=Reals,bounds=(0,54.1717996137183),initialize=0) m.x304 = Var(within=Reals,bounds=(None,None),initialize=0) m.x305 = Var(within=Reals,bounds=(None,None),initialize=0) m.x306 = Var(within=Reals,bounds=(None,None),initialize=0) m.x307 = Var(within=Reals,bounds=(None,None),initialize=0) m.x308 = Var(within=Reals,bounds=(0,54.1717996137183),initialize=0) m.x309 = Var(within=Reals,bounds=(None,None),initialize=0) m.x310 = Var(within=Reals,bounds=(None,None),initialize=0) m.x311 = Var(within=Reals,bounds=(None,None),initialize=0) m.x312 = Var(within=Reals,bounds=(None,None),initialize=0) m.x313 = Var(within=Reals,bounds=(0,54.1717996137183),initialize=0) m.x314 = Var(within=Reals,bounds=(None,None),initialize=0) m.x315 = Var(within=Reals,bounds=(None,None),initialize=0) m.x316 = Var(within=Reals,bounds=(None,None),initialize=0) m.x317 = Var(within=Reals,bounds=(None,None),initialize=0) m.x318 = Var(within=Reals,bounds=(0,54.1717996137183),initialize=0) m.x319 = Var(within=Reals,bounds=(None,None),initialize=0) m.x320 = Var(within=Reals,bounds=(None,None),initialize=0) m.x321 = Var(within=Reals,bounds=(None,None),initialize=0) m.x322 = Var(within=Reals,bounds=(None,None),initialize=0) m.x323 = Var(within=Reals,bounds=(0,93.045051789432),initialize=0) m.x324 = Var(within=Reals,bounds=(None,None),initialize=0) m.x325 = Var(within=Reals,bounds=(None,None),initialize=0) m.x326 = Var(within=Reals,bounds=(None,None),initialize=0) m.x327 = Var(within=Reals,bounds=(None,None),initialize=0) m.x328 = Var(within=Reals,bounds=(0,93.045051789432),initialize=0) m.x329 = Var(within=Reals,bounds=(None,None),initialize=0) m.x330 = Var(within=Reals,bounds=(None,None),initialize=0) m.x331 = Var(within=Reals,bounds=(None,None),initialize=0) m.x332 = Var(within=Reals,bounds=(None,None),initialize=0) m.x333 = Var(within=Reals,bounds=(0,93.045051789432),initialize=0) m.x334 = Var(within=Reals,bounds=(None,None),initialize=0) m.x335 = Var(within=Reals,bounds=(None,None),initialize=0) m.x336 = Var(within=Reals,bounds=(None,None),initialize=0) m.x337 = Var(within=Reals,bounds=(None,None),initialize=0) m.x338 = Var(within=Reals,bounds=(0,93.045051789432),initialize=0) m.x339 = Var(within=Reals,bounds=(None,None),initialize=0) m.x340 = Var(within=Reals,bounds=(None,None),initialize=0) m.x341 = Var(within=Reals,bounds=(None,None),initialize=0) m.x342 = Var(within=Reals,bounds=(None,None),initialize=0) m.x343 = Var(within=Reals,bounds=(None,None),initialize=0) m.x344 = Var(within=Reals,bounds=(None,None),initialize=0) m.x345 = Var(within=Reals,bounds=(0,93.045051789432),initialize=0) m.x346 = Var(within=Reals,bounds=(None,None),initialize=0) m.x347 = Var(within=Reals,bounds=(None,None),initialize=0) m.x348 = Var(within=Reals,bounds=(0,93.045051789432),initialize=0) m.x349 = Var(within=Reals,bounds=(None,None),initialize=0) m.x350 = Var(within=Reals,bounds=(None,None),initialize=0) m.x351 = Var(within=Reals,bounds=(None,None),initialize=0) m.x352 = Var(within=Reals,bounds=(None,None),initialize=0) m.x353 = Var(within=Reals,bounds=(0,112.384987749469),initialize=0) m.x354 = Var(within=Reals,bounds=(None,None),initialize=0) m.x355 = Var(within=Reals,bounds=(None,None),initialize=0) m.x356 = Var(within=Reals,bounds=(None,None),initialize=0) m.x357 = Var(within=Reals,bounds=(None,None),initialize=0) m.x358 = Var(within=Reals,bounds=(0,112.384987749469),initialize=0) m.x359 = Var(within=Reals,bounds=(None,None),initialize=0) m.x360 = Var(within=Reals,bounds=(None,None),initialize=0) m.x361 = Var(within=Reals,bounds=(None,None),initialize=0) m.x362 = Var(within=Reals,bounds=(None,None),initialize=0) m.x363 = Var(within=Reals,bounds=(0,112.384987749469),initialize=0) m.x364 = Var(within=Reals,bounds=(None,None),initialize=0) m.x365 = Var(within=Reals,bounds=(None,None),initialize=0) m.x366 = Var(within=Reals,bounds=(None,None),initialize=0) m.x367 = Var(within=Reals,bounds=(None,None),initialize=0) m.x368 = Var(within=Reals,bounds=(0,112.384987749469),initialize=0) m.x369 = Var(within=Reals,bounds=(None,None),initialize=0) m.x370 = Var(within=Reals,bounds=(None,None),initialize=0) m.x371 = Var(within=Reals,bounds=(None,None),initialize=0) m.x372 = Var(within=Reals,bounds=(None,None),initialize=0) m.x373 = Var(within=Reals,bounds=(0,112.384987749469),initialize=0) m.x374 = Var(within=Reals,bounds=(None,None),initialize=0) m.x375 = Var(within=Reals,bounds=(None,None),initialize=0) m.x376 = Var(within=Reals,bounds=(None,None),initialize=0) m.x377 = Var(within=Reals,bounds=(None,None),initialize=0) m.x378 = Var(within=Reals,bounds=(0,112.384987749469),initialize=0) m.x379 = Var(within=Reals,bounds=(None,None),initialize=0) m.x380 = Var(within=Reals,bounds=(None,None),initialize=0) m.x381 = Var(within=Reals,bounds=(None,None),initialize=0) m.x382 = Var(within=Reals,bounds=(None,None),initialize=0) m.x383 = Var(within=Reals,bounds=(0,42.066542469172),initialize=0) m.x384 = Var(within=Reals,bounds=(None,None),initialize=0) m.x385 = Var(within=Reals,bounds=(None,None),initialize=0) m.x386 = Var(within=Reals,bounds=(None,None),initialize=0) m.x387 = Var(within=Reals,bounds=(None,None),initialize=0) m.x388 = Var(within=Reals,bounds=(0,42.066542469172),initialize=0) m.x389 = Var(within=Reals,bounds=(None,None),initialize=0) m.x390 = Var(within=Reals,bounds=(None,None),initialize=0) m.x391 = Var(within=Reals,bounds=(None,None),initialize=0) m.x392 = Var(within=Reals,bounds=(None,None),initialize=0) m.x393 = Var(within=Reals,bounds=(0,42.066542469172),initialize=0) m.x394 = Var(within=Reals,bounds=(None,None),initialize=0) m.x395 = Var(within=Reals,bounds=(None,None),initialize=0) m.x396 = Var(within=Reals,bounds=(None,None),initialize=0) m.x397 = Var(within=Reals,bounds=(None,None),initialize=0) m.x398 = Var(within=Reals,bounds=(0,42.066542469172),initialize=0) m.x399 = Var(within=Reals,bounds=(None,None),initialize=0) m.x400 = Var(within=Reals,bounds=(None,None),initialize=0) m.x401 = Var(within=Reals,bounds=(None,None),initialize=0) m.x402 = Var(within=Reals,bounds=(None,None),initialize=0) m.x403 = Var(within=Reals,bounds=(0,42.066542469172),initialize=0) m.x404 = Var(within=Reals,bounds=(None,None),initialize=0) m.x405 = Var(within=Reals,bounds=(None,None),initialize=0) m.x406 = Var(within=Reals,bounds=(None,None),initialize=0) m.x407 = Var(within=Reals,bounds=(None,None),initialize=0) m.x408 = Var(within=Reals,bounds=(0,42.066542469172),initialize=0) m.x409 = Var(within=Reals,bounds=(None,None),initialize=0) m.x410 = Var(within=Reals,bounds=(None,None),initialize=0) m.x411 = Var(within=Reals,bounds=(None,None),initialize=0) m.x412 = Var(within=Reals,bounds=(None,None),initialize=0) m.x413 = Var(within=Reals,bounds=(0,25),initialize=0) m.x414 = Var(within=Reals,bounds=(0,25),initialize=0) m.x415 = Var(within=Reals,bounds=(0,25),initialize=0) m.x416 = Var(within=Reals,bounds=(0,25),initialize=0) m.x417 = Var(within=Reals,bounds=(0,25),initialize=0) m.x418 = Var(within=Reals,bounds=(0,25),initialize=0) m.x419 = Var(within=Reals,bounds=(0,25),initialize=0) m.x420 = Var(within=Reals,bounds=(0,25),initialize=0) m.x421 = Var(within=Reals,bounds=(0,25),initialize=0) m.x422 = Var(within=Reals,bounds=(0,0.64),initialize=0) m.x423 = Var(within=Reals,bounds=(0,0.512),initialize=0) m.x424 = Var(within=Reals,bounds=(0,0.64),initialize=0) m.x425 = Var(within=Reals,bounds=(0,0.512),initialize=0) m.x426 = Var(within=Reals,bounds=(0,0.64),initialize=0) m.x427 = Var(within=Reals,bounds=(0,0.512),initialize=0) m.x428 = Var(within=Reals,bounds=(0,0.64),initialize=0) m.x429 = Var(within=Reals,bounds=(0,0.512),initialize=0) m.x430 = Var(within=Reals,bounds=(0,0.64),initialize=0) m.x431 = Var(within=Reals,bounds=(0,0.512),initialize=0) m.x432 = Var(within=Reals,bounds=(0,0.64),initialize=0) m.x433 = Var(within=Reals,bounds=(0,0.512),initialize=0) m.x434 = Var(within=Reals,bounds=(0,0.64),initialize=0) m.x435 = Var(within=Reals,bounds=(0,0.512),initialize=0) m.x436 = Var(within=Reals,bounds=(0,0.64),initialize=0) m.x437 = Var(within=Reals,bounds=(0,0.512),initialize=0) m.x438 = Var(within=Reals,bounds=(0,0.64),initialize=0) m.x439 = Var(within=Reals,bounds=(0,0.512),initialize=0) m.x440 = Var(within=Reals,bounds=(0,0.25),initialize=0) m.x441 = Var(within=Reals,bounds=(0,0.125),initialize=0) m.x442 = Var(within=Reals,bounds=(0,0.25),initialize=0) m.x443 = Var(within=Reals,bounds=(0,0.125),initialize=0) m.x444 = Var(within=Reals,bounds=(0,0.25),initialize=0) m.x445 = Var(within=Reals,bounds=(0,0.125),initialize=0) m.x446 = Var(within=Reals,bounds=(0,0.25),initialize=0) m.x447 = Var(within=Reals,bounds=(0,0.125),initialize=0) m.x448 = Var(within=Reals,bounds=(0,0.25),initialize=0) m.x449 = Var(within=Reals,bounds=(0,0.125),initialize=0) m.x450 = Var(within=Reals,bounds=(0,0.25),initialize=0) m.x451 = Var(within=Reals,bounds=(0,0.125),initialize=0) m.x452 = Var(within=Reals,bounds=(0,0.49),initialize=0) m.x453 = Var(within=Reals,bounds=(0,0.343),initialize=0) m.x454 = Var(within=Reals,bounds=(0,0.49),initialize=0) m.x455 = Var(within=Reals,bounds=(0,0.343),initialize=0) m.x456 = Var(within=Reals,bounds=(0,0.49),initialize=0) m.x457 = Var(within=Reals,bounds=(0,0.343),initialize=0) m.x458 = Var(within=Reals,bounds=(0,0.49),initialize=0) m.x459 = Var(within=Reals,bounds=(0,0.343),initialize=0) m.x460 = Var(within=Reals,bounds=(0,0.49),initialize=0) m.x461 = Var(within=Reals,bounds=(0,0.343),initialize=0) m.x462 = Var(within=Reals,bounds=(0,0.49),initialize=0) m.x463 = Var(within=Reals,bounds=(0,0.343),initialize=0) m.x464 = Var(within=Reals,bounds=(0,0.3364),initialize=0) m.x465 = Var(within=Reals,bounds=(0,0.195112),initialize=0) m.x466 = Var(within=Reals,bounds=(0,0.3364),initialize=0) m.x467 = Var(within=Reals,bounds=(0,0.195112),initialize=0) m.x468 = Var(within=Reals,bounds=(0,0.3364),initialize=0) m.x469 = Var(within=Reals,bounds=(0,0.195112),initialize=0) m.x470 = Var(within=Reals,bounds=(0,0.3364),initialize=0) m.x471 = Var(within=Reals,bounds=(0,0.195112),initialize=0) m.x472 = Var(within=Reals,bounds=(0,0.3364),initialize=0) m.x473 = Var(within=Reals,bounds=(0,0.195112),initialize=0) m.x474 = Var(within=Reals,bounds=(0,0.3364),initialize=0) m.x475 = Var(within=Reals,bounds=(0,0.195112),initialize=0) m.x476 = Var(within=Reals,bounds=(0.36,1),initialize=0.36) m.x477 = Var(within=Reals,bounds=(0.216,1),initialize=0.216) m.x478 = Var(within=Reals,bounds=(0.36,1),initialize=0.36) m.x479 = Var(within=Reals,bounds=(0.216,1),initialize=0.216) m.x480 = Var(within=Reals,bounds=(0.36,1),initialize=0.36) m.x481 = Var(within=Reals,bounds=(0.216,1),initialize=0.216) m.x482 = Var(within=Reals,bounds=(0.64,1),initialize=0.64) m.x483 = Var(within=Reals,bounds=(0.512,1),initialize=0.512) m.x484 = Var(within=Reals,bounds=(0.64,1),initialize=0.64) m.x485 = Var(within=Reals,bounds=(0.512,1),initialize=0.512) m.x486 = Var(within=Reals,bounds=(0.64,1),initialize=0.64) m.x487 = Var(within=Reals,bounds=(0.512,1),initialize=0.512) m.x488 = Var(within=Reals,bounds=(0.7225,1),initialize=0.7225) m.x489 = Var(within=Reals,bounds=(0.614125,1),initialize=0.614125) m.x490 = Var(within=Reals,bounds=(0.7225,1),initialize=0.7225) m.x491 = Var(within=Reals,bounds=(0.614125,1),initialize=0.614125) m.x492 = Var(within=Reals,bounds=(0.7225,1),initialize=0.7225) m.x493 = Var(within=Reals,bounds=(0.614125,1),initialize=0.614125) m.x494 = Var(within=Reals,bounds=(0.49,1),initialize=0.49) m.x495 = Var(within=Reals,bounds=(0.343,1),initialize=0.343) m.x496 = Var(within=Reals,bounds=(0.49,1),initialize=0.49) m.x497 = Var(within=Reals,bounds=(0.343,1),initialize=0.343) m.x498 = Var(within=Reals,bounds=(0.49,1),initialize=0.49) m.x499 = Var(within=Reals,bounds=(0.343,1),initialize=0.343) m.obj = Objective(expr= m.x278 + m.x283 + m.x288 + m.x293 + m.x298 + m.x303 + m.x308 + m.x313 + m.x318 + m.x323 + m.x328 + m.x333 + m.x338 + m.x345 + m.x348 + m.x353 + m.x358 + m.x363 + m.x368 + m.x373 + m.x378 + m.x383 + m.x388 + m.x393 + m.x398 + m.x403 + m.x408, sense=minimize) m.c2 = Constraint(expr= m.x141 + 27.42831624*m.x143 + 37.5407324*m.x145 - 57.2814121*m.x147 == 0) m.c3 = Constraint(expr= m.x149 + 27.42831624*m.x151 - 57.2814121*m.x153 + 37.5407324*m.x155 == 0) m.c4 = Constraint(expr= m.x157 + 27.42831624*m.x159 - 57.2814121*m.x161 + 37.5407324*m.x163 == 0) m.c5 = Constraint(expr= - 57.2814121*m.x147 + m.x165 + 27.42831624*m.x167 + 37.5407324*m.x169 == 0) m.c6 = Constraint(expr= - 57.2814121*m.x153 + m.x171 + 37.5407324*m.x173 + 27.42831624*m.x175 == 0) m.c7 = Constraint(expr= - 57.2814121*m.x161 + m.x177 + 37.5407324*m.x179 + 27.42831624*m.x181 == 0) m.c8 = Constraint(expr= - 57.2814121*m.x147 + m.x183 + 37.5407324*m.x185 + 27.42831624*m.x187 == 0) m.c9 = Constraint(expr= - 57.2814121*m.x153 + m.x189 + 27.42831624*m.x191 + 37.5407324*m.x193 == 0) m.c10 = Constraint(expr= m.x29 + 27.42831624*m.x30 + 37.5407324*m.x31 - 57.2814121*m.x161 == 0) m.c11 = Constraint(expr= m.x32 - 76.45219958*m.x33 + 43.14087708*m.x34 + 50.37356589*m.x35 == 0) m.c12 = Constraint(expr= m.x36 + 50.37356589*m.x37 - 76.45219958*m.x38 + 43.14087708*m.x39 == 0) m.c13 = Constraint(expr= m.x40 + 43.14087708*m.x41 + 50.37356589*m.x42 - 76.45219958*m.x43 == 0) m.c14 = Constraint(expr= - 76.45219958*m.x33 + m.x44 + 43.14087708*m.x45 + 50.37356589*m.x46 == 0) m.c15 = Constraint(expr= - 76.45219958*m.x38 + m.x47 + 50.37356589*m.x48 + 43.14087708*m.x49 == 0) m.c16 = Constraint(expr= - 76.45219958*m.x43 + m.x50 + 43.14087708*m.x51 + 50.37356589*m.x52 == 0) m.c17 = Constraint(expr= m.x53 + 58.31011875*m.x54 - 69.39622571*m.x55 - 25.39911174*m.x56 == 0) m.c18 = Constraint(expr= m.x57 - 25.39911174*m.x58 + 58.31011875*m.x59 - 69.39622571*m.x60 == 0) m.c19 = Constraint(expr= m.x61 - 69.39622571*m.x62 + 58.31011875*m.x63 - 25.39911174*m.x64 == 0) m.c20 = Constraint(expr= - 69.39622571*m.x55 + m.x65 + 58.31011875*m.x66 - 25.39911174*m.x67 == 0) m.c21 = Constraint(expr= - 69.39622571*m.x60 + m.x68 - 25.39911174*m.x69 + 58.31011875*m.x70 == 0) m.c22 = Constraint(expr= - 69.39622571*m.x62 + m.x71 + 58.31011875*m.x72 - 25.39911174*m.x73 == 0) m.c23 = Constraint(expr= m.x74 - 2.03724124*m.x75 + 63.61644904*m.x76 - 34.92732674*m.x77 == 0) m.c24 = Constraint(expr= m.x78 - 2.03724124*m.x79 - 34.92732674*m.x80 + 63.61644904*m.x81 == 0) m.c25 = Constraint(expr= m.x82 - 2.03724124*m.x83 - 34.92732674*m.x84 + 63.61644904*m.x85 == 0) m.c26 = Constraint(expr= - 34.92732674*m.x77 + m.x86 + 63.61644904*m.x87 - 2.03724124*m.x88 == 0) m.c27 = Constraint(expr= - 34.92732674*m.x80 + m.x89 + 63.61644904*m.x90 - 2.03724124*m.x91 == 0) m.c28 = Constraint(expr= - 34.92732674*m.x84 + m.x92 - 2.03724124*m.x93 + 63.61644904*m.x94 == 0) m.c29 = Constraint(expr= m.x95 + m.x96 + m.x97 >= 0.875) m.c30 = Constraint(expr= - m.x98 + m.x99 == 0) m.c31 = Constraint(expr= - m.x100 + m.x101 == 0) m.c32 = Constraint(expr= - m.x102 + m.x103 == 0) m.c33 = Constraint(expr= - m.x104 + m.x105 == 0) m.c34 = Constraint(expr= - m.x106 + m.x107 == 0) m.c35 = Constraint(expr= - m.x108 + m.x109 == 0) m.c36 = Constraint(expr= m.x104 - m.x110 == 0) m.c37 = Constraint(expr= m.x106 - m.x111 == 0) m.c38 = Constraint(expr= m.x108 - m.x112 == 0) m.c39 = Constraint(expr= - m.x113 + m.x114 == 0) m.c40 = Constraint(expr= - m.x115 + m.x116 == 0) m.c41 = Constraint(expr= - m.x117 + m.x118 == 0) m.c42 = Constraint(expr= m.x119 == 0.296666667) m.c43 = Constraint(expr= m.x120 == 0.294444444) m.c44 = Constraint(expr= m.x121 == 0.283888889) m.c45 = Constraint(expr= m.x95 - m.x99 == 0) m.c46 = Constraint(expr= m.x96 - m.x101 == 0) m.c47 = Constraint(expr= m.x97 - m.x103 == 0) m.c48 = Constraint(expr= 3600*m.x98 - 3600*m.x105 + 1800*m.x122 - 1800*m.x123 == 0) m.c49 = Constraint(expr= 3600*m.x100 - 3600*m.x107 + 1800*m.x124 - 1800*m.x125 == 0) m.c50 = Constraint(expr= 3600*m.x102 - 3600*m.x109 + 1800*m.x126 - 1800*m.x127 == 0) m.c51 = Constraint(expr= 3600*m.x110 - 3600*m.x114 + 720*m.x128 - 720*m.x129 == 0) m.c52 = Constraint(expr= 3600*m.x111 - 3600*m.x116 + 720*m.x130 - 720*m.x131 == 0) m.c53 = Constraint(expr= 3600*m.x112 - 3600*m.x118 + 720*m.x132 - 720*m.x133 == 0) m.c54 = Constraint(expr= 3600*m.x113 - 3600*m.x119 + 1600*m.x134 - 1600*m.x135 == 0) m.c55 = Constraint(expr= 3600*m.x115 - 3600*m.x120 + 1600*m.x136 - 1600*m.x137 == 0) m.c56 = Constraint(expr= 3600*m.x117 - 3600*m.x121 + 1600*m.x138 - 1600*m.x139 == 0) m.c57 = Constraint(expr= - m.x123 + m.x124 == 0) m.c58 = Constraint(expr= - m.x125 + m.x126 == 0) m.c59 = Constraint(expr= - m.x129 + m.x130 == 0) m.c60 = Constraint(expr= - m.x131 + m.x132 == 0) m.c61 = Constraint(expr= - m.x135 + m.x136 == 0) m.c62 = Constraint(expr= - m.x137 + m.x138 == 0) m.c63 = Constraint(expr= - 0.2*m.b2 + m.x140 >= 0) m.c64 = Constraint(expr= - 0.2*m.b3 + m.x142 >= 0) m.c65 = Constraint(expr= - 0.2*m.b4 + m.x144 >= 0) m.c66 = Constraint(expr= - 0.2*m.b5 + m.x146 >= 0) m.c67 = Constraint(expr= - 0.2*m.b6 + m.x148 >= 0) m.c68 = Constraint(expr= - 0.2*m.b7 + m.x150 >= 0) m.c69 = Constraint(expr= - 0.2*m.b8 + m.x152 >= 0) m.c70 = Constraint(expr= - 0.2*m.b9 + m.x154 >= 0) m.c71 = Constraint(expr= - 0.2*m.b10 + m.x156 >= 0) m.c72 = Constraint(expr= - 0.25*m.b11 + m.x158 >= 0) m.c73 = Constraint(expr= - 0.25*m.b12 + m.x160 >= 0) m.c74 = Constraint(expr= - 0.25*m.b13 + m.x162 >= 0) m.c75 = Constraint(expr= - 0.25*m.b14 + m.x164 >= 0) m.c76 = Constraint(expr= - 0.25*m.b15 + m.x166 >= 0) m.c77 = Constraint(expr= - 0.25*m.b16 + m.x168 >= 0) m.c78 = Constraint(expr= - 0.4*m.b17 + m.x170 >= 0) m.c79 = Constraint(expr= - 0.4*m.b18 + m.x172 >= 0) m.c80 = Constraint(expr= - 0.4*m.b19 + m.x174 >= 0) m.c81 = Constraint(expr= - 0.4*m.b20 + m.x176 >= 0) m.c82 = Constraint(expr= - 0.4*m.b21 + m.x178 >= 0) m.c83 = Constraint(expr= - 0.4*m.b22 + m.x180 >= 0) m.c84 = Constraint(expr= - 0.24*m.b23 + m.x182 >= 0) m.c85 = Constraint(expr= - 0.24*m.b24 + m.x184 >= 0) m.c86 = Constraint(expr= - 0.24*m.b25 + m.x186 >= 0) m.c87 = Constraint(expr= - 0.24*m.b26 + m.x188 >= 0) m.c88 = Constraint(expr= - 0.24*m.b27 + m.x190 >= 0) m.c89 = Constraint(expr= - 0.24*m.b28 + m.x192 >= 0) m.c90 = Constraint(expr= - 0.8*m.b2 + m.x140 <= 0) m.c91 = Constraint(expr= - 0.8*m.b3 + m.x142 <= 0) m.c92 = Constraint(expr= - 0.8*m.b4 + m.x144 <= 0) m.c93 = Constraint(expr= - 0.8*m.b5 + m.x146 <= 0) m.c94 = Constraint(expr= - 0.8*m.b6 + m.x148 <= 0) m.c95 = Constraint(expr= - 0.8*m.b7 + m.x150 <= 0) m.c96 = Constraint(expr= - 0.8*m.b8 + m.x152 <= 0) m.c97 = Constraint(expr= - 0.8*m.b9 + m.x154 <= 0) m.c98 = Constraint(expr= - 0.8*m.b10 + m.x156 <= 0) m.c99 = Constraint(expr= - 0.5*m.b11 + m.x158 <= 0) m.c100 = Constraint(expr= - 0.5*m.b12 + m.x160 <= 0) m.c101 = Constraint(expr= - 0.5*m.b13 + m.x162 <= 0) m.c102 = Constraint(expr= - 0.5*m.b14 + m.x164 <= 0) m.c103 = Constraint(expr= - 0.5*m.b15 + m.x166 <= 0) m.c104 = Constraint(expr= - 0.5*m.b16 + m.x168 <= 0) m.c105 = Constraint(expr= - 0.7*m.b17 + m.x170 <= 0) m.c106 = Constraint(expr= - 0.7*m.b18 + m.x172 <= 0) m.c107 = Constraint(expr= - 0.7*m.b19 + m.x174 <= 0) m.c108 = Constraint(expr= - 0.7*m.b20 + m.x176 <= 0) m.c109 = Constraint(expr= - 0.7*m.b21 + m.x178 <= 0) m.c110 = Constraint(expr= - 0.7*m.b22 + m.x180 <= 0) m.c111 = Constraint(expr= - 0.58*m.b23 + m.x182 <= 0) m.c112 = Constraint(expr= - 0.58*m.b24 + m.x184 <= 0) m.c113 = Constraint(expr= - 0.58*m.b25 + m.x186 <= 0) m.c114 = Constraint(expr= - 0.58*m.b26 + m.x188 <= 0) m.c115 = Constraint(expr= - 0.58*m.b27 + m.x190 <= 0) m.c116 = Constraint(expr= - 0.58*m.b28 + m.x192 <= 0) m.c117 = Constraint(expr= - m.x122 + m.x194 == 60) m.c118 = Constraint(expr= - m.x124 + m.x195 == 60) m.c119 = Constraint(expr= - m.x126 + m.x196 == 60) m.c120 = Constraint(expr= - m.x128 + m.x197 == 90) m.c121 = Constraint(expr= - m.x130 + m.x198 == 90) m.c122 = Constraint(expr= - m.x132 + m.x199 == 90) m.c123 = Constraint(expr= - m.x134 + m.x200 == 103) m.c124 = Constraint(expr= - m.x136 + m.x201 == 103) m.c125 = Constraint(expr= - m.x138 + m.x202 == 103) m.c126 = Constraint(expr= - m.x194 + m.x203 - m.x204 == 0) m.c127 = Constraint(expr= - m.x195 + m.x205 - m.x206 == 0) m.c128 = Constraint(expr= - m.x196 + m.x207 - m.x208 == 0) m.c129 = Constraint(expr= m.x209 - m.x210 - m.x211 == 0) m.c130 = Constraint(expr= m.x212 - m.x213 - m.x214 == 0) m.c131 = Constraint(expr= m.x215 - m.x216 - m.x217 == 0) m.c132 = Constraint(expr= - m.x200 + m.x218 - m.x219 == 0) m.c133 = Constraint(expr= - m.x201 + m.x220 - m.x221 == 0) m.c134 = Constraint(expr= - m.x202 + m.x222 - m.x223 == 0) m.c135 = Constraint(expr= m.x203 - m.x224 - m.x225 == 0) m.c136 = Constraint(expr= m.x205 - m.x226 - m.x227 == 0) m.c137 = Constraint(expr= m.x207 - m.x228 - m.x229 == 0) m.c138 = Constraint(expr= - m.x194 + m.x209 - m.x230 == 0) m.c139 = Constraint(expr= - m.x195 + m.x212 - m.x231 == 0) m.c140 = Constraint(expr= - m.x196 + m.x215 - m.x232 == 0) m.c141 = Constraint(expr= - m.x197 + m.x218 - m.x233 == 0) m.c142 = Constraint(expr= - m.x198 + m.x220 - m.x234 == 0) m.c143 = Constraint(expr= - m.x199 + m.x222 - m.x235 == 0) m.c144 = Constraint(expr= 0.2*m.b2 - m.x140 + m.x236 <= 0.2) m.c145 = Constraint(expr= 0.2*m.b3 - m.x142 + m.x237 <= 0.2) m.c146 = Constraint(expr= 0.2*m.b4 - m.x144 + m.x238 <= 0.2) m.c147 = Constraint(expr= 0.2*m.b5 - m.x146 + m.x239 <= 0.2) m.c148 = Constraint(expr= 0.2*m.b6 - m.x148 + m.x240 <= 0.2) m.c149 = Constraint(expr= 0.2*m.b7 - m.x150 + m.x241 <= 0.2) m.c150 = Constraint(expr= 0.2*m.b8 - m.x152 + m.x242 <= 0.2) m.c151 = Constraint(expr= 0.2*m.b9 - m.x154 + m.x243 <= 0.2) m.c152 = Constraint(expr= 0.2*m.b10 - m.x156 + m.x244 <= 0.2) m.c153 = Constraint(expr= 0.25*m.b11 - m.x158 + m.x245 <= 0.25) m.c154 = Constraint(expr= 0.25*m.b12 - m.x160 + m.x246 <= 0.25) m.c155 = Constraint(expr= 0.25*m.b13 - m.x162 + m.x247 <= 0.25) m.c156 = Constraint(expr= 0.25*m.b14 - m.x164 + m.x248 <= 0.25) m.c157 = Constraint(expr= 0.25*m.b15 - m.x166 + m.x249 <= 0.25) m.c158 = Constraint(expr= 0.25*m.b16 - m.x168 + m.x250 <= 0.25) m.c159 = Constraint(expr= 0.4*m.b17 - m.x170 + m.x251 <= 0.4) m.c160 = Constraint(expr= 0.4*m.b18 - m.x172 + m.x252 <= 0.4) m.c161 = Constraint(expr= 0.4*m.b19 - m.x174 + m.x253 <= 0.4) m.c162 = Constraint(expr= 0.4*m.b20 - m.x176 + m.x254 <= 0.4) m.c163 = Constraint(expr= 0.4*m.b21 - m.x178 + m.x255 <= 0.4) m.c164 = Constraint(expr= 0.4*m.b22 - m.x180 + m.x256 <= 0.4) m.c165 = Constraint(expr= 0.24*m.b23 - m.x182 + m.x257 <= 0.24) m.c166 = Constraint(expr= 0.24*m.b24 - m.x184 + m.x258 <= 0.24) m.c167 = Constraint(expr= 0.24*m.b25 - m.x186 + m.x259 <= 0.24) m.c168 = Constraint(expr= 0.24*m.b26 - m.x188 + m.x260 <= 0.24) m.c169 = Constraint(expr= 0.24*m.b27 - m.x190 + m.x261 <= 0.24) m.c170 = Constraint(expr= 0.24*m.b28 - m.x192 + m.x262 <= 0.24) m.c171 = Constraint(expr= - m.x140 + m.x236 >= 0) m.c172 = Constraint(expr= - m.x142 + m.x237 >= 0) m.c173 = Constraint(expr= - m.x144 + m.x238 >= 0) m.c174 = Constraint(expr= - m.x146 + m.x239 >= 0) m.c175 = Constraint(expr= - m.x148 + m.x240 >= 0) m.c176 = Constraint(expr= - m.x150 + m.x241 >= 0) m.c177 = Constraint(expr= - m.x152 + m.x242 >= 0) m.c178 = Constraint(expr= - m.x154 + m.x243 >= 0) m.c179 = Constraint(expr= - m.x156 + m.x244 >= 0) m.c180 = Constraint(expr= - m.x158 + m.x245 >= 0) m.c181 = Constraint(expr= - m.x160 + m.x246 >= 0) m.c182 = Constraint(expr= - m.x162 + m.x247 >= 0) m.c183 = Constraint(expr= - m.x164 + m.x248 >= 0) m.c184 = Constraint(expr= - m.x166 + m.x249 >= 0) m.c185 = Constraint(expr= - m.x168 + m.x250 >= 0) m.c186 = Constraint(expr= - m.x170 + m.x251 >= 0) m.c187 = Constraint(expr= - m.x172 + m.x252 >= 0) m.c188 = Constraint(expr= - m.x174 + m.x253 >= 0) m.c189 = Constraint(expr= - m.x176 + m.x254 >= 0) m.c190 = Constraint(expr= - m.x178 + m.x255 >= 0) m.c191 = Constraint(expr= - m.x180 + m.x256 >= 0) m.c192 = Constraint(expr= - m.x182 + m.x257 >= 0) m.c193 = Constraint(expr= - m.x184 + m.x258 >= 0) m.c194 = Constraint(expr= - m.x186 + m.x259 >= 0) m.c195 = Constraint(expr= - m.x188 + m.x260 >= 0) m.c196 = Constraint(expr= - m.x190 + m.x261 >= 0) m.c197 = Constraint(expr= - m.x192 + m.x262 >= 0) m.c198 = Constraint(expr= - 0.6*m.b2 + m.x236 <= 0.2) m.c199 = Constraint(expr= - 0.6*m.b3 + m.x237 <= 0.2) m.c200 = Constraint(expr= - 0.6*m.b4 + m.x238 <= 0.2) m.c201 = Constraint(expr= - 0.6*m.b5 + m.x239 <= 0.2) m.c202 = Constraint(expr= - 0.6*m.b6 + m.x240 <= 0.2) m.c203 = Constraint(expr= - 0.6*m.b7 + m.x241 <= 0.2) m.c204 = Constraint(expr= - 0.6*m.b8 + m.x242 <= 0.2) m.c205 = Constraint(expr= - 0.6*m.b9 + m.x243 <= 0.2) m.c206 = Constraint(expr= - 0.6*m.b10 + m.x244 <= 0.2) m.c207 = Constraint(expr= - 0.25*m.b11 + m.x245 <= 0.25) m.c208 = Constraint(expr= - 0.25*m.b12 + m.x246 <= 0.25) m.c209 = Constraint(expr= - 0.25*m.b13 + m.x247 <= 0.25) m.c210 = Constraint(expr= - 0.25*m.b14 + m.x248 <= 0.25) m.c211 = Constraint(expr= - 0.25*m.b15 + m.x249 <= 0.25) m.c212 = Constraint(expr= - 0.25*m.b16 + m.x250 <= 0.25) m.c213 = Constraint(expr= - 0.3*m.b17 + m.x251 <= 0.4) m.c214 = Constraint(expr= - 0.3*m.b18 + m.x252 <= 0.4) m.c215 = Constraint(expr= - 0.3*m.b19 + m.x253 <= 0.4) m.c216 = Constraint(expr= - 0.3*m.b20 + m.x254 <= 0.4) m.c217 = Constraint(expr= - 0.3*m.b21 + m.x255 <= 0.4) m.c218 = Constraint(expr= - 0.3*m.b22 + m.x256 <= 0.4) m.c219 = Constraint(expr= - 0.34*m.b23 + m.x257 <= 0.24) m.c220 = Constraint(expr= - 0.34*m.b24 + m.x258 <= 0.24) m.c221 = Constraint(expr= - 0.34*m.b25 + m.x259 <= 0.24) m.c222 = Constraint(expr= - 0.34*m.b26 + m.x260 <= 0.24) m.c223 = Constraint(expr= - 0.34*m.b27 + m.x261 <= 0.24) m.c224 = Constraint(expr= - 0.34*m.b28 + m.x262 <= 0.24) m.c225 = Constraint(expr= - 0.4*m.b2 + m.x263 <= 0.6) m.c226 = Constraint(expr= - 0.4*m.b3 + m.x264 <= 0.6) m.c227 = Constraint(expr= - 0.4*m.b4 + m.x265 <= 0.6) m.c228 = Constraint(expr= - 0.2*m.b11 + m.x266 <= 0.8) m.c229 = Constraint(expr= - 0.2*m.b12 + m.x267 <= 0.8) m.c230 = Constraint(expr= - 0.2*m.b13 + m.x268 <= 0.8) m.c231 = Constraint(expr= - 0.15*m.b17 + m.x269 <= 0.85) m.c232 = Constraint(expr= - 0.15*m.b18 + m.x270 <= 0.85) m.c233 = Constraint(expr= - 0.15*m.b19 + m.x271 <= 0.85) m.c234 = Constraint(expr= - 0.3*m.b23 + m.x272 <= 0.7) m.c235 = Constraint(expr= - 0.3*m.b24 + m.x273 <= 0.7) m.c236 = Constraint(expr= - 0.3*m.b25 + m.x274 <= 0.7) m.c237 = Constraint(expr= m.b2 - m.b5 >= 0) m.c238 = Constraint(expr= m.b3 - m.b6 >= 0) m.c239 = Constraint(expr= m.b4 - m.b7 >= 0) m.c240 = Constraint(expr= m.b5 - m.b8 >= 0) m.c241 = Constraint(expr= m.b6 - m.b9 >= 0) m.c242 = Constraint(expr= m.b7 - m.b10 >= 0) m.c243 = Constraint(expr= m.b11 - m.b14 >= 0) m.c244 = Constraint(expr= m.b12 - m.b15 >= 0) m.c245 = Constraint(expr= m.b13 - m.b16 >= 0) m.c246 = Constraint(expr= m.b17 - m.b20 >= 0) m.c247 = Constraint(expr= m.b18 - m.b21 >= 0) m.c248 = Constraint(expr= m.b19 - m.b22 >= 0) m.c249 = Constraint(expr= m.b23 - m.b26 >= 0) m.c250 = Constraint(expr= m.b24 - m.b27 >= 0) m.c251 = Constraint(expr= m.b25 - m.b28 >= 0) m.c252 = Constraint(expr= m.x99 - m.x140 - m.x146 - m.x152 == 0) m.c253 = Constraint(expr= m.x101 - m.x142 - m.x148 - m.x154 == 0) m.c254 = Constraint(expr= m.x103 - m.x144 - m.x150 - m.x156 == 0) m.c255 = Constraint(expr= m.x105 - m.x158 - m.x164 - m.x170 - m.x176 == 0) m.c256 = Constraint(expr= m.x107 - m.x160 - m.x166 - m.x172 - m.x178 == 0) m.c257 = Constraint(expr= m.x109 - m.x162 - m.x168 - m.x174 - m.x180 == 0) m.c258 = Constraint(expr= m.x114 - m.x182 - m.x188 == 0) m.c259 = Constraint(expr= m.x116 - m.x184 - m.x190 == 0) m.c260 = Constraint(expr= m.x118 - m.x186 - m.x192 == 0) m.c261 = Constraint(expr= - 2000*m.b2 + m.x141 - m.x225 >= -2000) m.c262 = Constraint(expr= - 2000*m.b3 + m.x149 - m.x227 >= -2000) m.c263 = Constraint(expr= - 2000*m.b4 + m.x157 - m.x229 >= -2000) m.c264 = Constraint(expr= - 2000*m.b5 + m.x165 - m.x225 >= -2000) m.c265 = Constraint(expr= - 2000*m.b6 + m.x171 - m.x227 >= -2000) m.c266 = Constraint(expr= - 2000*m.b7 + m.x177 - m.x229 >= -2000) m.c267 = Constraint(expr= - 2000*m.b8 + m.x183 - m.x225 >= -2000) m.c268 = Constraint(expr= - 2000*m.b9 + m.x189 - m.x227 >= -2000) m.c269 = Constraint(expr= - 2000*m.b10 + m.x29 - m.x229 >= -2000) m.c270 = Constraint(expr= - 2000*m.b11 + m.x32 - m.x230 >= -2000) m.c271 = Constraint(expr= - 2000*m.b12 + m.x36 - m.x231 >= -2000) m.c272 = Constraint(expr= - 2000*m.b13 + m.x40 - m.x232 >= -2000) m.c273 = Constraint(expr= - 2000*m.b14 + m.x44 - m.x230 >= -2000) m.c274 = Constraint(expr= - 2000*m.b15 + m.x47 - m.x231 >= -2000) m.c275 = Constraint(expr= - 2000*m.b16 + m.x50 - m.x232 >= -2000) m.c276 = Constraint(expr= - 2000*m.b17 + m.x53 - m.x230 >= -2000) m.c277 = Constraint(expr= - 2000*m.b18 + m.x57 - m.x231 >= -2000) m.c278 = Constraint(expr= - 2000*m.b19 + m.x61 - m.x232 >= -2000) m.c279 = Constraint(expr= - 2000*m.b20 + m.x65 - m.x230 >= -2000) m.c280 = Constraint(expr= - 2000*m.b21 + m.x68 - m.x231 >= -2000) m.c281 = Constraint(expr= - 2000*m.b22 + m.x71 - m.x232 >= -2000) m.c282 = Constraint(expr= - 2000*m.b23 + m.x74 - m.x233 >= -2000) m.c283 = Constraint(expr= - 2000*m.b24 + m.x78 - m.x234 >= -2000) m.c284 = Constraint(expr= - 2000*m.b25 + m.x82 - m.x235 >= -2000) m.c285 = Constraint(expr= - 2000*m.b26 + m.x86 - m.x233 >= -2000) m.c286 = Constraint(expr= - 2000*m.b27 + m.x89 - m.x234 >= -2000) m.c287 = Constraint(expr= - 2000*m.b28 + m.x92 - m.x235 >= -2000) m.c288 = Constraint(expr= 1049*m.b2 + m.x141 - m.x225 <= 1049) m.c289 = Constraint(expr= 1049*m.b3 + m.x149 - m.x227 <= 1049) m.c290 = Constraint(expr= 1049*m.b4 + m.x157 - m.x229 <= 1049) m.c291 = Constraint(expr= 1049*m.b5 + m.x165 - m.x225 <= 1049) m.c292 = Constraint(expr= 1049*m.b6 + m.x171 - m.x227 <= 1049) m.c293 = Constraint(expr= 1049*m.b7 + m.x177 - m.x229 <= 1049) m.c294 = Constraint(expr= 1049*m.b8 + m.x183 - m.x225 <= 1049) m.c295 = Constraint(expr= 1049*m.b9 + m.x189 - m.x227 <= 1049) m.c296 = Constraint(expr= 1049*m.b10 + m.x29 - m.x229 <= 1049) m.c297 = Constraint(expr= 1065*m.b11 + m.x32 - m.x230 <= 1065) m.c298 = Constraint(expr= 1065*m.b12 + m.x36 - m.x231 <= 1065) m.c299 = Constraint(expr= 1065*m.b13 + m.x40 - m.x232 <= 1065) m.c300 = Constraint(expr= 1065*m.b14 + m.x44 - m.x230 <= 1065) m.c301 = Constraint(expr= 1065*m.b15 + m.x47 - m.x231 <= 1065) m.c302 = Constraint(expr= 1065*m.b16 + m.x50 - m.x232 <= 1065) m.c303 = Constraint(expr= 1065*m.b17 + m.x53 - m.x230 <= 1065) m.c304 = Constraint(expr= 1065*m.b18 + m.x57 - m.x231 <= 1065) m.c305 = Constraint(expr= 1065*m.b19 + m.x61 - m.x232 <= 1065) m.c306 = Constraint(expr= 1065*m.b20 + m.x65 - m.x230 <= 1065) m.c307 = Constraint(expr= 1065*m.b21 + m.x68 - m.x231 <= 1065) m.c308 = Constraint(expr= 1065*m.b22 + m.x71 - m.x232 <= 1065) m.c309 = Constraint(expr= 1095*m.b23 + m.x74 - m.x233 <= 1095) m.c310 = Constraint(expr= 1095*m.b24 + m.x78 - m.x234 <= 1095) m.c311 = Constraint(expr= 1095*m.b25 + m.x82 - m.x235 <= 1095) m.c312 = Constraint(expr= 1095*m.b26 + m.x86 - m.x233 <= 1095) m.c313 = Constraint(expr= 1095*m.b27 + m.x89 - m.x234 <= 1095) m.c314 = Constraint(expr= 1095*m.b28 + m.x92 - m.x235 <= 1095) m.c315 = Constraint(expr= - m.x197 + m.x210 >= 0) m.c316 = Constraint(expr= - m.x198 + m.x213 >= 0) m.c317 = Constraint(expr= - m.x199 + m.x216 >= 0) m.c318 = Constraint(expr= m.x200 - m.x275 >= 0) m.c319 = Constraint(expr= m.x201 - m.x276 >= 0) m.c320 = Constraint(expr= m.x202 - m.x277 >= 0) m.c321 = Constraint(expr= - 0.309838295393634*m.x278 + 13.94696158*m.x279 + 24.46510819*m.x280 - 7.28623839*m.x281 - 23.57687014*m.x282 <= 0) m.c322 = Constraint(expr= - 0.309838295393634*m.x283 + 13.94696158*m.x284 + 24.46510819*m.x285 - 7.28623839*m.x286 - 23.57687014*m.x287 <= 0) m.c323 = Constraint(expr= - 0.309838295393634*m.x288 + 13.94696158*m.x289 + 24.46510819*m.x290 - 7.28623839*m.x291 - 23.57687014*m.x292 <= 0) m.c324 = Constraint(expr= - 0.309838295393634*m.x293 + 13.94696158*m.x294 + 24.46510819*m.x295 - 7.28623839*m.x296 - 23.57687014*m.x297 <= 0) m.c325 = Constraint(expr= - 0.309838295393634*m.x298 + 13.94696158*m.x299 + 24.46510819*m.x300 - 7.28623839*m.x301 - 23.57687014*m.x302 <= 0) m.c326 = Constraint(expr= - 0.309838295393634*m.x303 + 13.94696158*m.x304 + 24.46510819*m.x305 - 7.28623839*m.x306 - 23.57687014*m.x307 <= 0) m.c327 = Constraint(expr= - 0.309838295393634*m.x308 + 13.94696158*m.x309 + 24.46510819*m.x310 - 7.28623839*m.x311 - 23.57687014*m.x312 <= 0) m.c328 = Constraint(expr= - 0.309838295393634*m.x313 + 13.94696158*m.x314 + 24.46510819*m.x315 - 7.28623839*m.x316 - 23.57687014*m.x317 <= 0) m.c329 = Constraint(expr= - 0.309838295393634*m.x318 + 13.94696158*m.x319 + 24.46510819*m.x320 - 7.28623839*m.x321 - 23.57687014*m.x322 <= 0) m.c330 = Constraint(expr= - 0.309838295393634*m.x323 + 29.29404529*m.x324 - 108.39408287*m.x325 + 442.21990639*m.x326 - 454.58448169*m.x327 <= 0) m.c331 = Constraint(expr= - 0.309838295393634*m.x328 + 29.29404529*m.x329 - 108.39408287*m.x330 + 442.21990639*m.x331 - 454.58448169*m.x332 <= 0) m.c332 = Constraint(expr= - 0.309838295393634*m.x333 + 29.29404529*m.x334 - 108.39408287*m.x335 + 442.21990639*m.x336 - 454.58448169*m.x337 <= 0) m.c333 = Constraint(expr= - 0.309838295393634*m.x338 + 29.29404529*m.x339 - 108.39408287*m.x340 + 442.21990639*m.x341 - 454.58448169*m.x342 <= 0) m.c334 = Constraint(expr= 442.21990639*m.x343 - 454.58448169*m.x344 - 0.309838295393634*m.x345 + 29.29404529*m.x346 - 108.39408287*m.x347 <= 0) m.c335 = Constraint(expr= - 0.309838295393634*m.x348 + 29.29404529*m.x349 - 108.39408287*m.x350 + 442.21990639*m.x351 - 454.58448169*m.x352 <= 0) m.c336 = Constraint(expr= - 0.309838295393634*m.x353 + 25.92674585*m.x354 + 18.13482123*m.x355 + 22.12766012*m.x356 - 42.68950769*m.x357 <= 0) m.c337 = Constraint(expr= - 0.309838295393634*m.x358 + 25.92674585*m.x359 + 18.13482123*m.x360 + 22.12766012*m.x361 - 42.68950769*m.x362 <= 0) m.c338 = Constraint(expr= - 0.309838295393634*m.x363 + 25.92674585*m.x364 + 18.13482123*m.x365 + 22.12766012*m.x366 - 42.68950769*m.x367 <= 0) m.c339 = Constraint(expr= - 0.309838295393634*m.x368 + 25.92674585*m.x369 + 18.13482123*m.x370 + 22.12766012*m.x371 - 42.68950769*m.x372 <= 0) m.c340 = Constraint(expr= - 0.309838295393634*m.x373 + 25.92674585*m.x374 + 18.13482123*m.x375 + 22.12766012*m.x376 - 42.68950769*m.x377 <= 0) m.c341 = Constraint(expr= - 0.309838295393634*m.x378 + 25.92674585*m.x379 + 18.13482123*m.x380 + 22.12766012*m.x381 - 42.68950769*m.x382 <= 0) m.c342 = Constraint(expr= - 0.309838295393634*m.x383 + 17.4714791*m.x384 - 39.98407808*m.x385 + 134.55943082*m.x386 - 135.88441782*m.x387 <= 0) m.c343 = Constraint(expr= - 0.309838295393634*m.x388 + 17.4714791*m.x389 - 39.98407808*m.x390 + 134.55943082*m.x391 - 135.88441782*m.x392 <= 0) m.c344 = Constraint(expr= - 0.309838295393634*m.x393 + 17.4714791*m.x394 - 39.98407808*m.x395 + 134.55943082*m.x396 - 135.88441782*m.x397 <= 0) m.c345 = Constraint(expr= - 0.309838295393634*m.x398 + 17.4714791*m.x399 - 39.98407808*m.x400 + 134.55943082*m.x401 - 135.88441782*m.x402 <= 0) m.c346 = Constraint(expr= - 0.309838295393634*m.x403 + 17.4714791*m.x404 - 39.98407808*m.x405 + 134.55943082*m.x406 - 135.88441782*m.x407 <= 0) m.c347 = Constraint(expr= - 0.309838295393634*m.x408 + 17.4714791*m.x409 - 39.98407808*m.x410 + 134.55943082*m.x411 - 135.88441782*m.x412 <= 0) m.c348 = Constraint(expr=m.x98**2 - m.x413 == 0) m.c349 = Constraint(expr= m.x204 - 5*m.x413 == 0) m.c350 = Constraint(expr=m.x100**2 - m.x414 == 0) m.c351 = Constraint(expr= m.x206 - 5*m.x414 == 0) m.c352 = Constraint(expr=m.x102**2 - m.x415 == 0) m.c353 = Constraint(expr= m.x208 - 5*m.x415 == 0) m.c354 = Constraint(expr=m.x104**2 - m.x416 == 0) m.c355 = Constraint(expr= m.x211 - 4*m.x416 == 0) m.c356 = Constraint(expr=m.x106**2 - m.x417 == 0) m.c357 = Constraint(expr= m.x214 - 4*m.x417 == 0) m.c358 = Constraint(expr=m.x108**2 - m.x418 == 0) m.c359 = Constraint(expr= m.x217 - 4*m.x418 == 0) m.c360 = Constraint(expr=m.x113**2 - m.x419 == 0) m.c361 = Constraint(expr= m.x219 - 5*m.x419 == 0) m.c362 = Constraint(expr=m.x115**2 - m.x420 == 0) m.c363 = Constraint(expr= m.x221 - 5*m.x420 == 0) m.c364 = Constraint(expr=m.x117**2 - m.x421 == 0) m.c365 = Constraint(expr= m.x223 - 5*m.x421 == 0) m.c366 = Constraint(expr=m.x140**2 - m.x422 == 0) m.c367 = Constraint(expr= m.x143 - m.x422 == 0) m.c368 = Constraint(expr=m.x140**3 - m.x423 == 0) m.c369 = Constraint(expr= m.x282 - m.x423 == 0) m.c370 = Constraint(expr=m.x142**2 - m.x424 == 0) m.c371 = Constraint(expr= m.x151 - m.x424 == 0) m.c372 = Constraint(expr=m.x142**3 - m.x425 == 0) m.c373 = Constraint(expr= m.x287 - m.x425 == 0) m.c374 = Constraint(expr=m.x144**2 - m.x426 == 0) m.c375 = Constraint(expr= m.x159 - m.x426 == 0) m.c376 = Constraint(expr=m.x144**3 - m.x427 == 0) m.c377 = Constraint(expr= m.x292 - m.x427 == 0) m.c378 = Constraint(expr=m.x146**2 - m.x428 == 0) m.c379 = Constraint(expr= m.x167 - m.x428 == 0) m.c380 = Constraint(expr=m.x146**3 - m.x429 == 0) m.c381 = Constraint(expr= m.x297 - m.x429 == 0) m.c382 = Constraint(expr=m.x148**2 - m.x430 == 0) m.c383 = Constraint(expr= m.x175 - m.x430 == 0) m.c384 = Constraint(expr=m.x148**3 - m.x431 == 0) m.c385 = Constraint(expr= m.x302 - m.x431 == 0) m.c386 = Constraint(expr=m.x150**2 - m.x432 == 0) m.c387 = Constraint(expr= m.x181 - m.x432 == 0) m.c388 = Constraint(expr=m.x150**3 - m.x433 == 0) m.c389 = Constraint(expr= m.x307 - m.x433 == 0) m.c390 = Constraint(expr=m.x152**2 - m.x434 == 0) m.c391 = Constraint(expr= m.x187 - m.x434 == 0) m.c392 = Constraint(expr=m.x152**3 - m.x435 == 0) m.c393 = Constraint(expr= m.x312 - m.x435 == 0) m.c394 = Constraint(expr=m.x154**2 - m.x436 == 0) m.c395 = Constraint(expr= m.x191 - m.x436 == 0) m.c396 = Constraint(expr=m.x154**3 - m.x437 == 0) m.c397 = Constraint(expr= m.x317 - m.x437 == 0) m.c398 = Constraint(expr=m.x156**2 - m.x438 == 0) m.c399 = Constraint(expr= m.x30 - m.x438 == 0) m.c400 = Constraint(expr=m.x156**3 - m.x439 == 0) m.c401 = Constraint(expr= m.x322 - m.x439 == 0) m.c402 = Constraint(expr=m.x158**2 - m.x440 == 0) m.c403 = Constraint(expr= m.x35 - m.x440 == 0) m.c404 = Constraint(expr=m.x158**3 - m.x441 == 0) m.c405 = Constraint(expr= m.x327 - m.x441 == 0) m.c406 = Constraint(expr=m.x160**2 - m.x442 == 0) m.c407 = Constraint(expr= m.x37 - m.x442 == 0) m.c408 = Constraint(expr=m.x160**3 - m.x443 == 0) m.c409 = Constraint(expr= m.x332 - m.x443 == 0) m.c410 = Constraint(expr=m.x162**2 - m.x444 == 0) m.c411 = Constraint(expr= m.x42 - m.x444 == 0) m.c412 = Constraint(expr=m.x162**3 - m.x445 == 0) m.c413 = Constraint(expr= m.x337 - m.x445 == 0) m.c414 = Constraint(expr=m.x164**2 - m.x446 == 0) m.c415 = Constraint(expr= m.x46 - m.x446 == 0) m.c416 = Constraint(expr=m.x164**3 - m.x447 == 0) m.c417 = Constraint(expr= m.x342 - m.x447 == 0) m.c418 = Constraint(expr=m.x166**2 - m.x448 == 0) m.c419 = Constraint(expr= m.x48 - m.x448 == 0) m.c420 = Constraint(expr=m.x166**3 - m.x449 == 0) m.c421 = Constraint(expr= m.x344 - m.x449 == 0) m.c422 = Constraint(expr=m.x168**2 - m.x450 == 0) m.c423 = Constraint(expr= m.x52 - m.x450 == 0) m.c424 = Constraint(expr=m.x168**3 - m.x451 == 0) m.c425 = Constraint(expr= m.x352 - m.x451 == 0) m.c426 = Constraint(expr=m.x170**2 - m.x452 == 0) m.c427 = Constraint(expr= m.x56 - m.x452 == 0) m.c428 = Constraint(expr=m.x170**3 - m.x453 == 0) m.c429 = Constraint(expr= m.x357 - m.x453 == 0) m.c430 = Constraint(expr=m.x172**2 - m.x454 == 0) m.c431 = Constraint(expr= m.x58 - m.x454 == 0) m.c432 = Constraint(expr=m.x172**3 - m.x455 == 0) m.c433 = Constraint(expr= m.x362 - m.x455 == 0) m.c434 = Constraint(expr=m.x174**2 - m.x456 == 0) m.c435 = Constraint(expr= m.x64 - m.x456 == 0) m.c436 = Constraint(expr=m.x174**3 - m.x457 == 0) m.c437 = Constraint(expr= m.x367 - m.x457 == 0) m.c438 = Constraint(expr=m.x176**2 - m.x458 == 0) m.c439 = Constraint(expr= m.x67 - m.x458 == 0) m.c440 = Constraint(expr=m.x176**3 - m.x459 == 0) m.c441 = Constraint(expr= m.x372 - m.x459 == 0) m.c442 = Constraint(expr=m.x178**2 - m.x460 == 0) m.c443 = Constraint(expr= m.x69 - m.x460 == 0) m.c444 = Constraint(expr=m.x178**3 - m.x461 == 0) m.c445 = Constraint(expr= m.x377 - m.x461 == 0) m.c446 = Constraint(expr=m.x180**2 - m.x462 == 0) m.c447 = Constraint(expr= m.x73 - m.x462 == 0) m.c448 = Constraint(expr=m.x180**3 - m.x463 == 0) m.c449 = Constraint(expr= m.x382 - m.x463 == 0) m.c450 = Constraint(expr=m.x182**2 - m.x464 == 0) m.c451 = Constraint(expr= m.x76 - m.x464 == 0) m.c452 = Constraint(expr=m.x182**3 - m.x465 == 0) m.c453 = Constraint(expr= m.x387 - m.x465 == 0) m.c454 = Constraint(expr=m.x184**2 - m.x466 == 0) m.c455 = Constraint(expr= m.x81 - m.x466 == 0) m.c456 = Constraint(expr=m.x184**3 - m.x467 == 0) m.c457 = Constraint(expr= m.x392 - m.x467 == 0) m.c458 = Constraint(expr=m.x186**2 - m.x468 == 0) m.c459 = Constraint(expr= m.x85 - m.x468 == 0) m.c460 = Constraint(expr=m.x186**3 - m.x469 == 0) m.c461 = Constraint(expr= m.x397 - m.x469 == 0) m.c462 = Constraint(expr=m.x188**2 - m.x470 == 0) m.c463 = Constraint(expr= m.x87 - m.x470 == 0) m.c464 = Constraint(expr=m.x188**3 - m.x471 == 0) m.c465 = Constraint(expr= m.x402 - m.x471 == 0) m.c466 = Constraint(expr=m.x190**2 - m.x472 == 0) m.c467 = Constraint(expr= m.x90 - m.x472 == 0) m.c468 = Constraint(expr=m.x190**3 - m.x473 == 0) m.c469 = Constraint(expr= m.x407 - m.x473 == 0) m.c470 = Constraint(expr=m.x192**2 - m.x474 == 0) m.c471 = Constraint(expr= m.x94 - m.x474 == 0) m.c472 = Constraint(expr=m.x192**3 - m.x475 == 0) m.c473 = Constraint(expr= m.x412 - m.x475 == 0) m.c474 = Constraint(expr=m.x140*m.x263 - m.x145 == 0) m.c475 = Constraint(expr=m.x263*m.x422 - m.x281 == 0) m.c476 = Constraint(expr=m.x146*m.x263 - m.x169 == 0) m.c477 = Constraint(expr=m.x263*m.x428 - m.x296 == 0) m.c478 = Constraint(expr=m.x152*m.x263 - m.x185 == 0) m.c479 = Constraint(expr=m.x263*m.x434 - m.x311 == 0) m.c480 = Constraint(expr=m.x263**2 - m.x476 == 0) m.c481 = Constraint(expr= m.x147 - m.x476 == 0) m.c482 = Constraint(expr=m.x140*m.x476 - m.x280 == 0) m.c483 = Constraint(expr=m.x146*m.x476 - m.x295 == 0) m.c484 = Constraint(expr=m.x152*m.x476 - m.x310 == 0) m.c485 = Constraint(expr=m.x263**3 - m.x477 == 0) m.c486 = Constraint(expr=m.b2*m.x477 - m.x279 == 0) m.c487 = Constraint(expr=m.b5*m.x477 - m.x294 == 0) m.c488 = Constraint(expr=m.b8*m.x477 - m.x309 == 0) m.c489 = Constraint(expr=m.x142*m.x264 - m.x155 == 0) m.c490 = Constraint(expr=m.x264*m.x424 - m.x286 == 0) m.c491 = Constraint(expr=m.x148*m.x264 - m.x173 == 0) m.c492 = Constraint(expr=m.x264*m.x430 - m.x301 == 0) m.c493 = Constraint(expr=m.x154*m.x264 - m.x193 == 0) m.c494 = Constraint(expr=m.x264*m.x436 - m.x316 == 0) m.c495 = Constraint(expr=m.x264**2 - m.x478 == 0) m.c496 = Constraint(expr= m.x153 - m.x478 == 0) m.c497 = Constraint(expr=m.x142*m.x478 - m.x285 == 0) m.c498 = Constraint(expr=m.x148*m.x478 - m.x300 == 0) m.c499 = Constraint(expr=m.x154*m.x478 - m.x315 == 0) m.c500 = Constraint(expr=m.x264**3 - m.x479 == 0) m.c501 = Constraint(expr=m.b3*m.x479 - m.x284 == 0) m.c502 = Constraint(expr=m.b6*m.x479 - m.x299 == 0) m.c503 = Constraint(expr=m.b9*m.x479 - m.x314 == 0) m.c504 = Constraint(expr=m.x144*m.x265 - m.x163 == 0) m.c505 = Constraint(expr=m.x265*m.x426 - m.x291 == 0) m.c506 = Constraint(expr=m.x150*m.x265 - m.x179 == 0) m.c507 = Constraint(expr=m.x265*m.x432 - m.x306 == 0) m.c508 = Constraint(expr=m.x156*m.x265 - m.x31 == 0) m.c509 = Constraint(expr=m.x265*m.x438 - m.x321 == 0) m.c510 = Constraint(expr=m.x265**2 - m.x480 == 0) m.c511 = Constraint(expr= m.x161 - m.x480 == 0) m.c512 = Constraint(expr=m.x144*m.x480 - m.x290 == 0) m.c513 = Constraint(expr=m.x150*m.x480 - m.x305 == 0) m.c514 = Constraint(expr=m.x156*m.x480 - m.x320 == 0) m.c515 = Constraint(expr=m.x265**3 - m.x481 == 0) m.c516 = Constraint(expr=m.b4*m.x481 - m.x289 == 0) m.c517 = Constraint(expr=m.b7*m.x481 - m.x304 == 0) m.c518 = Constraint(expr=m.b10*m.x481 - m.x319 == 0) m.c519 = Constraint(expr=m.x158*m.x266 - m.x34 == 0) m.c520 = Constraint(expr=m.x266*m.x440 - m.x326 == 0) m.c521 = Constraint(expr=m.x164*m.x266 - m.x45 == 0) m.c522 = Constraint(expr=m.x266*m.x446 - m.x341 == 0) m.c523 = Constraint(expr=m.x266**2 - m.x482 == 0) m.c524 = Constraint(expr= m.x33 - m.x482 == 0) m.c525 = Constraint(expr=m.x158*m.x482 - m.x325 == 0) m.c526 = Constraint(expr=m.x164*m.x482 - m.x340 == 0) m.c527 = Constraint(expr=m.x266**3 - m.x483 == 0) m.c528 = Constraint(expr=m.b11*m.x483 - m.x324 == 0) m.c529 = Constraint(expr=m.b14*m.x483 - m.x339 == 0) m.c530 = Constraint(expr=m.x160*m.x267 - m.x39 == 0) m.c531 = Constraint(expr=m.x267*m.x442 - m.x331 == 0) m.c532 = Constraint(expr=m.x166*m.x267 - m.x49 == 0) m.c533 = Constraint(expr=m.x267*m.x448 - m.x343 == 0) m.c534 = Constraint(expr=m.x267**2 - m.x484 == 0) m.c535 = Constraint(expr= m.x38 - m.x484 == 0) m.c536 = Constraint(expr=m.x160*m.x484 - m.x330 == 0) m.c537 = Constraint(expr=m.x166*m.x484 - m.x347 == 0) m.c538 = Constraint(expr=m.x267**3 - m.x485 == 0) m.c539 = Constraint(expr=m.b12*m.x485 - m.x329 == 0) m.c540 = Constraint(expr=m.b15*m.x485 - m.x346 == 0) m.c541 = Constraint(expr=m.x162*m.x268 - m.x41 == 0) m.c542 = Constraint(expr=m.x268*m.x444 - m.x336 == 0) m.c543 = Constraint(expr=m.x168*m.x268 - m.x51 == 0) m.c544 = Constraint(expr=m.x268*m.x450 - m.x351 == 0) m.c545 = Constraint(expr=m.x268**2 - m.x486 == 0) m.c546 = Constraint(expr= m.x43 - m.x486 == 0) m.c547 = Constraint(expr=m.x162*m.x486 - m.x335 == 0) m.c548 = Constraint(expr=m.x168*m.x486 - m.x350 == 0) m.c549 = Constraint(expr=m.x268**3 - m.x487 == 0) m.c550 = Constraint(expr=m.b13*m.x487 - m.x334 == 0) m.c551 = Constraint(expr=m.b16*m.x487 - m.x349 == 0) m.c552 = Constraint(expr=m.x170*m.x269 - m.x54 == 0) m.c553 = Constraint(expr=m.x269*m.x452 - m.x356 == 0) m.c554 = Constraint(expr=m.x176*m.x269 - m.x66 == 0) m.c555 = Constraint(expr=m.x269*m.x458 - m.x371 == 0) m.c556 = Constraint(expr=m.x269**2 - m.x488 == 0) m.c557 = Constraint(expr= m.x55 - m.x488 == 0) m.c558 = Constraint(expr=m.x170*m.x488 - m.x355 == 0) m.c559 = Constraint(expr=m.x176*m.x488 - m.x370 == 0) m.c560 = Constraint(expr=m.x269**3 - m.x489 == 0) m.c561 = Constraint(expr=m.b17*m.x489 - m.x354 == 0) m.c562 = Constraint(expr=m.b20*m.x489 - m.x369 == 0) m.c563 = Constraint(expr=m.x172*m.x270 - m.x59 == 0) m.c564 = Constraint(expr=m.x270*m.x454 - m.x361 == 0) m.c565 = Constraint(expr=m.x178*m.x270 - m.x70 == 0) m.c566 = Constraint(expr=m.x270*m.x460 - m.x376 == 0) m.c567 = Constraint(expr=m.x270**2 - m.x490 == 0) m.c568 = Constraint(expr= m.x60 - m.x490 == 0) m.c569 = Constraint(expr=m.x172*m.x490 - m.x360 == 0) m.c570 = Constraint(expr=m.x178*m.x490 - m.x375 == 0) m.c571 = Constraint(expr=m.x270**3 - m.x491 == 0) m.c572 = Constraint(expr=m.b18*m.x491 - m.x359 == 0) m.c573 = Constraint(expr=m.b21*m.x491 - m.x374 == 0) m.c574 = Constraint(expr=m.x174*m.x271 - m.x63 == 0) m.c575 = Constraint(expr=m.x271*m.x456 - m.x366 == 0) m.c576 = Constraint(expr=m.x180*m.x271 - m.x72 == 0) m.c577 = Constraint(expr=m.x271*m.x462 - m.x381 == 0) m.c578 = Constraint(expr=m.x271**2 - m.x492 == 0) m.c579 = Constraint(expr= m.x62 - m.x492 == 0) m.c580 = Constraint(expr=m.x174*m.x492 - m.x365 == 0) m.c581 = Constraint(expr=m.x180*m.x492 - m.x380 == 0) m.c582 = Constraint(expr=m.x271**3 - m.x493 == 0) m.c583 = Constraint(expr=m.b19*m.x493 - m.x364 == 0) m.c584 = Constraint(expr=m.b22*m.x493 - m.x379 == 0) m.c585 = Constraint(expr=m.x182*m.x272 - m.x75 == 0) m.c586 = Constraint(expr=m.x272*m.x464 - m.x386 == 0) m.c587 = Constraint(expr=m.x188*m.x272 - m.x88 == 0) m.c588 = Constraint(expr=m.x272*m.x470 - m.x401 == 0) m.c589 = Constraint(expr=m.x272**2 - m.x494 == 0) m.c590 = Constraint(expr= m.x77 - m.x494 == 0) m.c591 = Constraint(expr=m.x182*m.x494 - m.x385 == 0) m.c592 = Constraint(expr=m.x188*m.x494 - m.x400 == 0) m.c593 = Constraint(expr=m.x272**3 - m.x495 == 0) m.c594 = Constraint(expr=m.b23*m.x495 - m.x384 == 0) m.c595 = Constraint(expr=m.b26*m.x495 - m.x399 == 0) m.c596 = Constraint(expr=m.x184*m.x273 - m.x79 == 0) m.c597 = Constraint(expr=m.x273*m.x466 - m.x391 == 0) m.c598 = Constraint(expr=m.x190*m.x273 - m.x91 == 0) m.c599 = Constraint(expr=m.x273*m.x472 - m.x406 == 0) m.c600 = Constraint(expr=m.x273**2 - m.x496 == 0) m.c601 = Constraint(expr= m.x80 - m.x496 == 0) m.c602 = Constraint(expr=m.x184*m.x496 - m.x390 == 0) m.c603 = Constraint(expr=m.x190*m.x496 - m.x405 == 0) m.c604 = Constraint(expr=m.x273**3 - m.x497 == 0) m.c605 = Constraint(expr=m.b24*m.x497 - m.x389 == 0) m.c606 = Constraint(expr=m.b27*m.x497 - m.x404 == 0) m.c607 = Constraint(expr=m.x186*m.x274 - m.x83 == 0) m.c608 = Constraint(expr=m.x274*m.x468 - m.x396 == 0) m.c609 = Constraint(expr=m.x192*m.x274 - m.x93 == 0) m.c610 = Constraint(expr=m.x274*m.x474 - m.x411 == 0) m.c611 = Constraint(expr=m.x274**2 - m.x498 == 0) m.c612 = Constraint(expr= m.x84 - m.x498 == 0) m.c613 = Constraint(expr=m.x186*m.x498 - m.x395 == 0) m.c614 = Constraint(expr=m.x192*m.x498 - m.x410 == 0) m.c615 = Constraint(expr=m.x274**3 - m.x499 == 0) m.c616 = Constraint(expr=m.b25*m.x499 - m.x394 == 0) m.c617 = Constraint(expr=m.b28*m.x499 - m.x409 == 0)
38.381299
117
0.65222
12,645
68,549
3.535706
0.101938
0.039545
0.147487
0.210696
0.619942
0.48715
0.463777
0.45823
0.427856
0.16292
0
0.235626
0.135086
68,549
1,785
118
38.402801
0.51846
0.00992
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.000873
0
0.000873
0
0
0
0
null
0
0
1
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
0bbb896c1f766d40e02d03530e5012bd42f6b56e
660
py
Python
app/schemas/treatment_type.py
DzhonPetrus/Treatment-Management
6b08c59d2d4e79181bbae4e951b7a5fd2e3162f1
[ "MIT" ]
null
null
null
app/schemas/treatment_type.py
DzhonPetrus/Treatment-Management
6b08c59d2d4e79181bbae4e951b7a5fd2e3162f1
[ "MIT" ]
null
null
null
app/schemas/treatment_type.py
DzhonPetrus/Treatment-Management
6b08c59d2d4e79181bbae4e951b7a5fd2e3162f1
[ "MIT" ]
null
null
null
from datetime import datetime as dt from typing import Optional, List from pydantic import BaseModel from ..utils.schemaHelper import Base, as_form class TreatmentTypeBase(Base): name: str room: str description: str fee: float is_active: Optional[str] = None @as_form class CreateTreatmentType(TreatmentTypeBase): pass class TreatmentType(TreatmentTypeBase): id: str created_at: Optional[dt] = None updated_at: Optional[dt] = None class OutTreatmentTypes(Base): data: List[TreatmentType] error: bool message: str class OutTreatmentType(Base): data: TreatmentType error: bool message: str
19.411765
46
0.721212
78
660
6.038462
0.487179
0.025478
0.046709
0.067941
0.135881
0
0
0
0
0
0
0
0.209091
660
34
47
19.411765
0.902299
0
0
0.16
0
0
0
0
0
0
0
0
0
1
0
true
0.04
0.16
0
0.92
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
0bc10ee1d8cb8fa794fa00533f0e4782089ee855
107
py
Python
app/search/urlmap.py
Hanaasagi/Ushio
007f8e50e68bf71a1822b09291b1236a1a37c515
[ "MIT" ]
5
2016-10-24T14:01:48.000Z
2017-09-26T07:33:20.000Z
app/search/urlmap.py
Hanaasagi/Ushio
007f8e50e68bf71a1822b09291b1236a1a37c515
[ "MIT" ]
null
null
null
app/search/urlmap.py
Hanaasagi/Ushio
007f8e50e68bf71a1822b09291b1236a1a37c515
[ "MIT" ]
null
null
null
# -*-coding:UTF-8-*- from handler import SearchHandler urlpattern = ( (r'/search', SearchHandler), )
13.375
33
0.654206
11
107
6.363636
0.909091
0
0
0
0
0
0
0
0
0
0
0.011236
0.168224
107
7
34
15.285714
0.775281
0.168224
0
0
0
0
0.08046
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
e7e78d1aba44146a11b4493e469f13a8468f2449
420
py
Python
nimble-newts/askgrieves/chatbot/models.py
Vthechamp22/summer-code-jam-2021
0a8bf1f22f6c73300891fd779da36efd8e1304c1
[ "MIT" ]
40
2020-08-02T07:38:22.000Z
2021-07-26T01:46:50.000Z
nimble-newts/askgrieves/chatbot/models.py
Vthechamp22/summer-code-jam-2021
0a8bf1f22f6c73300891fd779da36efd8e1304c1
[ "MIT" ]
134
2020-07-31T12:15:45.000Z
2020-12-13T04:42:19.000Z
nimble-newts/askgrieves/chatbot/models.py
AvianAnalyst/summer-code-jam-2020
c5e2aeb4ce399c438a1b8aad393d9c2e9ef98a75
[ "MIT" ]
101
2020-07-31T12:00:47.000Z
2021-11-01T09:06:58.000Z
from django.db import models class Chatbot(models.Model): name = models.CharField(max_length=500) def __str__(self): return f"name={self.name}" class WikiArticle(models.Model): name = models.CharField(max_length=500) summary = models.TextField(max_length=100) full_page = models.TextField(max_length=500) def __str__(self): return f"name={self.name} summary={self.summary}"
23.333333
57
0.7
57
420
4.929825
0.421053
0.128114
0.128114
0.149466
0.548043
0.548043
0.548043
0.548043
0.291815
0.291815
0
0.034783
0.178571
420
17
58
24.705882
0.77971
0
0
0.363636
0
0
0.130952
0.052381
0
0
0
0
0
1
0.181818
false
0
0.090909
0.181818
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
0
1
1
0
0
2
e7ed80b597ccfb79e5e0d84b01e14970f4384658
434
py
Python
day22/day22.py
norbert-e-horn/adventofcode-2017
81a6a8eb6f23f2191786d1ea8b2aad1f54d9c12a
[ "Apache-2.0" ]
null
null
null
day22/day22.py
norbert-e-horn/adventofcode-2017
81a6a8eb6f23f2191786d1ea8b2aad1f54d9c12a
[ "Apache-2.0" ]
null
null
null
day22/day22.py
norbert-e-horn/adventofcode-2017
81a6a8eb6f23f2191786d1ea8b2aad1f54d9c12a
[ "Apache-2.0" ]
null
null
null
import sys c=[[2if a=="#"else 0for a in i]for i in sys.argv[1].split("\n")] n=len(c) def m(x): d[0]=(d[0]+a[d[1]]+3)%4 a[d[1]]=(x+a[d[1]])%4 if a[d[1]]==2:d[2]+=1 d[1]+=(s+(1-s)*(d[0]&1))*(-1+2*(d[0]&1^(d[0]&2)>>1)) s=1001 a=[] k=(s-n)//2 for i in range(s):a+=[0]*k+c[i-k]+k*[0]if k<=i<(s+n)/2else[0]*s b=list(a) d=[0,s**2//2,0] for i in range(10000):m(2) print(d[2]) a=b d=[0,s**2//2,0] for i in range(10000000):m(1) print(d[2])
20.666667
64
0.495392
131
434
1.641221
0.259542
0.065116
0.111628
0.153488
0.15814
0.15814
0.15814
0.15814
0.15814
0.15814
0
0.154242
0.103687
434
20
65
21.7
0.398458
0
0
0.2
0
0
0.006912
0
0
0
0
0
0
1
0.05
false
0
0.05
0
0.1
0.1
0
0
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
e7f06cecae55d479e6604b53a295b76a9bdf0276
5,005
py
Python
backend/tests/unit/protocols/application/test_lists.py
pez-globo/pufferfish-software
b42fecd652731dd80fbe366e95983503fced37a4
[ "Apache-2.0" ]
1
2020-10-20T23:47:23.000Z
2020-10-20T23:47:23.000Z
backend/tests/unit/protocols/application/test_lists.py
pez-globo/pufferfish-software
b42fecd652731dd80fbe366e95983503fced37a4
[ "Apache-2.0" ]
242
2020-10-23T06:44:01.000Z
2022-01-28T05:50:45.000Z
backend/tests/unit/protocols/application/test_lists.py
pez-globo/pufferfish-vent-software
f1e5e47acf1941e7c729adb750b85bf26c38b274
[ "Apache-2.0" ]
1
2021-04-12T02:10:18.000Z
2021-04-12T02:10:18.000Z
"""Test the functionality of protocols.application.states classes.""" from ventserver.protocols.application import lists from ventserver.protocols.protobuf import mcu_pb as pb def test_send_new_elements() -> None: """Test adding new elements to a list for sending.""" example_sequence = [ lists.UpdateEvent(new_elements=[pb.LogEvent(id=i)]) for i in range(20) ] synchronizer = lists.SendSynchronizer( segment_type=pb.NextLogEvents, max_len=10, max_segment_len=5 ) assert synchronizer.output() is None for update_event in example_sequence: synchronizer.input(update_event) assert synchronizer.output() is None # The first 10 events should've been discarded for next_expected in range(10): synchronizer.input(lists.UpdateEvent(next_expected=next_expected)) output = synchronizer.output() assert isinstance(output, pb.NextLogEvents) assert output.next_expected == next_expected assert output.total == 10 assert output.remaining == 10 for (i, event) in enumerate(output.elements): assert event.id == 10 + i # Segments should be returned as requested for next_expected in range(10, 20): synchronizer.input(lists.UpdateEvent(next_expected=next_expected)) output = synchronizer.output() assert isinstance(output, pb.NextLogEvents) assert output.next_expected == next_expected assert output.total == 10 assert output.remaining == 10 - (next_expected - 10) for (i, event) in enumerate(output.elements): assert event.id == next_expected + i if next_expected <= 15: assert len(output.elements) == 5 else: assert len(output.elements) == 5 - (next_expected - 15) # New elements should be in the segment resulting from a repeated request assert synchronizer.output() is None synchronizer.input(lists.UpdateEvent( new_elements=[pb.LogEvent(id=20)], next_expected=19 )) output = synchronizer.output() assert isinstance(output, pb.NextLogEvents) assert output.next_expected == 19 assert output.total == 10 assert output.remaining == 2 for (i, event) in enumerate(output.elements): assert event.id == 19 + i assert len(output.elements) == 2 # TODO: add a test where we send all events, then reset expected event to 0. # All events should be sent again. def test_receive_new_elements() -> None: """Test adding new elements to a list from receiving.""" example_sequence = [ pb.NextLogEvents( session_id=0, elements=[pb.LogEvent(id=i) for i in range(0, 5)] ), pb.NextLogEvents( session_id=0, elements=[pb.LogEvent(id=i) for i in range(5, 10)] ), pb.NextLogEvents( session_id=0, elements=[pb.LogEvent(id=i) for i in range(7, 11)] ), pb.NextLogEvents( session_id=0, elements=[pb.LogEvent(id=i) for i in range(0, 4)] ), pb.NextLogEvents(session_id=1), pb.NextLogEvents( session_id=1, elements=[pb.LogEvent(id=i) for i in range(0, 4)] ), ] synchronizer: lists.ReceiveSynchronizer[pb.LogEvent] = \ lists.ReceiveSynchronizer() assert synchronizer.output() is None for segment in example_sequence: synchronizer.input(segment) update_event = synchronizer.output() assert update_event is not None assert update_event.session_id == 0 assert update_event.next_expected == 5 assert len(update_event.new_elements) == 5 for (i, element) in enumerate(update_event.new_elements): assert element.id == i update_event = synchronizer.output() assert update_event is not None assert update_event.session_id == 0 assert update_event.next_expected == 10 assert len(update_event.new_elements) == 5 for (i, element) in enumerate(update_event.new_elements): assert element.id == 5 + i update_event = synchronizer.output() assert update_event is not None assert update_event.session_id == 0 assert update_event.next_expected == 11 assert len(update_event.new_elements) == 1 assert update_event.new_elements[0].id == 10 update_event = synchronizer.output() assert update_event is not None assert update_event.session_id == 0 assert update_event.next_expected == 11 assert len(update_event.new_elements) == 0 update_event = synchronizer.output() assert update_event is not None assert update_event.session_id == 1 assert update_event.next_expected == 0 assert len(update_event.new_elements) == 0 update_event = synchronizer.output() assert update_event is not None assert update_event.session_id == 1 assert update_event.next_expected == 4 assert len(update_event.new_elements) == 4 for (i, element) in enumerate(update_event.new_elements): assert element.id == i
36.532847
77
0.675524
653
5,005
5.029096
0.145482
0.120585
0.098356
0.066991
0.762485
0.686663
0.642509
0.612667
0.612667
0.602923
0
0.022627
0.231768
5,005
136
78
36.801471
0.831469
0.085714
0
0.554545
0
0
0
0
0
0
0
0.007353
0.454545
1
0.018182
false
0
0.018182
0
0.036364
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
0
0
0
0
null
0
0
0
1
0
0
0
0
0
0
0
0
0
2
e7f7aa1ed993e5ba94893e2ddce56e42c0e3c43a
586
py
Python
java/test/src/main/resources/test_cross_language_invocation.py
hershg/ray
a1744f67fe954d8408c5b84e28ecccc130157f8e
[ "Apache-2.0" ]
2
2017-12-15T19:36:55.000Z
2019-02-24T16:56:06.000Z
java/test/src/main/resources/test_cross_language_invocation.py
hershg/ray
a1744f67fe954d8408c5b84e28ecccc130157f8e
[ "Apache-2.0" ]
4
2019-03-04T13:03:24.000Z
2019-06-06T11:25:07.000Z
java/test/src/main/resources/test_cross_language_invocation.py
hershg/ray
a1744f67fe954d8408c5b84e28ecccc130157f8e
[ "Apache-2.0" ]
2
2017-10-31T23:20:07.000Z
2019-11-13T20:16:03.000Z
# This file is used by CrossLanguageInvocationTest.java to test cross-language # invocation. from __future__ import absolute_import from __future__ import division from __future__ import print_function import six import ray @ray.remote def py_func(value): assert isinstance(value, bytes) return b"Response from Python: " + value @ray.remote class Counter(object): def __init__(self, value): self.value = int(value) def increase(self, delta): self.value += int(delta) return str(self.value).encode("utf-8") if six.PY3 else str(self.value)
21.703704
78
0.723549
81
586
5
0.592593
0.111111
0.118519
0
0
0
0
0
0
0
0
0.004202
0.187713
586
26
79
22.538462
0.846639
0.150171
0
0.125
0
0
0.054545
0
0
0
0
0
0.0625
1
0.1875
false
0
0.3125
0
0.6875
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
f009b3d518e1b8520f28ad27fc966139292e346f
15,818
py
Python
robotpy_build/hooks_datacfg.py
ConnectionMaster/robotpy-build
9571a84fdd6268be5e945b31ea8929d84355071a
[ "BSD-3-Clause" ]
null
null
null
robotpy_build/hooks_datacfg.py
ConnectionMaster/robotpy-build
9571a84fdd6268be5e945b31ea8929d84355071a
[ "BSD-3-Clause" ]
null
null
null
robotpy_build/hooks_datacfg.py
ConnectionMaster/robotpy-build
9571a84fdd6268be5e945b31ea8929d84355071a
[ "BSD-3-Clause" ]
null
null
null
# # Defines data that is consumed by the header2whatever hooks/templates # to modify the generated files # import enum from typing import Dict, List, Tuple, Optional from pydantic import validator from .util import Model, _generating_documentation class ParamData(Model): """Various ways to modify parameters""" #: Set parameter name to this name: Optional[str] = None #: Change C++ type emitted x_type: Optional[str] = None #: Default value for parameter default: Optional[str] = None #: Disables a default cast caused by ``default_arg_cast`` disable_type_caster_default_cast: bool = False #: Force this to be an 'out' parameter #: #: .. seealso:: :ref:`autowrap_out_params` #: force_out: bool = False #: Force an array size array_size: Optional[int] = None #: Ignore this parameter ignore: bool = False class BufferType(str, enum.Enum): #: The buffer must indicate that it is readable (such as bytes, or bytearray) IN = "in" #: The buffer must indicate that it is writeable (such as a bytearray) OUT = "out" #: The buffer must indicate that it readable or writeable (such as a bytearray) INOUT = "inout" class BufferData(Model): #: Indicates what type of python buffer is required type: BufferType #: Name of C++ parameter that the buffer will use src: str #: Name of the C++ length parameter. An out-only parameter, it will be set #: to the size of the python buffer, and will be returned so the caller can #: determine how many bytes were written len: str #: If specified, the minimum size of the python buffer minsz: Optional[int] = None class ReturnValuePolicy(enum.Enum): """ See `pybind11 documentation <https://pybind11.readthedocs.io/en/stable/advanced/functions.html#return-value-policies>`_ for what each of these values mean. """ TAKE_OWNERSHIP = "take_ownership" COPY = "copy" MOVE = "move" REFERENCE = "reference" REFERENCE_INTERNAL = "reference_internal" AUTOMATIC = "automatic" AUTOMATIC_REFERENCE = "automatic_reference" class FunctionData(Model): """ Customize the way the autogenerator binds a function. .. code-block:: yaml functions: # for non-overloaded functions, just specify the name + customizations name_of_non_overloaded_fn: # add customizations for function here # For overloaded functions, specify the name, but each overload # separately my_overloaded_fn: overloads: int, int: # customizations for `my_overloaded_fn(int, int)` int, int, int: # customizations for `my_overloaded_fn(int, int, int)` """ #: If True, don't wrap this ignore: bool = False #: If True, don't wrap this, but provide a pure virtual implementation ignore_pure: bool = False #: Generate this in an `#ifdef` ifdef: Optional[str] = None #: Generate this in an `#ifndef` ifndef: Optional[str] = None #: Use this code instead of the generated code cpp_code: Optional[str] = None #: Docstring for the function, will attempt to convert Doxygen docs if omitted doc: Optional[str] = None #: Text to append to the (autoconverted) docstring for the function doc_append: Optional[str] = None #: If True, prepends an underscore to the python name internal: bool = False #: Use this to set the name of the function as exposed to python rename: Optional[str] = None #: Mechanism to override individual parameters param_override: Dict[str, ParamData] = {} #: If specified, put the function in a sub.pack.age subpackage: Optional[str] = None #: By default, robotpy-build will release the GIL whenever a wrapped #: function is called. no_release_gil: Optional[bool] = None buffers: List[BufferData] = [] overloads: Dict[str, "FunctionData"] = {} #: Adds py::keep_alive<x,y> to the function. Overrides automatic #: keepalive support, which retains references passed to constructors. #: https://pybind11.readthedocs.io/en/stable/advanced/functions.html#keep-alive keepalive: Optional[List[Tuple[int, int]]] = None #: https://pybind11.readthedocs.io/en/stable/advanced/functions.html#return-value-policies return_value_policy: ReturnValuePolicy = ReturnValuePolicy.AUTOMATIC #: If this is a function template, this is a list of instantiations #: that you wish to provide. This is a list of lists, where the inner #: list is the template parameters for that function template_impls: Optional[List[List[str]]] = None #: Specify a transformation lambda to be used when this virtual function #: is called from C++. This inline code should be a lambda that has the same #: arguments as the original C++ virtual function, except the first argument #: will be a py::function with the python overload #: #: cpp_code should also be specified for this to be useful #: #: For example, to transform a function that takes an iostream into a function #: that returns a string: #: #: .. code-block:: yaml #: #: cpp_code: | #: [](MyClass* self) { #: return "string"; #: } #: virtual_xform: | #: [](py::function fn, MyClass* self, std::iostream &is) { #: std::string d = py::cast(fn()); #: is << d; #: } #: virtual_xform: Optional[str] = None @validator("overloads", pre=True) def validate_overloads(cls, value): for k, v in value.items(): if v is None: value[k] = FunctionData() return value if not _generating_documentation: FunctionData.update_forward_refs() class PropAccess(enum.Enum): #: Determine read/read-write automatically: #: #: * If a struct/union, default to readwrite #: * If a class, default to readwrite if a basic type that isn't a #: reference, otherwise default to readonly AUTOMATIC = "auto" #: Allow python users access to the value, but ensure it can't #: change. This is useful for properties that are defined directly #: in the class READONLY = "readonly" #: Allows python users to read/write the value READWRITE = "readwrite" class PropData(Model): #: If set to True, this property is not made available to python ignore: bool = False #: Set the python name of this property to the specified string rename: Optional[str] #: Python code access to this property access: PropAccess = PropAccess.AUTOMATIC #: Docstring for the property (only available on class properties) doc: Optional[str] = None #: Text to append to the (autoconverted) docstring doc_append: Optional[str] = None class EnumValue(Model): #: If set to True, this property is not made available to python ignore: bool = False #: Set the python name of this enum value to the specified string rename: Optional[str] = None #: Docstring for the enum value doc: Optional[str] = None #: Text to append to the (autoconverted) docstring doc_append: Optional[str] = None class EnumData(Model): #: Set your own docstring for the enum doc: Optional[str] = None #: Text to append to the (autoconverted) docstring doc_append: Optional[str] = None #: If set to True, this property is not made available to python ignore: bool = False #: Set the python name of this enum to the specified string rename: Optional[str] = None value_prefix: Optional[str] = None #: If specified, put the enum in a sub.pack.age (ignored for #: enums that are part of classes) subpackage: Optional[str] = None values: Dict[str, EnumValue] = {} class ClassData(Model): #: Docstring for the class doc: Optional[str] = None #: Text to append to the (autoconverted) docstring doc_append: Optional[str] = None ignore: bool = False ignored_bases: List[str] = [] #: Specify fully qualified names for the bases base_qualnames: Dict[str, str] = {} attributes: Dict[str, PropData] = {} enums: Dict[str, EnumData] = {} methods: Dict[str, FunctionData] = {} is_polymorphic: bool = False force_no_trampoline: bool = False force_no_default_constructor: bool = False #: pybind11 will detect multiple inheritance automatically if a #: class directly derives from multiple classes. However, #: If the class derives from classes that participate in multiple #: inheritance, pybind11 won't detect it automatically, so this #: flag is needed. force_multiple_inheritance: bool = False #: If there are circular dependencies, this will help you resolve them #: manually. TODO: make it so we don't need this force_depends: List[str] = [] #: Use this to bring in type casters for a particular type that may have #: been hidden (for example, with a typedef or definition in another file), #: instead of explicitly including the header. This should be the full #: namespace of the type. force_type_casters: List[str] = [] #: If the object shouldn't be deleted by pybind11, use this. Disables #: implicit constructors. nodelete: bool = False #: Set the python name of the class to this rename: Optional[str] = None #: This is deprecated and has no effect shared_ptr: bool = True #: If specified, put the class in a sub.pack.age. Ignored #: for functions attached to a class. When template parameters #: are used, must define subpackage on template instances #: instead subpackage: Optional[str] = None #: Extra 'using' directives to insert into the trampoline and the #: wrapping scope typealias: List[str] = [] #: Extra constexpr to insert into the trampoline and wrapping scopes constants: List[str] = [] #: If this is a template class, a list of the parameters if it can't #: be autodetected (currently can't autodetect). If there is no space #: in the parameter, then it is assumed to be a 'typename', otherwise #: the parameter is split by space and the first item is the type and #: the second parameter is the name (useful for integral templates) template_params: Optional[List[str]] = None #: If this is a template class, the specified C++ code is inserted #: into the template definition template_inline_code: str = "" #: If this class has an associated trampoline, add this code inline at #: the bottom of the trampoline class. This is rarely useful. trampoline_inline_code: Optional[str] = None @validator("attributes", pre=True) def validate_attributes(cls, value): for k, v in value.items(): if v is None: value[k] = PropData() return value @validator("enums", pre=True) def validate_enums(cls, value): for k, v in value.items(): if v is None: value[k] = EnumData() return value @validator("methods", pre=True) def validate_methods(cls, value): for k, v in value.items(): if v is None: value[k] = FunctionData() return value class TemplateData(Model): """ Instantiates a template as a python type. To customize the class, add it to the ``classes`` key and specify the template type. Code to be wrapped: .. code-block:: c++ template <typename T> class MyClass {}; To bind ``MyClass<int>`` as the python class ``MyIntClass``, add this to your YAML: .. code-block:: yaml classes: MyClass: template_params: - T templates: MyIntClass: qualname: MyClass params: - int """ #: Fully qualified name of instantiated class qualname: str #: Template parameters to use params: List[str] #: If specified, put the template instantiation in a sub.pack.age subpackage: Optional[str] = None #: Set the docstring for the template instance doc: Optional[str] = None #: Text to append to the (autoconverted) docstring for the template instance doc_append: Optional[str] = None class HooksDataYaml(Model): """ Format of the file in [tool.robotpy-build.wrappers."PACKAGENAME"] generation_data """ strip_prefixes: List[str] = [] #: Adds ``#include <FILENAME>`` directives to the top of the autogenerated #: C++ file, after autodetected include dependencies are inserted. extra_includes: List[str] = [] #: Adds ``#include <FILENAME>`` directives after robotpy_build.h is #: included, but before any autodetected include dependencies. Only use #: this when dealing with broken headers. extra_includes_first: List[str] = [] #: Specify raw C++ code that will be inserted at the end of the #: autogenerated file, inside a function. This is useful for extending #: your classes or providing other customizations. The following C++ #: variables are available: #: #: * ``m`` is the ``py::module`` instance #: * ``cls_CLASSNAME`` are ``py::class`` instances #: * ... lots of other things too #: #: The trampoline class (useful for accessing protected items) is available #: at ``{CLASSNAME}_Trampoline`` #: #: To see the full list, run a build and look at the generated code at #: ``build/*/gensrc/**/*.cpp`` #: #: Recommend that you use the YAML multiline syntax to specify it: #: #: .. code-block:: yaml #: #: inline_code: | #: cls_CLASSNAME.def("get42", []() { return 42; }); inline_code: Optional[str] = None #: Key is the attribute (variable) name #: #: .. code-block:: yaml #: #: attributes: #: my_variable: #: # customizations here, see PropData #: attributes: Dict[str, PropData] = {} #: Key is the class name #: #: .. code-block:: yaml #: #: classes: #: CLASSNAME: #: # customizations here, see ClassData #: classes: Dict[str, ClassData] = {} #: Key is the function name #: #: .. code-block:: yaml #: #: functions: #: fn_name: #: # customizations here, see FunctionData #: functions: Dict[str, FunctionData] = {} #: Key is the enum name, for enums at global scope #: #: .. code-block:: yaml #: #: enums: #: MyEnum: #: # customizations here, see EnumData #: enums: Dict[str, EnumData] = {} #: Instantiates a template. Key is the name to give to the Python type. #: #: .. code-block:: yaml #: #: templates: #: ClassName: #: # customizations here, see TemplateData #: templates: Dict[str, TemplateData] = {} @validator("attributes", pre=True) def validate_attributes(cls, value): for k, v in value.items(): if v is None: value[k] = PropData() return value @validator("classes", pre=True) def validate_classes(cls, value): for k, v in value.items(): if v is None: value[k] = ClassData() return value @validator("enums", pre=True) def validate_enums(cls, value): for k, v in value.items(): if v is None: value[k] = EnumData() return value @validator("functions", pre=True) def validate_functions(cls, value): for k, v in value.items(): if v is None: value[k] = FunctionData() return value
29.845283
123
0.637249
2,012
15,818
4.962724
0.219185
0.022434
0.045068
0.014422
0.262394
0.241362
0.203105
0.186279
0.178067
0.164947
0
0.001639
0.267101
15,818
529
124
29.901701
0.859657
0.566886
0
0.428571
1
0
0.028204
0
0
0
0
0.00189
0
1
0.049689
false
0
0.024845
0
0.78882
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
f012b80503a597191471f367c16412e1f714452d
2,396
py
Python
new_corpus/_sympy.py
y-akinobu/multiese
e28e6424b9714c5f145f438c8502c4194b70fe25
[ "MIT" ]
null
null
null
new_corpus/_sympy.py
y-akinobu/multiese
e28e6424b9714c5f145f438c8502c4194b70fe25
[ "MIT" ]
null
null
null
new_corpus/_sympy.py
y-akinobu/multiese
e28e6424b9714c5f145f438c8502c4194b70fe25
[ "MIT" ]
null
null
null
import sympy ''' @test($$;type(sympy)) @alt(シンボル|記号|変数) @alt(数式として、|) [代数計算|シンボル計算|数式処理][|ライブラリ]を使う ''' s = 'z' sympy.symbol(s) ''' @test(sympy=missing;$$) 数式として、sをシンボルに変換する ''' z = sympy.symbol(s) ''' @test(sympy=missing;$$;z) @prefix(z;[変数|式]) 数式として、sを[シンボル|変数][に|化]して、zにする ''' e = e2 = sympy.symbol(s) n = 2 e.subs(z, n) ''' @test(e=missing;e2='e2';z='x';$$) @prefix(e;式) 数式として、eのzにnを代入する ''' e.subs(z, e2) ''' @test(e=missing;e2='e2';z='x';$$) 数式として、eのzにe2を代入する 数式として、eのzをe2で置き換える ''' sympy.expand(e) ''' @test(sympy=missing;e='e';$$) 数式として、eを展開する 数式として、eの展開を行う ''' sympy.factor(e) ''' @test(sympy=missing;e='e';$$) 数式として、eを因数分解する 数式として、eの因数分解を行う ''' sympy.sympify(e) ''' @test(sympy=missing;e='e';$$) 数式として、eを簡単[に|化]する 数式として、eを簡略[に|化]する 数式として、eの簡[略|単]化を行う ''' sympy.apart(e) ''' @test(sympy=missing;e='e';$$) 数式として、eを部分分数[に|として]展開する 数式として、eの部分分数化を行う ''' sympy.solve(e) ''' @test(sympy=missing;e='e';$$) 数式として、方程e[=0|][を解く|の解を求める] ''' sympy.solve(e, z) ''' @test(sympy=missing;e='e';z='x';$$) 数式として、方程e[=0|]のzの解を求める ''' sympy.solve([e, e2]) ''' @test(sympy=missing;e='e';e2='e2';$$) 数式として、連立方程e[=0|], e2[|=0]の解を求める ''' sympy.limit(e, z, 0) ''' @test(sympy=missing;e='e';z='x';$$) @alt(とき|時|場合|際) zが0に近づくとき[の|、]eの極限値を求める ''' sympy.limit(e, z, oo) ''' @test(sympy=missing;e='e';z='x';oo='oo';$$) zが無限大に近づくとき[の|、]eの極限値を求める ''' sympy.limit(e, z, -oo) ''' @test(sympy=missing;e='e';z='x';oo=0;$$) zがマイナス無限大に近づくとき[の|、]eの極限値を求める ''' sympy.diff(e) ''' @test(sympy=missing;e='e';z='x';$$) 数式として、eを微分する 数式として、eの微分を求める ''' sympy.diff(e, z) ''' @test(sympy=missing;e='e';z='x';$$) 数式として、zについてeの微分を[行う|求める] 数式として、eのzを微分する ''' sympy.diff(e, z, n) ''' @test(sympy=missing;e='e';z='x';$$) 数式として、{eを|zについて}n階微分する 数式として、eの[zについての|]n階微分を[求める|行う] ''' sympy.integrate(e) ''' @test(sympy=missing;e='e';z='x';$$) 数式として、eを積分する 数式として、eの[積分|インテグラル]を[求める|行う] ''' sympy.integrate(e, z) ''' @test(sympy=missing;e='e';z='x';$$) 数式として、zについてeを積分する 数式として、zについてeの[積分|インテグラル]を[求める|行う] ''' float(e) ''' @test(sympy=missing;e='3.14159';z='x';$$) 数式として、eの数値[を求める|] 数式として、eを数値計算する 数式として、eを[数値|浮動小数点数]に変換する ''' __X__ = e sympy.sqrt(__X__) ''' @test(sympy=missing;e='e';z='x';$$) @X(e;z) @Y(e;z) 数式として、__Y__の平方根を求める ''' # sympy.E**(sympy.I * sympy.pi) == -1 # ''' # 数式として、オイラーの等式を使う # ''' # sympy.summation(e, (z, 1, N)) # ''' # @test(import sympy;z,N=sympy.Symbol('z N');e=z**2;$$) # 数式として、eの総和[|を求める] # '''
14.261905
55
0.604758
408
2,396
3.522059
0.269608
0.029228
0.211552
0.201113
0.418232
0.350731
0.350731
0.173974
0.156576
0.12039
0
0.013284
0.088898
2,396
167
56
14.347305
0.644984
0.070952
0
0
0
0
0.00207
0
0
0
0
0
0
1
0
false
0
0.038462
0
0.038462
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
f02ceba7181acc45bf9bae1d138dd71123a318a6
422
py
Python
my_wallet/apiv1/permissions.py
ibolorino/wallet_backend
20c80e419eaef6b0577ca45ff35bf4eb9501e3a3
[ "MIT" ]
null
null
null
my_wallet/apiv1/permissions.py
ibolorino/wallet_backend
20c80e419eaef6b0577ca45ff35bf4eb9501e3a3
[ "MIT" ]
null
null
null
my_wallet/apiv1/permissions.py
ibolorino/wallet_backend
20c80e419eaef6b0577ca45ff35bf4eb9501e3a3
[ "MIT" ]
null
null
null
from rest_framework import permissions class IsAadminOrReadOnly(permissions.BasePermission): """ The request is authenticated as a admin, or is a read-only request. """ def has_permission(self, request, view): return bool( (request.user and request.user.is_authenticated and request.method in permissions.SAFE_METHODS) or (request.user and request.user.is_staff) )
35.166667
110
0.699052
52
422
5.576923
0.615385
0.151724
0.096552
0.144828
0.186207
0.186207
0
0
0
0
0
0
0.225118
422
12
111
35.166667
0.88685
0.158768
0
0
0
0
0
0
0
0
0
0
0
1
0.142857
false
0
0.142857
0.142857
0.571429
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
1
1
0
0
2
f03ac5d7659f10dfb37b2809abf402ff19dbec0f
338
py
Python
Algorithms/Problems/MaximumSubarray/tests/maximum_substring_naive_test.py
Nalhin/AlgorithmsAndDataStructures
2d2c87d0572e107c993c3c8866b8beefd4d22082
[ "MIT" ]
1
2021-11-16T13:02:25.000Z
2021-11-16T13:02:25.000Z
Algorithms/Problems/MaximumSubarray/tests/maximum_substring_naive_test.py
Nalhin/AlgorithmsAndDataStructures
2d2c87d0572e107c993c3c8866b8beefd4d22082
[ "MIT" ]
null
null
null
Algorithms/Problems/MaximumSubarray/tests/maximum_substring_naive_test.py
Nalhin/AlgorithmsAndDataStructures
2d2c87d0572e107c993c3c8866b8beefd4d22082
[ "MIT" ]
null
null
null
from Algorithms.Problems.MaximumSubarray.maximum_substring_naive import ( maximum_subarray_naive, ) class TestMaximumSubarrayNaive: def test_returns_maximum_subarray(self): data = [1, -2, 3, 10, -5, 14] expected = [3, 10, -5, 14] result = maximum_subarray_naive(data) assert result == expected
24.142857
73
0.683432
39
338
5.692308
0.641026
0.202703
0.18018
0.054054
0
0
0
0
0
0
0
0.053232
0.221893
338
13
74
26
0.790875
0
0
0
0
0
0
0
0
0
0
0
0.111111
1
0.111111
false
0
0.111111
0
0.333333
0
0
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
f0476c6057fe6e189aeed8a5c7b88b67234d582d
78
py
Python
svae/__init__.py
APodolskiy/SentenceVAE
afe82504922de700810b24638f7df0dbf1d8fa11
[ "MIT" ]
null
null
null
svae/__init__.py
APodolskiy/SentenceVAE
afe82504922de700810b24638f7df0dbf1d8fa11
[ "MIT" ]
null
null
null
svae/__init__.py
APodolskiy/SentenceVAE
afe82504922de700810b24638f7df0dbf1d8fa11
[ "MIT" ]
null
null
null
import torch.nn as nn RNN_TYPES = { 'lstm': nn.LSTM, 'gru': nn.GRU }
11.142857
21
0.564103
13
78
3.307692
0.615385
0
0
0
0
0
0
0
0
0
0
0
0.269231
78
6
22
13
0.754386
0
0
0
0
0
0.089744
0
0
0
0
0
0
1
0
false
0
0.2
0
0.2
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
f04b25d10196843175ed158d8658c6dd85f4722b
2,009
py
Python
src/autodoc/python/rst/base/block_quote.py
LudditeLabs/autodoc-tool
b4ae7e3b61907e7e9c3a1b534fce055e5860ffab
[ "Apache-2.0" ]
null
null
null
src/autodoc/python/rst/base/block_quote.py
LudditeLabs/autodoc-tool
b4ae7e3b61907e7e9c3a1b534fce055e5860ffab
[ "Apache-2.0" ]
null
null
null
src/autodoc/python/rst/base/block_quote.py
LudditeLabs/autodoc-tool
b4ae7e3b61907e7e9c3a1b534fce055e5860ffab
[ "Apache-2.0" ]
null
null
null
# Copyright 2018 Luddite Labs Inc. # # 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. """ Block Quotes ------------ Line blocks are groups of lines beginning with vertical bar ("|") prefixes. Each vertical bar prefix indicates a new line, so line breaks are preserved. Initial indents are also significant, resulting in a nested structure. Inline markup is supported. Continuation lines are wrapped portions of long lines; they begin with a space in place of the vertical bar. The left edge of a continuation line must be indented, but need not be aligned with the left edge of the text above it. A line block ends with a blank line. Syntax diagram: +------------------------------+ | (current level of | | indentation) | +------------------------------+ +---------------------------+ | block quote | | (body elements)+ | | | | -- attribution text | | (optional) | +---------------------------+ http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#block-quotes """ class BlockQuoteMixin: def visit_block_quote(self, node): self.open_block(indent=self.options['indent'], top_margin=1, bottom_margin=1) def depart_block_quote(self, node): self.close_block() def visit_attribution(self, node): self.block.add_text(u'-- ') def depart_attribution(self, node): pass
34.637931
79
0.621702
252
2,009
4.912698
0.59127
0.048465
0.029079
0.025848
0.035541
0
0
0
0
0
0
0.006579
0.243405
2,009
57
80
35.245614
0.807895
0.797412
0
0
0
0
0.023256
0
0
0
0
0
0
1
0.4
false
0.1
0
0
0.5
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
0
0
0
2
f04e299a6b487778e8fe610c813dd85847139172
529
py
Python
tests/frontend/detector/test_fast.py
swershrimpy/gtsfm
8d301eb3ef9172345a1ac1369fd4e19764d28946
[ "Apache-2.0" ]
122
2021-02-07T23:01:58.000Z
2022-03-30T13:10:35.000Z
tests/frontend/detector/test_fast.py
swershrimpy/gtsfm
8d301eb3ef9172345a1ac1369fd4e19764d28946
[ "Apache-2.0" ]
273
2021-01-30T16:45:26.000Z
2022-03-16T15:02:33.000Z
tests/frontend/detector/test_fast.py
swershrimpy/gtsfm
8d301eb3ef9172345a1ac1369fd4e19764d28946
[ "Apache-2.0" ]
13
2021-03-12T03:01:27.000Z
2022-03-11T03:16:54.000Z
"""Tests for frontend's FAST detector class. Authors: Ayush Baid """ import unittest import tests.frontend.detector.test_detector_base as test_detector_base from gtsfm.frontend.detector.fast import Fast class TestFast(test_detector_base.TestDetectorBase): """Test class for FAST detector class in frontend. All unit test functions defined in TestDetectorBase are run automatically. """ def setUp(self): super().setUp() self.detector = Fast() if __name__ == "__main__": unittest.main()
22.041667
78
0.729679
67
529
5.552239
0.507463
0.096774
0.129032
0
0
0
0
0
0
0
0
0
0.181474
529
23
79
23
0.859122
0.351607
0
0
0
0
0.024845
0
0
0
0
0
0
1
0.111111
false
0
0.333333
0
0.555556
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
f05afdbd5aec954079117e24e6a1f75f80dba71c
1,523
py
Python
Consumer_test.py
image-store-org/image-store-py-web-api-consumer-test
59d805e8a7b459a97ede7285f6e4a67e87cfba02
[ "MIT" ]
null
null
null
Consumer_test.py
image-store-org/image-store-py-web-api-consumer-test
59d805e8a7b459a97ede7285f6e4a67e87cfba02
[ "MIT" ]
null
null
null
Consumer_test.py
image-store-org/image-store-py-web-api-consumer-test
59d805e8a7b459a97ede7285f6e4a67e87cfba02
[ "MIT" ]
null
null
null
import sys sys.path.append('dependencies/image-store-py-web-api-consumer') from Consumer import Consumer class Consumer_test: def __init__(self): self.c = Consumer() def get(self): print('\x1b[6;30;42m' + 'GET' + '\x1b[0m') print(self.c.get()) print('{}\n'.format(self.c.get().json())) # get a data entry by id def get_id(self, id): print('\x1b[6;30;42m' + 'GET ID({})'.format(id) + '\x1b[0m') print(self.c.get_id(id)) print('{}\n'.format(self.c.get_id(id).json())) # get latest data entry def get_latest(self): print('\x1b[6;30;42m' + 'GET LATEST' + '\x1b[0m') print(self.c.get_latest()) print('{}\n'.format(self.c.get_latest().json())) # post a data entry, id incremented by internal mySQL counter def post(self): print('\x1b[6;30;42m' + 'POST' + '\x1b[0m') print(self.c.post()) print('{}\n'.format(self.c.post().json())) # TODO be able to edit payload with keywords e.g: title.TEST # edit existing data entry by id def put(self, id): print('\x1b[6;30;42m' + 'PUT({})'.format(id) + '\x1b[0m') print(self.c.put(id)) # delete data entry by id def delete(self, id): print('\x1b[6;30;42m' + 'DELETE({})'.format(id) + '\x1b[0m') print(self.c.delete(id)) if __name__ == '__main__': consumer = Consumer_test() consumer.get() consumer.get_id(1) consumer.post() consumer.get_latest() consumer.put(10)
30.46
69
0.570584
227
1,523
3.731278
0.255507
0.064935
0.063754
0.077922
0.447462
0.343566
0.201889
0
0
0
0
0.043814
0.235719
1,523
50
70
30.46
0.683849
0.143139
0
0
0
0
0.178599
0.033872
0
0
0
0.02
0
1
0.2
false
0
0.057143
0
0.285714
0.457143
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
1
0
0
0
0
0
0
0
0
1
0
2
f05bdaed59cf5073cab62db01710a16ba5ff7771
7,597
py
Python
app/views.py
PaulMurrayCbr/GameNight
838c19dda765027abbe8e12e331268b01cb859c2
[ "Unlicense" ]
null
null
null
app/views.py
PaulMurrayCbr/GameNight
838c19dda765027abbe8e12e331268b01cb859c2
[ "Unlicense" ]
null
null
null
app/views.py
PaulMurrayCbr/GameNight
838c19dda765027abbe8e12e331268b01cb859c2
[ "Unlicense" ]
null
null
null
from app import app, db from flask import render_template, flash, redirect, get_flashed_messages import forms import models import Character from flask.globals import request from sqlalchemy.orm.exc import NoResultFound, MultipleResultsFound def menugear() : return { 'pcs': models.Character.query.all() } @app.route('/') @app.route('/index') def index(): return render_template('index.html', menu=menugear()) @app.route('/whiteboard') def whiteboard(): return render_template('whiteboard.html', menu=menugear()) @app.route('/pc/<name>/') def character(name): try: pc = models.Character.query.filter_by(name=name).one() updatepc_form=forms.PC(obj=pc) newhp_form=forms.HP() openhpbreakdown = False states = get_flashed_messages(category_filter=['viewstate']) if states: for state in states: if state['hpopen']: openhpbreakdown = True return render_template('pc.html', updatepc_form=updatepc_form, newhp_form = newhp_form, pc=pc, pcinfo=Character.buildInfo(pc), menu=menugear(), openhpbreakdown = openhpbreakdown) except MultipleResultsFound, e: flash(('Found multiple characters named %s' % name, 'danger'), 'msg') pc = None except NoResultFound, e: flash(('PC %s not found' % name, 'warning'), 'msg') pc = None return redirect('/') @app.route('/pc/<name>/update.do', methods=['POST']) def do_updatepc(name): try: pc = models.Character.query.filter_by(name=name).one() updatepc_form=forms.PC(obj=pc) pc.abbrev = updatepc_form.abbrev.data pc.name = updatepc_form.name.data pc.pname = updatepc_form.pname.data db.session.commit() return redirect('/pc/%s' % pc.name) except MultipleResultsFound, e: flash(('Found multiple characters named %s' % name, 'danger'), 'msg') pc = None except NoResultFound, e: flash(('PC %s not found' % name, 'warning'), 'msg') pc = None return redirect('/') @app.route('/pc/<name>/addhptype.do', methods=['POST']) def do_addhptypepc(name): try: pc = models.Character.query.filter_by(name=name).one() newhp_form=forms.HP(obj=pc) hp = models.Hp( character_id = pc.id, source = newhp_form.source.data, max = newhp_form.max.data, current = newhp_form.max.data, ablative_only = newhp_form.ablative_only.data ) db.session.add(hp) db.session.commit() flash({'hpopen':True}, 'viewstate') return redirect('/pc/%s' % pc.name) except MultipleResultsFound, e: flash(('Found multiple characters named %s' % name, 'danger'), 'msg') pc = None except NoResultFound, e: flash(('PC %s not found' % name, 'warning'), 'msg') pc = None return redirect('/') @app.route('/pc/<name>/hp/<id>/set.do', methods=['GET', 'POST']) def do_sethppc(name, id): try: pc = models.Character.query.filter_by(name=name).one() hp = models.Hp.query.get(id) if not hp: flash(("HP %s not found" % id , 'danger'), 'msg') elif hp.character_id != pc.id: flash(("HP %s belongs to %s" % (id, hp.character.name) , 'danger'), 'msg') else: v = request.args.get('v', '') if not v or v == '': flash(("no new value specified" , 'warning'), 'msg') else: try: v = int(v) except ValueError, e: flash(("'%s' does not appear to be a number" % v, 'warning'), 'msg') hp.current = v db.session.commit() flash(("Set current to %d" % v , 'success'), 'msg') flash({'hpopen':True}, 'viewstate') return redirect('/pc/%s' % pc.name) except MultipleResultsFound, e: flash(('Found multiple characters named %s' % name, 'danger'), 'msg') pc = None except NoResultFound, e: flash(('PC %s not found' % name, 'warning'), 'msg') pc = None return redirect('/') @app.route('/pc/<name>/hp/<id>/max.do', methods=['GET', 'POST']) def do_maxhppc(name, id): try: pc = models.Character.query.filter_by(name=name).one() hp = models.Hp.query.get(id) if not hp: flash(("HP %s not found" % id , 'danger'), 'msg') elif hp.character_id != pc.id: flash(("HP %s belongs to %s" % (id, hp.character.name) , 'danger'), 'msg') else: v = request.args.get('v', '') if not v or v == '': flash(("no new value specified" , 'warning'), 'msg') else: try: v = int(v) except ValueError, e: flash(("'%s' does not appear to be a number" % v, 'warning'), 'msg') hp.max = v db.session.commit() flash(("Set max to %d" % v , 'success'), 'msg') flash({'hpopen':True}, 'viewstate') return redirect('/pc/%s' % pc.name) except MultipleResultsFound, e: flash(('Found multiple characters named %s' % name, 'danger'), 'msg') pc = None except NoResultFound, e: flash(('PC %s not found' % name, 'warning'), 'msg') pc = None return redirect('/') @app.route('/pc/<name>/hp/<id>/add.do', methods=['GET', 'POST']) def do_addhppc(name, id): try: pc = models.Character.query.filter_by(name=name).one() hp = models.Hp.query.get(id) if not hp: flash(("HP %s not found" % id , 'danger'), 'msg') elif hp.character_id != pc.id: flash(("HP %s belongs to %s" % (id, hp.character.name) , 'danger'), 'msg') else: v = request.args.get('v', '') if not v or v == '': flash(("no new value specified" , 'warning'), 'msg') else: try: v = int(v) except ValueError, e: flash(("'%s' does not appear to be a number" % v, 'warning'), 'msg') hp.current += v db.session.commit() if v < 0: flash(("Subtracted %d" % -v , 'success'), 'msg') else: flash(("Added %d" % v , 'success'), 'msg') flash({'hpopen':True}, 'viewstate') return redirect('/pc/%s' % pc.name) except MultipleResultsFound, e: flash(('Found multiple characters named %s' % name, 'danger'), 'msg') pc = None except NoResultFound, e: flash(('PC %s not found' % name, 'warning'), 'msg') pc = None return redirect('/') @app.route('/pc/<name>/hp/<id>/zap.do', methods=['GET', 'POST']) def do_zaphppc(name, id): try: pc = models.Character.query.filter_by(name=name).one() hp = models.Hp.query.get(id) if not hp: flash(("HP %s not found" % id , 'danger'), 'msg') elif hp.character_id != pc.id: flash(("HP %s belongs to %s" % (id, hp.character.name) , 'danger'), 'msg') else: db.session.delete(hp) db.session.commit() flash(("Deleted" , 'success'), 'msg') flash({'hpopen':True}, 'viewstate') return redirect('/pc/%s' % pc.name) except MultipleResultsFound, e: flash(('Found multiple characters named %s' % name, 'danger'), 'msg') pc = None except NoResultFound, e: flash(('PC %s not found' % name, 'warning'), 'msg') pc = None return redirect('/') @app.route('/admin/pc/') def adminpc(): pcs = models.Character.query.all() return render_template('/admin/pcs.html', pcs=pcs, newpc_form=forms.PC(), menu=menugear()) @app.route('/admin/pc/newpc.do', methods=['POST']) def do_newpc(): form = forms.PC(request.form) pc = models.Character(name=form.name.data, pname=form.pname.data, abbrev=form.abbrev.data) db.session.add(pc) db.session.commit() flash(("New PC", 'success'), 'msg') return redirect('/admin/pc/') @app.route('/admin/pc/<id>/delete.do', methods=['GET']) def do_deletepc(id): pc = models.Character.query.get(id) if not pc: flash(("PC %s not found" % id , 'danger'), 'msg') else : db.session.delete(pc) db.session.commit() flash(("PC '%s' deleted" % pc.name , 'success'), 'msg') return redirect('/admin/pc/')
26.939716
94
0.612874
1,051
7,597
4.384396
0.11608
0.022135
0.027344
0.038194
0.715495
0.655599
0.605252
0.605252
0.605252
0.605252
0
0.000165
0.201395
7,597
281
95
27.035587
0.759354
0
0
0.607143
0
0
0.205503
0.019352
0
0
0
0
0
0
null
null
0
0.03125
null
null
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
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
2
f06c0a436a6bd375e7b53e8c96203ec37cc92572
1,624
py
Python
tests/fixtures/specification.py
FlyingBird95/openapi_generator
df4649b9723eb89fa370b02220356b7596794069
[ "MIT" ]
3
2022-01-10T12:43:36.000Z
2022-01-13T18:08:15.000Z
tests/fixtures/specification.py
FlyingBird95/openapi_generator
df4649b9723eb89fa370b02220356b7596794069
[ "MIT" ]
6
2021-12-09T20:08:19.000Z
2021-12-21T13:31:54.000Z
tests/fixtures/specification.py
FlyingBird95/openapi-builder
df4649b9723eb89fa370b02220356b7596794069
[ "MIT" ]
2
2021-12-17T17:26:06.000Z
2021-12-17T17:39:00.000Z
from pytest_factoryboy import register from tests.factories.specification import ( CallbackFactory, ComponentsFactory, ContactFactory, DiscriminatorFactory, EncodingFactory, ExampleFactory, ExternalDocumentationFactory, HeaderFactory, InfoFactory, LicenseFactory, LinkFactory, MediaTypeFactory, OAuthFlowFactory, OAuthFlowsFactory, OpenAPIFactory, OperationFactory, ParameterFactory, PathItemFactory, PathsFactory, ReferenceFactory, RequestBodyFactory, ResponseFactory, ResponsesFactory, SchemaFactory, SecurityRequirementFactory, SecuritySchemeFactory, ServerFactory, ServerVariableFactory, TagFactory, ) register(OpenAPIFactory) register(InfoFactory) register(ContactFactory) register(LicenseFactory) register(ServerFactory) register(ServerVariableFactory) register(ComponentsFactory) register(PathsFactory) register(PathItemFactory) register(OperationFactory) register(ExternalDocumentationFactory) register(ParameterFactory) register(RequestBodyFactory) register(MediaTypeFactory) register(EncodingFactory) register(ResponsesFactory) register(ResponseFactory) register(CallbackFactory) register(ExampleFactory) register(LinkFactory) register(HeaderFactory) register(TagFactory) register(ReferenceFactory) register(SchemaFactory) register(SchemaFactory, "second_schema") register(DiscriminatorFactory) register(SecuritySchemeFactory) register(OAuthFlowsFactory, "oauth_flows") register(OAuthFlowFactory, "oauth_flow") register(OAuthFlowFactory, "second_oauth_flow") register(SecurityRequirementFactory)
24.606061
47
0.816502
110
1,624
12
0.381818
0.027273
0.025758
0
0
0
0
0
0
0
0
0
0.117611
1,624
65
48
24.984615
0.921144
0
0
0
0
0
0.031404
0
0
0
0
0
0
1
0
true
0
0.031746
0
0.031746
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
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
2
f06f16ee399ccb9faac16cda8b08d3cc4df552cb
1,480
py
Python
projectenv/main/forms.py
rzsaglam/project-env
f4c02b15cf924ba5d69d8a4a89efcc686b73aa9c
[ "MIT" ]
null
null
null
projectenv/main/forms.py
rzsaglam/project-env
f4c02b15cf924ba5d69d8a4a89efcc686b73aa9c
[ "MIT" ]
null
null
null
projectenv/main/forms.py
rzsaglam/project-env
f4c02b15cf924ba5d69d8a4a89efcc686b73aa9c
[ "MIT" ]
null
null
null
from django import forms from django.contrib.auth import models from django.db.models.base import Model from django.forms import ModelForm, fields from .models import Paint from django import forms from django.contrib.auth.models import User from django.contrib.auth.forms import UserCreationForm, AuthenticationForm class StockForm(forms.ModelForm): class Meta: model = Paint fields = "__all__" class PaintForm(forms.ModelForm): class Meta: model = Paint fields = "__all__" def save(self, commit=True): paint = super(PaintForm, self).save(commit=False) if commit: paint.save() return paint class NewUserForm(UserCreationForm): username = forms.CharField(max_length=200, required=True, widget=forms.TextInput( attrs={'class': 'input-group-text'})) class Meta: model = User fields = ("username", "password1", "password2") def save(self, commit=True): user = super(NewUserForm, self).save(commit=False) if commit: user.save() return user class LoginForm(AuthenticationForm): username = forms.CharField(max_length=200, required=True, widget=forms.TextInput( attrs={'class': 'input-group-text'})) password = forms.CharField(max_length=200, required=True, widget=forms.TextInput( attrs={'class': 'input-group-text'})) class Meta: model = User fields = ("username", "password")
27.924528
85
0.667568
171
1,480
5.71345
0.274854
0.071648
0.057318
0.064483
0.603889
0.560901
0.505629
0.505629
0.333675
0.333675
0
0.009565
0.222973
1,480
52
86
28.461538
0.84
0
0
0.525
0
0
0.080405
0
0
0
0
0
0
1
0.05
false
0.075
0.2
0
0.575
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
f0791e37af8f0e6bb45c78c7fc37667ac15c9e8a
627
py
Python
test/scripts/functions.py
JetBrains-Research/jpt-nb-corpus
d93ac84ff885b30ef736cd82f5ce8b09c28ef3d1
[ "MIT" ]
3
2022-03-25T10:17:22.000Z
2022-03-27T14:13:03.000Z
test/scripts/functions.py
JetBrains-Research/Matroskin
053ed3d7e9dffb0aee4012bc49a194e0c60217c7
[ "MIT" ]
null
null
null
test/scripts/functions.py
JetBrains-Research/Matroskin
053ed3d7e9dffb0aee4012bc49a194e0c60217c7
[ "MIT" ]
1
2021-07-06T16:22:11.000Z
2021-07-06T16:22:11.000Z
# Explicit API functions from api_functions import api_function1, api_function2 from package3 import api_function3 # API Packages import package1, package2 import package3 from package4 import api_class1 # Defined functions def defined_function_1(d_f_arg1, d_f_arg2): a = api_function1(d_f_arg1) b = (api_function2(d_f_arg2, d_f_arg1), api_function3()) def defined_function_2(d_f_arg1, d_f_arg2, d_f_arg3): api_function1() package1.p1_function1(d_f_arg1, d_f_arg2, d_f_arg3) a, b = api_class1.cl1_function1(1, 2, '3') def defined_function_3(): package1.p1_function1() package3.p3_function1()
24.115385
60
0.77193
103
627
4.291262
0.291262
0.049774
0.067873
0.047511
0.126697
0.108597
0.081448
0.081448
0.081448
0
0
0.078505
0.14673
627
26
61
24.115385
0.747664
0.08453
0
0
0
0
0.001751
0
0
0
0
0
0
1
0.2
false
0
0.333333
0
0.533333
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
f082e2a2d09bf1830b2b1fcb472bd7a239f75622
716
py
Python
layers/modules/fast_mask_iou.py
sebastian-ruiz/yolact
0fdce34ddd38d8895445444f04c5a9d4e0384a3e
[ "MIT" ]
1
2021-11-08T14:06:49.000Z
2021-11-08T14:06:49.000Z
layers/modules/fast_mask_iou.py
sebastian-ruiz/yolact
0fdce34ddd38d8895445444f04c5a9d4e0384a3e
[ "MIT" ]
null
null
null
layers/modules/fast_mask_iou.py
sebastian-ruiz/yolact
0fdce34ddd38d8895445444f04c5a9d4e0384a3e
[ "MIT" ]
null
null
null
import torch from torch import nn import torch.nn.functional as F #locals from data.config import Config from utils.functions import make_net from utils.script_module_wrapper import ScriptModuleWrapper, script_method_wrapper class FastMaskIoUNet(ScriptModuleWrapper): def __init__(self, config:Config): super().__init__() cfg = config input_channels = 1 last_layer = [(cfg.num_classes-1, 1, {})] self.maskiou_net, _ = make_net(input_channels, cfg.maskiou_net + last_layer, include_last_relu=True) def forward(self, x): x = self.maskiou_net(x) maskiou_p = F.max_pool2d(x, kernel_size=x.size()[2:]).squeeze(-1).squeeze(-1) return maskiou_p
28.64
108
0.706704
99
716
4.818182
0.474747
0.062893
0.0587
0
0
0
0
0
0
0
0
0.012132
0.194134
716
24
109
29.833333
0.814558
0.00838
0
0
0
0
0
0
0
0
0
0
0
1
0.117647
false
0
0.352941
0
0.588235
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
b2b2c142b45b87b8147bfd47d58eb146d6e75472
610
py
Python
schoolport/app_core/migrations/0024_auto_20210513_1020.py
yotink522/schoolport
c6cfd0230ca05fb44f77c2f27c7e200828547bd5
[ "MIT" ]
null
null
null
schoolport/app_core/migrations/0024_auto_20210513_1020.py
yotink522/schoolport
c6cfd0230ca05fb44f77c2f27c7e200828547bd5
[ "MIT" ]
null
null
null
schoolport/app_core/migrations/0024_auto_20210513_1020.py
yotink522/schoolport
c6cfd0230ca05fb44f77c2f27c7e200828547bd5
[ "MIT" ]
null
null
null
# Generated by Django 3.1.7 on 2021-05-13 02:20 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('app_core', '0023_auto_20210513_1004'), ] operations = [ migrations.AlterField( model_name='tb_course', name='pricing_standard_nos', field=models.CharField(blank=True, max_length=255, null=True), ), migrations.AlterField( model_name='tb_course', name='remarks', field=models.CharField(blank=True, max_length=1024, null=True), ), ]
25.416667
75
0.603279
68
610
5.235294
0.661765
0.11236
0.140449
0.162921
0.44382
0.44382
0.44382
0
0
0
0
0.086758
0.281967
610
23
76
26.521739
0.726027
0.07377
0
0.352941
1
0
0.134991
0.040853
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
b2b8a861bf96a35529dc0c381016dc12ddf8518f
7,217
py
Python
layers/layers.py
yangzonglin1994/yangzl-deep-text-matching
2beadd1c2ebf2b169558b9978e0cbc66d1d25fc6
[ "MIT" ]
2
2018-08-10T20:02:44.000Z
2018-08-10T20:02:50.000Z
layers/layers.py
yangzonglin1994/yangzl-text-matching
2beadd1c2ebf2b169558b9978e0cbc66d1d25fc6
[ "MIT" ]
1
2018-07-30T08:54:35.000Z
2018-07-30T08:54:35.000Z
layers/layers.py
yangzonglin1994/yangzl-text-matching
2beadd1c2ebf2b169558b9978e0cbc66d1d25fc6
[ "MIT" ]
null
null
null
import tensorflow as tf from keras import backend as K from keras.engine.topology import Layer from keras.initializers import Ones, Zeros from layers import transformer class LayerNormalization(Layer): def __init__(self, eps=1e-6, **kwargs): super(LayerNormalization, self).__init__(**kwargs) self.eps = eps self.gamma = None self.beta = None def build(self, input_shape): # Create trainable weight variables for this layer. # 不同的行共享gamma和beta self.gamma = self.add_weight(name='gamma', shape=input_shape[-1:], initializer=Ones(), trainable=True) self.beta = self.add_weight(name='beta', shape=input_shape[-1:], initializer=Zeros(), trainable=True) super(LayerNormalization, self).build(input_shape) # Be sure to call this at the end def call(self, inputs, **kwargs): mean = K.mean(inputs, axis=-1, keepdims=True) std = K.std(inputs, axis=-1, keepdims=True) # 类似于BN,LN在对样本归一化后也有缩放和平移操作 # Python中的广播 return self.gamma * (inputs - mean) / (std + self.eps) + self.beta def compute_output_shape(self, input_shape): return input_shape def get_config(self): config = {'eps': self.eps} base_config = super(LayerNormalization, self).get_config() return dict(list(base_config.items()) + list(config.items())) class AvgEmb(Layer): def __init__(self, word_vec_dim, **kwargs): super(AvgEmb, self).__init__(**kwargs) self.word_vec_dim = word_vec_dim # 模板方法模式 def call(self, inputs, **kwargs): inputs = tf.reduce_mean(inputs, axis=1, keepdims=True) # return Reshape([self.word_vec_dim])(X) return tf.reshape(inputs, [-1, self.word_vec_dim]) # 由于是静态计算图的框架,shape都并不可靠,可能不是预期的值 # 尽量使用已知值 def compute_output_shape(self, input_shape, **kwargs): return input_shape[0], self.word_vec_dim # 和保存相关的方法 # config = layer.get_config() or model.get_config() => 包含这个层配置信息的dict # layer = Layer.from_config(config) or # model = Model.from_config(config) or Sequential.from_config(config) # 由于Keras其他层没有重写from_config方法,我的自定义层也不重写 def get_config(self): config = {'word_vec_dim': self.word_vec_dim} base_config = super(AvgEmb, self).get_config() return dict(list(base_config.items()) + list(config.items())) class Repeat(Layer): def __init__(self, rep, axis, batch_size, **kwargs): Layer.__init__(self, **kwargs) self.rep = rep self.axis = axis self.batch_size = batch_size def call(self, inputs, **kwargs): return K.repeat_elements(inputs, self.rep, self.axis) def compute_output_shape(self, input_shape): axis = self.axis if axis == 0: return self.rep*self.batch_size, input_shape[1], input_shape[2] elif axis == 1: return self.batch_size, self.rep*input_shape[1], input_shape[2] elif axis == 2: return self.batch_size, input_shape[1], self.rep*input_shape[2] else: raise ValueError('axis not in [0, 1, 2]') def get_config(self): config = {'rep': self.rep, 'axis': self.axis, 'batch_size': self.batch_size} base_config = Layer.get_config(self) # dict.items() will return a set-like object return dict(base_config.items() | config.items()) class ScaledDotProduct(Layer): def __init__(self, temper, **kwargs): super(ScaledDotProduct, self).__init__(**kwargs) self.temper = temper def call(self, inputs, **kwargs): q, k = inputs[0], inputs[1] # K.batch_dot, batch-wise dot product # batch-wise operation, element-wise operation, point-wise operation # axes=[2, 2]意味着“砍掉”batch data tensor.shape的第三维 return K.batch_dot(q, k, axes=[2, 2]) / self.temper def compute_output_shape(self, input_shape): input_shape = input_shape[0] return input_shape[0], input_shape[1], input_shape[1] def get_config(self): config = {'temper': self.temper} base_config = super(ScaledDotProduct, self).get_config() return dict(list(base_config.items()) + list(config.items())) class MMask(Layer): def __init__(self, **kwargs): super(MMask, self).__init__(**kwargs) def call(self, inputs, **kwargs): return (-1e+10) * (1-inputs) def compute_output_shape(self, input_shape): return input_shape class WeightedSum(Layer): def __init__(self, **kwargs): super(WeightedSum, self).__init__(**kwargs) def call(self, inputs, **kwargs): attn, v = inputs[0], inputs[1] # 默认axes=[2, 1] return K.batch_dot(attn, v) class Reshape1(Layer): def __init__(self, n_head, d_k, batch_size, **kwargs): super(Reshape1, self).__init__(**kwargs) self.n_head = n_head self.d_k = d_k self.batch_size = batch_size def call(self, inputs, **kwargs): n_head = self.n_head d_k = self.d_k s = tf.shape(inputs) # [batch_size, len_q, n_head * d_k] inputs = tf.reshape(inputs, [s[0], s[1], n_head, d_k]) inputs = tf.transpose(inputs, [2, 0, 1, 3]) # -1意味着自动推断 inputs = tf.reshape(inputs, [-1, s[1], d_k]) # [n_head * batch_size, len_q, d_k] return inputs def compute_output_shape(self, input_shape): return self.n_head*self.batch_size, input_shape[1], self.d_k def get_config(self): config = {'n_head': self.n_head, 'd_k': self.d_k, 'batch_size': self.batch_size} base_config = super(Reshape1, self).get_config() return dict(list(base_config.items()) + list(config.items())) class Reshape2(Layer): def __init__(self, n_head, d_v, batch_size, **kwargs): super(Reshape2, self).__init__(**kwargs) self.n_head = n_head self.d_v = d_v self.batch_size = batch_size def call(self, inputs, **kwargs): n_head = self.n_head d_v = self.d_v s = tf.shape(inputs) # [n_head * batch_size, seq_len, d_v] inputs = tf.reshape(inputs, [n_head, -1, s[1], s[2]]) inputs = tf.transpose(inputs, [1, 2, 0, 3]) # n_head * s[2]会出错! inputs = tf.reshape(inputs, [-1, s[1], n_head * d_v]) # [batch_size, seq_len, n_head * d_v] return inputs def compute_output_shape(self, input_shape): return self.batch_size, input_shape[1], self.n_head * self.d_v def get_config(self): config = {'n_head': self.n_head, 'd_v': self.d_v, 'batch_size': self.batch_size} base_config = super(Reshape2, self).get_config() return dict(list(base_config.items()) + list(config.items())) class GetPadMask(Layer): def __init__(self, **kwargs): super(GetPadMask, self).__init__(**kwargs) def call(self, inputs, **kwargs): return transformer.get_pad_mask(inputs, inputs) def compute_output_shape(self, input_shape): return input_shape[0], input_shape[1], input_shape[1]
35.033981
100
0.620479
977
7,217
4.328557
0.146366
0.073303
0.028612
0.034051
0.476472
0.417593
0.367936
0.307165
0.253015
0.232679
0
0.012773
0.25149
7,217
205
101
35.204878
0.770085
0.113066
0
0.352113
0
0
0.016627
0
0
0
0
0
0
1
0.232394
false
0
0.035211
0.06338
0.507042
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
b2c4382563bdc135f87a0336d22aa149de5f9c44
9,203
py
Python
rollon_erpnext/hooks_property_setter.py
santoshbb/rhplrepo
8ce4792ea47b66ab2b7aed9da468104a2d37ae2b
[ "MIT" ]
null
null
null
rollon_erpnext/hooks_property_setter.py
santoshbb/rhplrepo
8ce4792ea47b66ab2b7aed9da468104a2d37ae2b
[ "MIT" ]
null
null
null
rollon_erpnext/hooks_property_setter.py
santoshbb/rhplrepo
8ce4792ea47b66ab2b7aed9da468104a2d37ae2b
[ "MIT" ]
null
null
null
property_setter = { "dt": "Property Setter", "filters": [ ["name", "in", [ 'Purchase Order-read_only_onload', 'Purchase Order-default_print_format', 'Purchase Invoice-naming_series-options', 'Purchase Invoice-naming_series-default', 'Delivery Note-naming_series-options', 'Delivery Note-naming_series-default', 'Sales Order-naming_series-options', 'Sales Order-naming_series-default', 'Purchase Receipt-naming_series-options', 'Purchase Receipt-naming_series-default', 'Production Order-naming_series-options', 'Production Order-naming_series-default', 'Stock Entry-naming_series-options', 'Stock Entry-naming_series-default', 'Purchase Order-naming_series-options', 'Purchase Order-naming_series-default', 'Sales Invoice-naming_series-options', 'Sales Invoice-naming_series-default', 'Purchase Invoice-read_only_onload', 'Stock Reconciliation-read_only_onload', 'Delivery Note-read_only_onload', 'Stock Entry-read_only_onload', 'Sales Invoice-po_no-read_only', 'Sales Invoice-read_only_onload', 'Purchase Receipt Item-read_only_onload', 'Custom Field-fieldname-width', 'Custom Field-dt-width', 'Sales Invoice Item-read_only_onload', 'Sales Invoice Item-warehouse-default', 'Sales Order-po_no-read_only', 'Sales Order-read_only_onload', 'Item-read_only_onload', 'User-read_only_onload', 'User-sort_field', 'Asset Maintenance Task-periodicity-options', 'Asset Maintenance Task-read_only_onload', 'Asset-read_only_onload', 'Sales Invoice Item-customer_item_code-print_hide', 'Sales Invoice Item-customer_item_code-hidden', 'Sales Order Item-read_only_onload', 'BOM-with_operations-default', 'BOM-read_only_onload', 'Stock Entry-default_print_format', 'Purchase Receipt-read_only_onload', 'Production Order-skip_transfer-default', 'Production Order-skip_transfer-read_only', 'Production Order-use_multi_level_bom-default', 'Production Order-use_multi_level_bom-read_only', 'Production Order-read_only_onload', 'Purchase Order Item-amount-precision', 'Purchase Order Item-read_only_onload', 'Purchase Order Item-rate-precision', 'Stock Entry-use_multi_level_bom-default', 'Stock Entry-use_multi_level_bom-read_only', 'Stock Entry-from_bom-read_only', 'Stock Entry-from_bom-default', 'Stock Entry Detail-barcode-read_only', 'Stock Entry Detail-read_only_onload', 'Stock Entry-to_warehouse-read_only', 'Stock Entry-from_warehouse-read_only', 'Stock Entry-remarks-reqd', 'Purchase Receipt-in_words-print_hide', 'Purchase Receipt-in_words-hidden', 'Purchase Invoice-in_words-print_hide', 'Purchase Invoice-in_words-hidden', 'Purchase Order-in_words-print_hide', 'Purchase Order-in_words-hidden', 'Supplier Quotation-in_words-print_hide', 'Supplier Quotation-in_words-hidden', 'Delivery Note-in_words-print_hide', 'Delivery Note-in_words-hidden', 'Sales Invoice-in_words-print_hide', 'Sales Invoice-in_words-hidden', 'Sales Order-in_words-print_hide', 'Sales Order-in_words-hidden', 'Quotation-in_words-print_hide', 'Quotation-in_words-hidden', 'Purchase Order-rounded_total-print_hide', 'Purchase Order-rounded_total-hidden', 'Purchase Order-base_rounded_total-print_hide', 'Purchase Order-base_rounded_total-hidden', 'Supplier Quotation-rounded_total-print_hide', 'Supplier Quotation-rounded_total-hidden', 'Supplier Quotation-base_rounded_total-print_hide', 'Supplier Quotation-base_rounded_total-hidden', 'Delivery Note-rounded_total-print_hide', 'Delivery Note-rounded_total-hidden', 'Delivery Note-base_rounded_total-print_hide', 'Delivery Note-base_rounded_total-hidden', 'Sales Invoice-rounded_total-print_hide', 'Sales Invoice-rounded_total-hidden', 'Sales Invoice-base_rounded_total-print_hide', 'Sales Invoice-base_rounded_total-hidden', 'Sales Order-rounded_total-print_hide', 'Sales Order-rounded_total-hidden', 'Sales Order-base_rounded_total-print_hide', 'Sales Order-base_rounded_total-hidden', 'Quotation-rounded_total-print_hide', 'Quotation-rounded_total-hidden', 'Quotation-base_rounded_total-print_hide', 'Quotation-base_rounded_total-hidden', 'Dropbox Settings-dropbox_setup_via_site_config-hidden', 'Dropbox Settings-read_only_onload', 'Dropbox Settings-dropbox_access_token-hidden', 'Activity Log-subject-width', 'Employee-employee_number-hidden', 'Employee-employee_number-reqd', 'Employee-naming_series-reqd', 'Employee-naming_series-hidden', 'Supplier-naming_series-hidden', 'Supplier-naming_series-reqd', 'Delivery Note-tax_id-print_hide', 'Delivery Note-tax_id-hidden', 'Sales Invoice-tax_id-print_hide', 'Sales Invoice-tax_id-hidden', 'Sales Order-tax_id-print_hide', 'Sales Order-tax_id-hidden', 'Customer-naming_series-hidden', 'Customer-naming_series-reqd', 'Stock Entry Detail-barcode-hidden', 'Stock Reconciliation Item-barcode-hidden', 'Item-barcode-hidden', 'Delivery Note Item-barcode-hidden', 'Sales Invoice Item-barcode-hidden', 'Purchase Receipt Item-barcode-hidden', 'Item-item_code-reqd', 'Item-item_code-hidden', 'Item-naming_series-hidden', 'Item-naming_series-reqd', 'Item-manufacturing-collapsible_depends_on', 'Purchase Invoice-payment_schedule-print_hide', 'Purchase Invoice-due_date-print_hide', 'Purchase Order-payment_schedule-print_hide', 'Purchase Order-due_date-print_hide', 'Sales Invoice-payment_schedule-print_hide', 'Sales Invoice-due_date-print_hide', 'Sales Order-payment_schedule-print_hide', 'Sales Order-due_date-print_hide', 'Journal Entry Account-sort_order', 'Journal Entry Account-account_currency-print_hide', 'Sales Invoice-taxes_and_charges-reqd', 'Sales Taxes and Charges-sort_order', 'Sales Invoice Item-customer_item_code-label', 'Sales Invoice-default_print_format', 'Purchase Taxes and Charges Template-sort_order', 'Serial No-company-in_standard_filter', 'Serial No-amc_expiry_date-in_standard_filter', 'Serial No-warranty_expiry_date-in_standard_filter', 'Serial No-maintenance_status-in_standard_filter', 'Serial No-customer_name-in_standard_filter', 'Serial No-customer_name-bold', 'Serial No-customer-in_standard_filter', 'Serial No-delivery_document_no-in_standard_filter', 'Serial No-delivery_document_type-in_standard_filter', 'Serial No-supplier_name-bold', 'Serial No-supplier_name-in_standard_filter', 'Serial No-supplier-in_standard_filter', 'Serial No-purchase_date-in_standard_filter', 'Serial No-description-in_standard_filter', 'Delivery Note-section_break1-hidden', 'Delivery Note-sales_team_section_break-hidden', 'Delivery Note-project-hidden', 'Delivery Note-taxes-hidden', 'Delivery Note-taxes_and_charges-hidden', 'Delivery Note-taxes_section-hidden', 'Delivery Note-posting_time-print_hide', 'Delivery Note-posting_time-description', 'Delivery Note Item-warehouse-default', 'Item-income_account-default', 'Item-income_account-depends_on', 'Purchase Receipt-remarks-reqd', 'Purchase Receipt-taxes-hidden', 'Purchase Receipt-taxes_and_charges-hidden', 'Purchase Receipt Item-base_rate-fieldtype', 'Purchase Receipt Item-amount-in_list_view', 'Purchase Receipt Item-rate-fieldtype', 'Purchase Receipt Item-base_price_list_rate-fieldtype', 'Purchase Receipt Item-price_list_rate-fieldtype', 'Purchase Receipt Item-qty-in_list_view', 'Stock Entry-title_field', 'Stock Entry-search_fields', 'Stock Entry-project-hidden', 'Stock Entry-supplier-in_list_view', 'Stock Entry-from_warehouse-in_list_view', 'Stock Entry-to_warehouse-in_list_view', 'Stock Entry-purpose-default', 'ToDo-sort_order', 'Currency Exchange-sort_order', 'Company-abbr-in_list_view', 'Stock Reconciliation-expense_account-in_standard_filter', 'Stock Reconciliation-expense_account-depends_on', 'Sales Order-taxes-hidden', 'Warehouse-sort_order', 'Address-fax-hidden', 'Address-fax-read_only', 'Address-phone-hidden', 'Address-email_id-hidden', 'Address-city-reqd', 'BOM Operation-sort_order', 'BOM Item-scrap-read_only', 'BOM-operations_section-read_only', 'BOM-operations-read_only', 'BOM-rm_cost_as_per-reqd', 'Journal Entry-pay_to_recd_from-allow_on_submit', 'Journal Entry-remark-in_global_search', 'Journal Entry-total_amount-bold', 'Journal Entry-total_amount-print_hide', 'Journal Entry-total_amount-in_list_view', 'Journal Entry-total_credit-print_hide', 'Journal Entry-total_debit-print_hide', 'Journal Entry-total_debit-in_list_view', 'Journal Entry-user_remark-print_hide', 'Stock Entry-to_warehouse-hidden', 'Purchase Order Item-rate-fieldtype', 'Journal Entry Account-exchange_rate-print_hide', 'Sales Invoice Item-item_code-label', 'BOM-rm_cost_as_per-options', 'Purchase Order Item-price_list_rate-fieldtype', 'Reconciliation-expense_account-read_only', 'Customer-tax_id-read_only', 'Purchase Order Item-amount-fieldtype', 'Stock Entry-project-hidden' ] ] ] }
40.013043
61
0.757688
1,211
9,203
5.466557
0.123865
0.053021
0.042296
0.038066
0.425227
0.21148
0.053625
0
0
0
0
0.000124
0.122786
9,203
230
62
40.013043
0.819893
0
0
0
0
0
0.824424
0.565732
0
0
0
0
0
1
0
false
0
0
0
0
0.182609
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
b2c664ce7bd387984bca2a25d6741d8d39b481e1
2,624
py
Python
django/contrib/sessions/tests.py
rawwell/django
6b3264671ead4604f26cbd2b71e8d6a02945bf0c
[ "BSD-3-Clause" ]
1
2016-05-08T12:24:22.000Z
2016-05-08T12:24:22.000Z
django/contrib/sessions/tests.py
rawwell/django
6b3264671ead4604f26cbd2b71e8d6a02945bf0c
[ "BSD-3-Clause" ]
null
null
null
django/contrib/sessions/tests.py
rawwell/django
6b3264671ead4604f26cbd2b71e8d6a02945bf0c
[ "BSD-3-Clause" ]
1
2015-11-19T14:45:16.000Z
2015-11-19T14:45:16.000Z
r""" >>> from django.conf import settings >>> from django.contrib.sessions.backends.db import SessionStore as DatabaseSession >>> from django.contrib.sessions.backends.cache import SessionStore as CacheSession >>> from django.contrib.sessions.backends.file import SessionStore as FileSession >>> from django.contrib.sessions.backends.base import SessionBase >>> db_session = DatabaseSession() >>> db_session.modified False >>> db_session['cat'] = "dog" >>> db_session.modified True >>> db_session.pop('cat') 'dog' >>> db_session.pop('some key', 'does not exist') 'does not exist' >>> db_session.save() >>> db_session.exists(db_session.session_key) True >>> db_session.delete(db_session.session_key) >>> db_session.exists(db_session.session_key) False >>> file_session = FileSession() >>> file_session.modified False >>> file_session['cat'] = "dog" >>> file_session.modified True >>> file_session.pop('cat') 'dog' >>> file_session.pop('some key', 'does not exist') 'does not exist' >>> file_session.save() >>> file_session.exists(file_session.session_key) True >>> file_session.delete(file_session.session_key) >>> file_session.exists(file_session.session_key) False # Make sure the file backend checks for a good storage dir >>> settings.SESSION_FILE_PATH = "/if/this/directory/exists/you/have/a/weird/computer" >>> FileSession() Traceback (innermost last): ... ImproperlyConfigured: The session storage path '/if/this/directory/exists/you/have/a/weird/computer' doesn't exist. Please set your SESSION_FILE_PATH setting to an existing directory in which Django can store session data. >>> cache_session = CacheSession() >>> cache_session.modified False >>> cache_session['cat'] = "dog" >>> cache_session.modified True >>> cache_session.pop('cat') 'dog' >>> cache_session.pop('some key', 'does not exist') 'does not exist' >>> cache_session.save() >>> cache_session.delete(cache_session.session_key) >>> cache_session.exists(cache_session.session_key) False >>> s = SessionBase() >>> s._session['some key'] = 'exists' # Pre-populate the session with some data >>> s.accessed = False # Reset to pretend this wasn't accessed previously >>> s.accessed, s.modified (False, False) >>> s.pop('non existant key', 'does not exist') 'does not exist' >>> s.accessed, s.modified (True, False) >>> s.setdefault('foo', 'bar') 'bar' >>> s.setdefault('foo', 'baz') 'bar' >>> s.accessed = False # Reset the accessed flag >>> s.pop('some key') 'exists' >>> s.accessed, s.modified (True, True) >>> s.pop('some key', 'does not exist') 'does not exist' """ if __name__ == '__main__': import doctest doctest.testmod()
27.333333
222
0.722942
363
2,624
5.066116
0.247934
0.063622
0.065253
0.040783
0.324089
0.228385
0.228385
0.1354
0.1354
0.116911
0
0
0.115091
2,624
95
223
27.621053
0.79199
0.969512
0
0
0
0
0.112676
0
0
0
0
0
0
1
0
true
0
0.25
0
0.25
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
2
b2cacff06725bd2d9718bd414438fed14a74ef43
589
py
Python
src/django_version_checks/apps.py
adamchainz/django-version-checks
94f6d696f5279a7bb579c7d2a177a231d6b61e45
[ "MIT" ]
33
2020-12-13T23:02:39.000Z
2022-03-28T06:19:09.000Z
src/django_version_checks/apps.py
adamchainz/django-version-checks
94f6d696f5279a7bb579c7d2a177a231d6b61e45
[ "MIT" ]
47
2020-12-14T01:33:56.000Z
2021-11-06T09:17:38.000Z
src/django_version_checks/apps.py
adamchainz/django-version-checks
94f6d696f5279a7bb579c7d2a177a231d6b61e45
[ "MIT" ]
2
2021-11-13T22:56:21.000Z
2022-02-15T14:24:53.000Z
from django.apps import AppConfig from django.core.checks import Tags, register from django_version_checks import checks class DjangoVersionChecksAppConfig(AppConfig): name = "django_version_checks" verbose_name = "django-version-checks" def ready(self) -> None: register(Tags.compatibility)(checks.check_config) register(Tags.compatibility)(checks.check_python_version) register(Tags.database)(checks.check_postgresql_version) register(Tags.database)(checks.check_mysql_version) register(Tags.database)(checks.check_sqlite_version)
34.647059
65
0.7691
68
589
6.455882
0.382353
0.136674
0.129841
0.18451
0.42369
0.259681
0
0
0
0
0
0
0.14601
589
16
66
36.8125
0.872763
0
0
0
0
0
0.071307
0.071307
0
0
0
0
0
1
0.083333
false
0
0.25
0
0.583333
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
b2cdb0c942905c9f4fb6dbf73dca96d1a9a5f768
415
py
Python
dms/v2/meal/__init__.py
moreal/DMS-api
9624e28764ec4535002677671e10a09d762d19a8
[ "MIT" ]
null
null
null
dms/v2/meal/__init__.py
moreal/DMS-api
9624e28764ec4535002677671e10a09d762d19a8
[ "MIT" ]
null
null
null
dms/v2/meal/__init__.py
moreal/DMS-api
9624e28764ec4535002677671e10a09d762d19a8
[ "MIT" ]
1
2018-09-29T14:35:20.000Z
2018-09-29T14:35:20.000Z
import datetime import requests import json from dms.v2.config import DMS_URL class Meal(): @staticmethod def get(date: datetime.date or str=datetime.date.today()): if not isinstance(date, str): date = str(date) resp = requests.get(f"http://{DMS_URL}/v2/meal/{date}") meals = json.loads(resp.text) return meals['breakfast'], meals['lunch'], meals['dinner']
21.842105
66
0.636145
56
415
4.678571
0.553571
0.045802
0.083969
0
0
0
0
0
0
0
0
0.006211
0.224096
415
18
67
23.055556
0.807453
0
0
0
0
0
0.122892
0
0
0
0
0
0
1
0.083333
false
0
0.333333
0
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
0
0
0
1
0
1
0
0
2
b2d18501d17a461813526ffc739b3386958593ec
2,829
py
Python
backend/fief/schemas/workspace.py
fief-dev/fief
cbfeec11da7a03aa345cb7ceb088b5d8ec9d6ab1
[ "MIT" ]
1
2022-02-13T17:39:42.000Z
2022-02-13T17:39:42.000Z
backend/fief/schemas/workspace.py
fief-dev/fief
cbfeec11da7a03aa345cb7ceb088b5d8ec9d6ab1
[ "MIT" ]
1
2022-02-13T14:46:24.000Z
2022-02-13T14:46:24.000Z
backend/fief/schemas/workspace.py
fief-dev/fief
cbfeec11da7a03aa345cb7ceb088b5d8ec9d6ab1
[ "MIT" ]
null
null
null
from typing import Optional from pydantic import BaseModel, root_validator, validator from fief.crypto.encryption import decrypt from fief.db.types import DatabaseType from fief.errors import APIErrorCode from fief.schemas.generics import UUIDSchema from fief.settings import settings def validate_all_database_settings(cls, values): database_type = values.get("database_type") database_settings = [ values.get("database_host"), values.get("database_port"), values.get("database_username"), values.get("database_password"), values.get("database_name"), ] if database_type is None and not any(database_settings): return values if database_type is None and any(database_settings): raise ValueError(APIErrorCode.WORKSPACE_CREATE_MISSING_DATABASE_SETTINGS) database_name = values.get("database_name") if database_type == DatabaseType.SQLITE: if database_name is None: raise ValueError(APIErrorCode.WORKSPACE_CREATE_MISSING_DATABASE_SETTINGS) else: if not all(database_settings): raise ValueError(APIErrorCode.WORKSPACE_CREATE_MISSING_DATABASE_SETTINGS) return values class WorkspaceCheckConnection(BaseModel): database_type: DatabaseType database_host: str database_port: int database_username: str database_password: str database_name: str _validate_all_database_settings = root_validator(allow_reuse=True)( validate_all_database_settings ) class WorkspaceCreate(BaseModel): name: str database_type: Optional[DatabaseType] database_host: Optional[str] database_port: Optional[int] database_username: Optional[str] database_password: Optional[str] database_name: Optional[str] _validate_all_database_settings = root_validator(allow_reuse=True)( validate_all_database_settings ) class BaseWorkspace(UUIDSchema): name: str domain: str class Workspace(BaseWorkspace): database_type: Optional[DatabaseType] database_host: Optional[str] database_port: Optional[int] database_username: Optional[str] database_password: Optional[str] database_name: Optional[str] @validator( "database_host", "database_username", "database_password", "database_name", pre=True, ) def decrypt_database_setting(cls, value: Optional[str]) -> Optional[str]: if value is None: return value return decrypt(value, settings.encryption_key) @validator("database_port", pre=True) def decrypt_database_port(cls, value: Optional[str]) -> Optional[int]: if value is None: return value return int(decrypt(value, settings.encryption_key)) class WorkspacePublic(BaseWorkspace): pass
28.29
85
0.721456
318
2,829
6.166667
0.201258
0.097909
0.060683
0.068842
0.532381
0.445691
0.429373
0.36308
0.329934
0.329934
0
0
0.203252
2,829
99
86
28.575758
0.870009
0
0
0.350649
0
0
0.060799
0
0
0
0
0
0
1
0.038961
false
0.077922
0.090909
0
0.571429
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
0
0
1
0
0
2
b2d2f0394cea895eb88a51c785769332faca9031
844
py
Python
blog/tasks.py
iloveyougit/ylink2
a87d8fde79ab259012cd6486299fcf86e1afc740
[ "MIT" ]
null
null
null
blog/tasks.py
iloveyougit/ylink2
a87d8fde79ab259012cd6486299fcf86e1afc740
[ "MIT" ]
null
null
null
blog/tasks.py
iloveyougit/ylink2
a87d8fde79ab259012cd6486299fcf86e1afc740
[ "MIT" ]
null
null
null
from __future__ import absolute_import, unicode_literals import string from django.contrib.auth.models import User from django.utils.crypto import get_random_string from celery import shared_task, current_task @shared_task def create_random_user_accounts(total_user): for i in range(total_user): username = 'user_%s' % get_random_string(20, string.ascii_letters) email = '%s@example.com' % username password = get_random_string(50) User.objects.create_user(username=username, email=email, password=password) current_task.update_state(state='PROGRESS', meta={'current': i, 'total': total_user, 'percent': int((float(i) / total_user) * 100)}) return {'current': total_user, 'total': total_user, 'percent': 100}
29.103448
87
0.667062
104
844
5.134615
0.461538
0.101124
0.08427
0.078652
0
0
0
0
0
0
0
0.015456
0.233412
844
28
88
30.142857
0.809892
0
0
0
0
0
0.079762
0
0
0
0
0
0
1
0.0625
false
0.125
0.3125
0
0.4375
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
1
0
0
0
0
2
b2e0de9c060c5c18b08f58d054b60642948a19ab
13,975
py
Python
SViTE/backup/sparselearning/snip.py
VITA-Group/SViTE
b0c62fd153c8b0b99917ab935ee76925c9de1149
[ "MIT" ]
50
2021-05-29T00:52:45.000Z
2022-03-17T11:39:47.000Z
SViTE/backup/sparselearning/snip.py
VITA-Group/SViTE
b0c62fd153c8b0b99917ab935ee76925c9de1149
[ "MIT" ]
2
2022-01-16T07:24:52.000Z
2022-03-29T01:56:24.000Z
SViTE/backup/sparselearning/snip.py
VITA-Group/SViTE
b0c62fd153c8b0b99917ab935ee76925c9de1149
[ "MIT" ]
6
2021-06-27T22:24:16.000Z
2022-01-17T02:45:32.000Z
import torch import torch.autograd as autograd import torch.nn as nn import torch.nn.functional as F import math import copy import types def fgsm_attack(image, epsilon, data_grad): print('Attacking...') # Collect the element-wise sign of the data gradient sign_data_grad = data_grad.sign() # Create the perturbed image by adjusting each pixel of the input image perturbed_image = image + epsilon*sign_data_grad # Adding clipping to maintain [0,1] range perturbed_image = torch.clamp(perturbed_image, 0, 1) # Return the perturbed image return perturbed_image def snip_forward_conv2d(self, x): return F.conv2d(x, self.weight * self.weight_mask, self.bias, self.stride, self.padding, self.dilation, self.groups) def snip_forward_linear(self, x): return F.linear(x, self.weight * self.weight_mask, self.bias) def SNIP(net, keep_ratio, train_dataloader, device): # TODO: shuffle? # Grab a single batch from the training dataset inputs, targets = next(iter(train_dataloader)) inputs = inputs.to(device) targets = targets.to(device) inputs.requires_grad = True # Let's create a fresh copy of the network so that we're not worried about # affecting the actual training-phase net = copy.deepcopy(net) # Monkey-patch the Linear and Conv2d layer to learn the multiplicative mask # instead of the weights for layer in net.modules(): if isinstance(layer, nn.Conv2d) or isinstance(layer, nn.Linear): layer.weight_mask = nn.Parameter(torch.ones_like(layer.weight)) nn.init.xavier_normal_(layer.weight) layer.weight.requires_grad = False # Override the forward methods: if isinstance(layer, nn.Conv2d): layer.forward = types.MethodType(snip_forward_conv2d, layer) if isinstance(layer, nn.Linear): layer.forward = types.MethodType(snip_forward_linear, layer) # Compute gradients (but don't apply them) net.zero_grad() outputs = net.forward(inputs) loss = F.nll_loss(outputs, targets) loss.backward() grads_abs = [] for layer in net.modules(): if isinstance(layer, nn.Conv2d) or isinstance(layer, nn.Linear): grads_abs.append(torch.abs(layer.weight_mask.grad)) # Gather all scores in a single vector and normalise all_scores = torch.cat([torch.flatten(x) for x in grads_abs]) norm_factor = torch.sum(all_scores) all_scores.div_(norm_factor) num_params_to_keep = int(len(all_scores) * keep_ratio) threshold, _ = torch.topk(all_scores, num_params_to_keep, sorted=True) acceptable_score = threshold[-1] keep_masks = [] for g in grads_abs: keep_masks.append(((g / norm_factor) >= acceptable_score).float()) print(torch.sum(torch.cat([torch.flatten(x == 1) for x in keep_masks]))) return keep_masks def SNIP_training(net, keep_ratio, train_dataloader, device, masks, death_rate): # TODO: shuffle? # Grab a single batch from the training dataset inputs, targets = next(iter(train_dataloader)) inputs = inputs.to(device) targets = targets.to(device) print('Pruning rate:', death_rate) # Let's create a fresh copy of the network so that we're not worried about # affecting the actual training-phase net = copy.deepcopy(net) # Monkey-patch the Linear and Conv2d layer to learn the multiplicative mask # instead of the weights # for layer in net.modules(): # if isinstance(layer, nn.Conv2d) or isinstance(layer, nn.Linear): # layer.weight_mask = nn.Parameter(torch.ones_like(layer.weight)) # # nn.init.xavier_normal_(layer.weight) # # layer.weight.requires_grad = False # # # Override the forward methods: # if isinstance(layer, nn.Conv2d): # layer.forward = types.MethodType(snip_forward_conv2d, layer) # # if isinstance(layer, nn.Linear): # layer.forward = types.MethodType(snip_forward_linear, layer) # Compute gradients (but don't apply them) net.zero_grad() outputs = net.forward(inputs) loss = F.nll_loss(outputs, targets) loss.backward() grads_abs = [] masks_copy = [] new_masks = [] for name in masks: masks_copy.append(masks[name]) index = 0 for layer in net.modules(): if isinstance(layer, nn.Conv2d) or isinstance(layer, nn.Linear): # clone mask mask = masks_copy[index].clone() num_nonzero = (masks_copy[index] != 0).sum().item() num_zero = (masks_copy[index] == 0).sum().item() # calculate score scores = torch.abs(layer.weight.grad * layer.weight * masks_copy[index]) # weight * grad norm_factor = torch.sum(scores) scores.div_(norm_factor) x, idx = torch.sort(scores.data.view(-1)) num_remove = math.ceil(death_rate * num_nonzero) k = math.ceil(num_zero + num_remove) if num_remove == 0.0: return masks_copy[index] != 0.0 mask.data.view(-1)[idx[:k]] = 0.0 new_masks.append(mask) index += 1 return new_masks def GraSP_fetch_data(dataloader, num_classes, samples_per_class): datas = [[] for _ in range(num_classes)] labels = [[] for _ in range(num_classes)] mark = dict() dataloader_iter = iter(dataloader) while True: inputs, targets = next(dataloader_iter) for idx in range(inputs.shape[0]): x, y = inputs[idx:idx+1], targets[idx:idx+1] category = y.item() if len(datas[category]) == samples_per_class: mark[category] = True continue datas[category].append(x) labels[category].append(y) if len(mark) == num_classes: break X, y = torch.cat([torch.cat(_, 0) for _ in datas]), torch.cat([torch.cat(_) for _ in labels]).view(-1) return X, y def count_total_parameters(net): total = 0 for m in net.modules(): if isinstance(m, (nn.Linear, nn.Conv2d)): total += m.weight.numel() return total def count_fc_parameters(net): total = 0 for m in net.modules(): if isinstance(m, (nn.Linear)): total += m.weight.numel() return total def GraSP(net, ratio, train_dataloader, device, num_classes=10, samples_per_class=25, num_iters=1, T=200, reinit=True): eps = 1e-10 keep_ratio = ratio old_net = net net = copy.deepcopy(net) # .eval() net.zero_grad() weights = [] total_parameters = count_total_parameters(net) fc_parameters = count_fc_parameters(net) # rescale_weights(net) for layer in net.modules(): if isinstance(layer, nn.Conv2d) or isinstance(layer, nn.Linear): if isinstance(layer, nn.Linear) and reinit: nn.init.xavier_normal(layer.weight) weights.append(layer.weight) inputs_one = [] targets_one = [] grad_w = None for w in weights: w.requires_grad_(True) print_once = False for it in range(num_iters): print("(1): Iterations %d/%d." % (it, num_iters)) inputs, targets = GraSP_fetch_data(train_dataloader, num_classes, samples_per_class) N = inputs.shape[0] din = copy.deepcopy(inputs) dtarget = copy.deepcopy(targets) inputs_one.append(din[:N//2]) targets_one.append(dtarget[:N//2]) inputs_one.append(din[N // 2:]) targets_one.append(dtarget[N // 2:]) inputs = inputs.to(device) targets = targets.to(device) outputs = net.forward(inputs[:N//2])/T if print_once: # import pdb; pdb.set_trace() x = F.softmax(outputs) print(x) print(x.max(), x.min()) print_once = False loss = F.cross_entropy(outputs, targets[:N//2]) # ===== debug ================ grad_w_p = autograd.grad(loss, weights) if grad_w is None: grad_w = list(grad_w_p) else: for idx in range(len(grad_w)): grad_w[idx] += grad_w_p[idx] outputs = net.forward(inputs[N // 2:])/T loss = F.cross_entropy(outputs, targets[N // 2:]) grad_w_p = autograd.grad(loss, weights, create_graph=False) if grad_w is None: grad_w = list(grad_w_p) else: for idx in range(len(grad_w)): grad_w[idx] += grad_w_p[idx] ret_inputs = [] ret_targets = [] for it in range(len(inputs_one)): print("(2): Iterations %d/%d." % (it, num_iters)) inputs = inputs_one.pop(0).to(device) targets = targets_one.pop(0).to(device) ret_inputs.append(inputs) ret_targets.append(targets) outputs = net.forward(inputs)/T loss = F.cross_entropy(outputs, targets) # ===== debug ============== grad_f = autograd.grad(loss, weights, create_graph=True) z = 0 count = 0 for layer in net.modules(): if isinstance(layer, nn.Conv2d) or isinstance(layer, nn.Linear): z += (grad_w[count].data * grad_f[count]).sum() count += 1 z.backward() grads = dict() old_modules = list(old_net.modules()) for idx, layer in enumerate(net.modules()): if isinstance(layer, nn.Conv2d) or isinstance(layer, nn.Linear): grads[old_modules[idx]] = -layer.weight.data * layer.weight.grad # -theta_q Hg # Gather all scores in a single vector and normalise all_scores = torch.cat([torch.flatten(x) for x in grads.values()]) norm_factor = torch.abs(torch.sum(all_scores)) + eps print("** norm factor:", norm_factor) all_scores.div_(norm_factor) num_params_to_rm = int(len(all_scores) * (1-keep_ratio)) threshold, _ = torch.topk(all_scores, num_params_to_rm, sorted=True) # import pdb; pdb.set_trace() acceptable_score = threshold[-1] print('** accept: ', acceptable_score) keep_masks = [] for m, g in grads.items(): keep_masks.append(((g / norm_factor) <= acceptable_score).float()) # print(torch.sum(torch.cat([torch.flatten(x == 1) for x in keep_masks.values()]))) return keep_masks def GraSP_Training(net, ratio, train_dataloader, device, num_classes=10, samples_per_class=25, num_iters=1, T=200, reinit=False): eps = 1e-10 death_rate = ratio net = copy.deepcopy(net) # .eval() net.zero_grad() weights = [] # rescale_weights(net) for layer in net.modules(): if isinstance(layer, nn.Conv2d) or isinstance(layer, nn.Linear): if isinstance(layer, nn.Linear) and reinit: nn.init.xavier_normal(layer.weight) weights.append(layer.weight) inputs_one = [] targets_one = [] grad_w = None for w in weights: w.requires_grad_(True) print_once = False for it in range(num_iters): print("(1): Iterations %d/%d." % (it, num_iters)) inputs, targets = GraSP_fetch_data(train_dataloader, num_classes, samples_per_class) N = inputs.shape[0] din = copy.deepcopy(inputs) dtarget = copy.deepcopy(targets) inputs_one.append(din[:N//2]) targets_one.append(dtarget[:N//2]) inputs_one.append(din[N // 2:]) targets_one.append(dtarget[N // 2:]) inputs = inputs.to(device) targets = targets.to(device) outputs = net.forward(inputs[:N//2])/T if print_once: # import pdb; pdb.set_trace() x = F.softmax(outputs) print(x) print(x.max(), x.min()) print_once = False loss = F.cross_entropy(outputs, targets[:N//2]) # ===== debug ================ grad_w_p = autograd.grad(loss, weights) if grad_w is None: grad_w = list(grad_w_p) else: for idx in range(len(grad_w)): grad_w[idx] += grad_w_p[idx] outputs = net.forward(inputs[N // 2:])/T loss = F.cross_entropy(outputs, targets[N // 2:]) grad_w_p = autograd.grad(loss, weights, create_graph=False) if grad_w is None: grad_w = list(grad_w_p) else: for idx in range(len(grad_w)): grad_w[idx] += grad_w_p[idx] ret_inputs = [] ret_targets = [] for it in range(len(inputs_one)): print("(2): Iterations %d/%d." % (it, num_iters)) inputs = inputs_one.pop(0).to(device) targets = targets_one.pop(0).to(device) ret_inputs.append(inputs) ret_targets.append(targets) outputs = net.forward(inputs)/T loss = F.cross_entropy(outputs, targets) # ===== debug ============== grad_f = autograd.grad(loss, weights, create_graph=True) z = 0 count = 0 for layer in net.modules(): if isinstance(layer, nn.Conv2d) or isinstance(layer, nn.Linear): z += (grad_w[count].data * grad_f[count]).sum() count += 1 z.backward() keep_masks = [] for idx, layer in enumerate(net.modules()): if isinstance(layer, nn.Conv2d) or isinstance(layer, nn.Linear): grad = -layer.weight.data * layer.weight.grad # scores = torch.flatten(grad) # -theta_q Hg mask = grad != 0 num_nonzero = (grad != 0).sum().item() num_positive = (grad > 0).sum().item() num_zero = (grad == 0).sum().item() num_remove = math.ceil(num_nonzero*death_rate) if num_remove > num_positive: k = num_remove + num_zero else: k = num_remove threshold, idx = torch.topk(grad.data.view(-1), k, sorted=True) mask.data.view(-1)[idx[:k]] = 0.0 keep_masks.append(mask) return keep_masks
34.506173
129
0.606082
1,878
13,975
4.347178
0.126731
0.019598
0.05414
0.037237
0.728564
0.714356
0.689245
0.681651
0.660828
0.651029
0
0.01069
0.270411
13,975
405
130
34.506173
0.790016
0.134025
0
0.628472
0
0
0.011537
0
0
0
0
0.002469
0
1
0.034722
false
0
0.024306
0.006944
0.09375
0.065972
0
0
0
null
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
b2e290a686a1065fd69b5d2e7d362f288caf266f
117
py
Python
Module01/OOP/FirstClassDef.py
fenglihanxiao/Python
872baf3a3a5ee42740161152605ca2b1ddf4cd30
[ "MIT" ]
null
null
null
Module01/OOP/FirstClassDef.py
fenglihanxiao/Python
872baf3a3a5ee42740161152605ca2b1ddf4cd30
[ "MIT" ]
null
null
null
Module01/OOP/FirstClassDef.py
fenglihanxiao/Python
872baf3a3a5ee42740161152605ca2b1ddf4cd30
[ "MIT" ]
null
null
null
""" First class definition""" class Cat: pass class RaceCar: pass cat1 = Cat() cat2 = Cat() cat3 = Cat()
9
29
0.589744
15
117
4.6
0.6
0
0
0
0
0
0
0
0
0
0
0.034884
0.264957
117
13
30
9
0.767442
0.188034
0
0.285714
0
0
0
0
0
0
0
0
0
1
0
false
0.285714
0
0
0.285714
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
1
0
0
0
0
0
2
b2f42395c99cb32b176d6e1140d0291edc965ff1
1,210
py
Python
src/amuse/community/sei/test_sei.py
joshuawall/amuse
c2034074ee76c08057c4faa96c32044ab40952e9
[ "Apache-2.0" ]
1
2019-12-28T22:47:51.000Z
2019-12-28T22:47:51.000Z
src/amuse/community/sei/test_sei.py
joshuawall/amuse
c2034074ee76c08057c4faa96c32044ab40952e9
[ "Apache-2.0" ]
null
null
null
src/amuse/community/sei/test_sei.py
joshuawall/amuse
c2034074ee76c08057c4faa96c32044ab40952e9
[ "Apache-2.0" ]
2
2021-11-19T04:41:37.000Z
2021-11-20T02:11:17.000Z
from amuse.test.amusetest import TestWithMPI from amuse.units import nbody_system from amuse.units import units import os import sys import numpy import math from amuse.community.sei.interface import SeiInterface from amuse.community.sei.interface import Sei from amuse import datamodel class TestSeiInterface(TestWithMPI): def test0(self): instance = SeiInterface() instance.initialization() instance.set_state(0,1,0,0,0,0,0) for i in range(0,10): instance.evolve(i) print instance.get_state(0) instance.stop() class TestSei(TestWithMPI): def test0(self): convert_nbody = nbody_system.nbody_to_si(1.0 | units.MSun, 1 | units.AU) particle = datamodel.Particles(1) particle.position = [1.0, 0.0, 0.0,]|units.AU particle.velocity = [0.0, 2.0*3.1415926535*1.0/365, 0.0] | units.AUd sei = Sei(convert_nbody) sei.initialization() sei.particles.add_particles(particle) print sei.particles.position.x.value_in(units.AU) for i in range(365): sei.evolve_model(i|units.day) print sei.particles.position.x.value_in(units.AU)
29.512195
80
0.661157
168
1,210
4.690476
0.345238
0.025381
0.022843
0.020305
0.208122
0.208122
0.101523
0.101523
0.101523
0
0
0.051948
0.236364
1,210
40
81
30.25
0.800866
0
0
0.125
0
0
0
0
0
0
0
0
0
0
null
null
0
0.3125
null
null
0.09375
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
65036c3303afa1e8b9728043f619a82fc6c9e04f
261
py
Python
demo/test_scans.py
zhanwj/multi-task-pytorch
7d57645ec8be0ca0c258cfa99fb788e3cd37f106
[ "MIT" ]
2
2019-06-11T16:16:11.000Z
2020-07-21T10:34:40.000Z
demo/test_scans.py
zhanwj/multi-task-pytorch
7d57645ec8be0ca0c258cfa99fb788e3cd37f106
[ "MIT" ]
null
null
null
demo/test_scans.py
zhanwj/multi-task-pytorch
7d57645ec8be0ca0c258cfa99fb788e3cd37f106
[ "MIT" ]
2
2019-05-21T11:07:29.000Z
2019-06-11T16:17:02.000Z
import torch maxdisp = 10 disp_scans = torch.arange(maxdisp).view(1,maxdisp,1,1) zeros_scans = torch.arange(maxdisp).view(1,maxdisp,1,1) semseg = torch.arange(16).view(4,4) zeros_scans = torch.cat([zeros_scans.repeat(1, repeat,1, 1) for i in range(1)],dim=0)
32.625
85
0.731801
49
261
3.816327
0.428571
0.160428
0.171123
0.245989
0.395722
0.395722
0.395722
0.395722
0.395722
0
0
0.072034
0.095785
261
7
86
37.285714
0.720339
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.166667
0
0.166667
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
65054cfd998e3e6858fee00ff01c36b5dddea1ff
383
py
Python
models.py
collingreen/yaib_plugin_leavemessage
c1e7254edee5255167c2015ee2566f9770b35412
[ "MIT" ]
null
null
null
models.py
collingreen/yaib_plugin_leavemessage
c1e7254edee5255167c2015ee2566f9770b35412
[ "MIT" ]
1
2015-06-06T06:28:45.000Z
2015-06-06T06:28:45.000Z
models.py
collingreen/yaib_plugin_leavemessage
c1e7254edee5255167c2015ee2566f9770b35412
[ "MIT" ]
null
null
null
from sqlalchemy import Table, Column, String, DateTime, Text from modules.persistence import Base, getModelBase CustomBase = getModelBase('leavemessage') class Message(Base, CustomBase): user = Column(String(200)) nick = Column(String(100)) message_time = Column(DateTime) to_nick = Column(String(100)) channel = Column(String(50)) message = Column(Text)
25.533333
60
0.723238
45
383
6.111111
0.533333
0.218182
0.116364
0.138182
0
0
0
0
0
0
0
0.034591
0.169713
383
14
61
27.357143
0.830189
0
0
0
0
0
0.031332
0
0
0
0
0
0
1
0
false
0
0.2
0
0.9
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
0
0
1
0
0
2
65106635994d91a479c18b140e8932588b6e8457
2,385
py
Python
result/forms.py
Uqhs-1/uqhs
1c7199d8c23a9d9eb3f75b1e36633a145fd2cd40
[ "MIT" ]
3
2020-06-16T20:03:31.000Z
2021-01-17T20:45:51.000Z
result/forms.py
Uqhs-1/uqhs
1c7199d8c23a9d9eb3f75b1e36633a145fd2cd40
[ "MIT" ]
8
2020-02-08T09:04:08.000Z
2021-06-09T18:31:03.000Z
result/forms.py
Uqhs-1/uqhs
1c7199d8c23a9d9eb3f75b1e36633a145fd2cd40
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- """ Created on Wed Jan 23 08:25:37 2019 @author: AdeolaOlalekan """ from django import forms from django.contrib.auth.forms import UserCreationForm from django.contrib.auth.models import User from .models import BTUTOR, CNAME, Edit_User, QSUBJECT, Post class login_form(forms.Form): username = forms.CharField(max_length=18)#, help_text="Just type 'renew'") password1 = forms.CharField(widget=forms.PasswordInput)# def clean_data(self): data = self.cleaned_data['username'] data = self.cleaned_data['password1'] return data ############################################################################### class ProfileForm(forms.ModelForm): class Meta: model = Edit_User fields = ('title', 'first_name', 'last_name', 'bio', 'phone', 'city', 'country', 'organization', 'location', 'birth_date', 'department', 'photo',) exclude = ['user'] class SignUpForm(UserCreationForm): email = forms.EmailField(max_length=254, help_text='Required for a valid signup!') class Meta: model = User fields = ('username', 'email', 'password1', 'password2') def save(self, commit=True): user = super(SignUpForm, self).save(commit=False) user.email = self.cleaned_data['email'] user.password = self.cleaned_data['password1'] if commit: user.save() return user class subject_class_term_Form(forms.ModelForm): class Meta: model = BTUTOR fields = ('Class', 'subject',) class class_term(forms.ModelForm): class Meta: model = BTUTOR fields = ('Class', 'term', ) class PostForm(forms.ModelForm): class Meta: model = Post fields = ('Account_Username', 'subject', 'text') class a_student_form_new(forms.ModelForm): class Meta: model = QSUBJECT fields = ('student_name','test', 'agn','atd', 'exam','tutor',) class student_name(forms.ModelForm): class Meta: model = CNAME fields = ('last_name', 'first_name', 'gender', "birth_date",) class new_student_name(forms.Form): student_name = forms.CharField(help_text="enter student's surename to search.") def clean_renewal_date(self): data = self.cleaned_data['student_name'] return data #
29.8125
154
0.609224
267
2,385
5.307116
0.393258
0.04446
0.06916
0.097389
0.175018
0.063514
0.063514
0.063514
0
0
0
0.012575
0.233124
2,385
80
155
29.8125
0.762165
0.048218
0
0.207547
0
0
0.157556
0
0
0
0
0
0
1
0.056604
false
0.075472
0.075472
0
0.566038
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
651f360c505b719ccafc01d1fe50f1f24c9b71d7
117
py
Python
pype/modules/idle_manager/__init__.py
simonebarbieri/pype
a6dc83aa1300738749cbe8e5e2e6d2d1794e0289
[ "MIT" ]
null
null
null
pype/modules/idle_manager/__init__.py
simonebarbieri/pype
a6dc83aa1300738749cbe8e5e2e6d2d1794e0289
[ "MIT" ]
null
null
null
pype/modules/idle_manager/__init__.py
simonebarbieri/pype
a6dc83aa1300738749cbe8e5e2e6d2d1794e0289
[ "MIT" ]
null
null
null
from .idle_module import ( IdleManager, IIdleManager ) __all__ = ( "IdleManager", "IIdleManager" )
10.636364
26
0.632479
9
117
7.666667
0.777778
0.666667
0
0
0
0
0
0
0
0
0
0
0.264957
117
10
27
11.7
0.802326
0
0
0
0
0
0.196581
0
0
0
0
0
0
1
0
false
0
0.125
0
0.125
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
652012211d75f39757469a76ffbd1e2d590d912a
289
py
Python
server/src/tests/samples/typeConstraint3.py
higoshi/pyright
183c0ef56d2c010d28018149949cda1a40aa59b8
[ "MIT" ]
null
null
null
server/src/tests/samples/typeConstraint3.py
higoshi/pyright
183c0ef56d2c010d28018149949cda1a40aa59b8
[ "MIT" ]
null
null
null
server/src/tests/samples/typeConstraint3.py
higoshi/pyright
183c0ef56d2c010d28018149949cda1a40aa59b8
[ "MIT" ]
null
null
null
# This sample exercises the type analyzer's assert type constraint logic. from typing import Union def foo(a: Union[str, int]) -> int: if True: # This should generate an error because # a could be a str. return a assert isinstance(a, int) return a
19.266667
73
0.643599
43
289
4.325581
0.697674
0.075269
0
0
0
0
0
0
0
0
0
0
0.290657
289
14
74
20.642857
0.907317
0.439446
0
0.333333
1
0
0
0
0
0
0
0
0.166667
1
0.166667
false
0
0.166667
0
0.666667
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
2
6524869e78875d68bc7830017790dd24a2253209
738
py
Python
app/libpinanny/__init__.py
MelonSmasher/piNanny
2bc3a7b5eda83615e21518a2f36c3844b241d201
[ "MIT" ]
null
null
null
app/libpinanny/__init__.py
MelonSmasher/piNanny
2bc3a7b5eda83615e21518a2f36c3844b241d201
[ "MIT" ]
2
2021-03-10T05:28:36.000Z
2021-09-02T05:40:44.000Z
app/libpinanny/__init__.py
MelonSmasher/piNanny
2bc3a7b5eda83615e21518a2f36c3844b241d201
[ "MIT" ]
null
null
null
from subprocess import PIPE, Popen # Converts celsius temps to fahrenheit def c2f(celsius): return (9.0 / 5) * celsius + 32 # Gets the CPU temperature in degrees C def get_cpu_temperature(): process = Popen(['vcgencmd', 'measure_temp'], stdout=PIPE) output, _error = process.communicate() return float(str(str(output).split('=')[1]).split("'")[0]) def debugOutCFH(sensor, valueC, valueF, valueH): print('Debug Values [' + sensor + ']:') print('C: ' + str(valueC)) print('F: ' + str(valueF)) print('H: ' + str(valueH) + '%') print('') def debugOutCF(sensor, valueC, valueF): print('Debug Values [' + sensor + ']:') print('C: ' + str(valueC)) print('F: ' + str(valueF)) print('')
25.448276
62
0.609756
91
738
4.901099
0.527473
0.073991
0.080717
0.098655
0.255605
0.255605
0.255605
0.255605
0.255605
0.255605
0
0.013582
0.201897
738
28
63
26.357143
0.743633
0.100271
0
0.444444
0
0
0.1059
0
0
0
0
0
0
1
0.222222
false
0
0.055556
0.055556
0.388889
0.5
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
1
0
2
6526bd14e91e02ab2897caf04024aa618b204008
956
py
Python
automon/integrations/slack/config.py
TheShellLand/automonisaur
b5f304a44449b8664c93d8a8a3c3cf2d73aa0ce9
[ "MIT" ]
2
2021-09-15T18:35:44.000Z
2022-01-18T05:36:54.000Z
automon/integrations/slack/config.py
TheShellLand/automonisaur
b5f304a44449b8664c93d8a8a3c3cf2d73aa0ce9
[ "MIT" ]
16
2021-08-29T22:51:53.000Z
2022-03-09T16:08:19.000Z
automon/integrations/slack/config.py
TheShellLand/automonisaur
b5f304a44449b8664c93d8a8a3c3cf2d73aa0ce9
[ "MIT" ]
null
null
null
import os from automon.log import Logging log = Logging(name=__name__, level=Logging.ERROR) class ConfigSlack: slack_name = os.getenv('SLACK_USER') or '' slack_webhook = os.getenv('SLACK_WEBHOOK') or '' slack_proxy = os.getenv('SLACK_PROXY') or '' slack_token = os.getenv('SLACK_TOKEN') or '' SLACK_DEFAULT_CHANNEL = os.getenv('SLACK_DEFAULT_CHANNEL') or '' SLACK_INFO_CHANNEL = os.getenv('SLACK_INFO_CHANNEL') or '' SLACK_DEBUG_CHANNEL = os.getenv('SLACK_DEBUG_CHANNEL') or '' SLACK_ERROR_CHANNEL = os.getenv('SLACK_ERROR_CHANNEL') or '' SLACK_CRITICAL_CHANNEL = os.getenv('SLACK_CRITICAL_CHANNEL') or '' SLACK_WARN_CHANNEL = os.getenv('SLACK_WARN_CHANNEL') or '' SLACK_TEST_CHANNEL = os.getenv('SLACK_TEST_CHANNEL') or '' if not slack_token: log.warn(f'missing SLACK_TOKEN') def __init__(self, slack_name: str = ''): self.slack_name = os.getenv('SLACK_USER') or slack_name or ''
35.407407
70
0.707113
134
956
4.671642
0.246269
0.153355
0.249201
0.223642
0.105431
0.105431
0.105431
0.105431
0
0
0
0
0.167364
956
26
71
36.769231
0.786432
0
0
0
0
0
0.218619
0.044979
0
0
0
0
0
1
0.052632
false
0
0.105263
0
0.789474
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
652a2bec3a1bbb15dcd3f0465f2e3a5760856d24
182
py
Python
z2z_metadata/__init__.py
Mitchellpkt/z2z-metadata
261a694225efc21d65a9f3be69a9017bbc29864e
[ "MIT" ]
null
null
null
z2z_metadata/__init__.py
Mitchellpkt/z2z-metadata
261a694225efc21d65a9f3be69a9017bbc29864e
[ "MIT" ]
null
null
null
z2z_metadata/__init__.py
Mitchellpkt/z2z-metadata
261a694225efc21d65a9f3be69a9017bbc29864e
[ "MIT" ]
null
null
null
"""Top-level package for z2z Metadata analysis.""" __author__ = """Isthmus // Mitchell P. Krawiec-Thayer""" __email__ = 'project_z2z_metadata@mitchellpkt.com' __version__ = '0.0.1'
30.333333
56
0.730769
23
182
5.173913
0.869565
0.184874
0
0
0
0
0
0
0
0
0
0.030864
0.10989
182
5
57
36.4
0.703704
0.241758
0
0
0
0
0.590909
0.272727
0
0
0
0
0
1
0
false
0
0
0
0
0
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
653275e0a6bf64ffd7bef701a34270c76bd37631
1,854
py
Python
clisk/player/player.py
etano/clisk
70067eb98568a97d896ee486bae56b49c77bcb11
[ "MIT" ]
null
null
null
clisk/player/player.py
etano/clisk
70067eb98568a97d896ee486bae56b49c77bcb11
[ "MIT" ]
null
null
null
clisk/player/player.py
etano/clisk
70067eb98568a97d896ee486bae56b49c77bcb11
[ "MIT" ]
null
null
null
class Player(object): """Player class Attributes: name (str): Player name """ def __init__(self, name): """Initialize player Args: name (str): Player name """ self.name = name def place_troops(self, board, n_troops): """Place troops on territories Args: board (Gameboard): The gameboard n_troops (int): Number of new troops to deploy Returns: (dict(str, int)): Dictionary of territories with number of troops to be deployed """ raise NotImplementedError('place_troops not implemented') def do_attack(self, board): """Decide whether or not to continue attacking Args: board (Gameboard): The gameboard Returns: (bool): Whether or not to continue attacking """ raise NotImplementedError('do_attack not implemented') def attack(self, board): """Attack phase Args: board (Gameboard): The gameboard Returns: (str, str): from_territory, to_territory """ raise NotImplementedError('attack not implemented') def do_move_troops(self, board): """Decide whether or not to move troops Args: board (Gameboard): The gameboard Returns: (bool): Whether or not to move troops """ raise NotImplementedError('do_move_troops not implemented') def move_troops(self, board): """Troop movement phase Args: board (Gameboard): The gameboard Returns: (str, str, int): from_territory, to_territory, n_troops """ raise NotImplementedError('move_troops not implemented')
26.112676
95
0.553937
185
1,854
5.437838
0.264865
0.059642
0.089463
0.104374
0.345924
0.316103
0.262425
0.204771
0.204771
0.109344
0
0
0.364078
1,854
70
96
26.485714
0.853265
0.459008
0
0
0
0
0.205928
0
0
0
0
0
0
1
0.461538
false
0
0
0
0.538462
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
6532a25e13d94b833b61abb8bf5f04bc39b60efe
91
py
Python
bai03.py
trietto/python
b89b990fc509228445157465f6af3371c4b4d159
[ "Apache-2.0" ]
null
null
null
bai03.py
trietto/python
b89b990fc509228445157465f6af3371c4b4d159
[ "Apache-2.0" ]
null
null
null
bai03.py
trietto/python
b89b990fc509228445157465f6af3371c4b4d159
[ "Apache-2.0" ]
null
null
null
n=int(input("Nhap vao mot so:")) d=dict() for i in range(1, n+1): d[i]=i*i print(d)
18.2
32
0.549451
22
91
2.272727
0.681818
0.08
0
0
0
0
0
0
0
0
0
0.027778
0.208791
91
5
33
18.2
0.666667
0
0
0
0
0
0.173913
0
0
0
0
0
0
1
0
false
0
0
0
0
0.2
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
6536be01b7eb4b8a845b975aa35e3be000f854f3
1,182
py
Python
lib/googlecloudsdk/command_lib/filestore/operations/flags.py
bshaffer/google-cloud-sdk
f587382fd112f238c0d6d5ca3dab8f52d2b5c5f9
[ "Apache-2.0" ]
null
null
null
lib/googlecloudsdk/command_lib/filestore/operations/flags.py
bshaffer/google-cloud-sdk
f587382fd112f238c0d6d5ca3dab8f52d2b5c5f9
[ "Apache-2.0" ]
null
null
null
lib/googlecloudsdk/command_lib/filestore/operations/flags.py
bshaffer/google-cloud-sdk
f587382fd112f238c0d6d5ca3dab8f52d2b5c5f9
[ "Apache-2.0" ]
null
null
null
# -*- coding: utf-8 -*- # # Copyright 2017 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Flags and helpers for the Cloud Filestore operations commands.""" from __future__ import unicode_literals OPERATIONS_LIST_FORMAT = """\ table( name.basename():label=OPERATION_NAME, name.segment(3):label=LOCATION, metadata.verb:label=TYPE, metadata.target.basename(), done.yesno(yes='DONE', no='RUNNING'):label=STATUS, metadata.createTime.date():sort=1, duration(start=metadata.createTime,end=metadata.endTime,precision=0,calendar=false).slice(2:).join("").yesno(no="<1S"):label=DURATION )"""
40.758621
141
0.716582
163
1,182
5.147239
0.699387
0.071514
0.030989
0.038141
0
0
0
0
0
0
0
0.014242
0.168359
1,182
28
142
42.214286
0.839268
0.554146
0
0
0
0.090909
0.826087
0.664032
0
0
0
0
0
1
0
false
0
0.090909
0
0.090909
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
1
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
e8e431aaa0e0c0342df0906099d3bfe584c4dc40
262
py
Python
MUNDO 1/ex023.py
athavus/Curso-em-video-Python-3
a32be95adbccfcbe512a1ed30d3859141a230b5e
[ "MIT" ]
1
2020-11-12T14:03:32.000Z
2020-11-12T14:03:32.000Z
MUNDO 1/ex023.py
athavus/Curso-em-video-Python-3
a32be95adbccfcbe512a1ed30d3859141a230b5e
[ "MIT" ]
null
null
null
MUNDO 1/ex023.py
athavus/Curso-em-video-Python-3
a32be95adbccfcbe512a1ed30d3859141a230b5e
[ "MIT" ]
1
2021-01-05T22:18:46.000Z
2021-01-05T22:18:46.000Z
n1 = int(input('Digite um número entre 0 e 9999: ')) u = n1 // 1 % 10 d = n1 // 10 % 10 c = n1 // 100 % 10 m = n1 // 1000 % 10 print(f'Analisando o número {n1}') print(f'unidade: {u}') print(f'dezena: {d}') print(f'centena: {c}') print(f'milhar: {m}')
23.818182
53
0.549618
48
262
3
0.541667
0.208333
0
0
0
0
0
0
0
0
0
0.143564
0.229008
262
10
54
26.2
0.569307
0
0
0
0
0
0.40873
0
0
0
0
0
0
1
0
false
0
0
0
0
0.5
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
1
0
2
e8f09f4acc1e578e6bbb291e4f8a3a87b3a0b297
908
py
Python
chat/views.py
xiaoqiao99/chat
ca65ed25fbc277828390b890a50ecadf4675cfb4
[ "MIT" ]
2
2019-06-21T10:30:18.000Z
2019-07-12T07:46:25.000Z
chat/views.py
xiaoqiao99/chat
ca65ed25fbc277828390b890a50ecadf4675cfb4
[ "MIT" ]
8
2020-06-05T19:56:53.000Z
2022-03-11T23:41:44.000Z
chat/views.py
xiaoqiao99/chat
ca65ed25fbc277828390b890a50ecadf4675cfb4
[ "MIT" ]
3
2020-03-13T03:22:40.000Z
2020-07-03T03:03:02.000Z
from django.shortcuts import render # Create your views here. # chat/views.py from django.shortcuts import render from django.utils.safestring import mark_safe import json from chat.models import Room def index(request): # from channels.layers import get_channel_layer # from asgiref.sync import async_to_sync # channel_layer = get_channel_layer() # async_to_sync(channel_layer.group_send)( # "chat_lobby", # { # 'type': 'chat.message', # 'message': "6666666yyyyy66666666" # } # ) # r = Room.objects.filter(id=46).update(name="33333333") # 如果信号中使用post_save 此更新不会出发信号机制   r = Room() r.name = "xiao" r.label = "qq " r.save() return render(request, 'chat/index.html', {}) def room(request, room_name): return render(request, 'chat/room.html', { 'room_name_json': mark_safe(json.dumps(room_name)) })
27.515152
93
0.654185
115
908
5.008696
0.46087
0.083333
0.065972
0.086806
0.1875
0
0
0
0
0
0
0.035461
0.223568
908
33
94
27.515152
0.78156
0.429515
0
0.133333
0
0
0.099602
0
0
0
0
0
0
1
0.133333
false
0
0.333333
0.066667
0.6
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
1
0
0
2
e8fc72a77fdd416f9afae8ddad6132491cc5fabf
4,405
py
Python
c4/system/history.py
Brewgarten/c4-system-manager
6fdec33ced4b1cb32d82a24cd168447a899b7e10
[ "MIT" ]
null
null
null
c4/system/history.py
Brewgarten/c4-system-manager
6fdec33ced4b1cb32d82a24cd168447a899b7e10
[ "MIT" ]
1
2017-10-17T21:51:40.000Z
2017-10-17T21:51:40.000Z
c4/system/history.py
Brewgarten/c4-system-manager
6fdec33ced4b1cb32d82a24cd168447a899b7e10
[ "MIT" ]
null
null
null
""" Copyright (c) IBM 2015-2017. All Rights Reserved. Project name: c4-system-manager This project is licensed under the MIT License, see LICENSE """ from abc import ABCMeta, abstractmethod class DeviceHistory(object): """ Device manager history """ __metaclass__ = ABCMeta @abstractmethod def add(self, node, name, status, ttl=None): """ Add status for device manager with specified name on specified node :param node: node name :type node: str :param name: device manager name :type name: str :param status: status :type status: :class:`DeviceManagerStatus` :param ttl: time to live (in seconds), infinite by default :type ttl: int """ @abstractmethod def get(self, node, name, limit=None): """ Get status history for device manager with specified name on specified node :param node: node name :type node: str :param name: device manager name :type name: str :param limit: number of statuses to return :type limit: int :returns: list of history entries :rtype: [:class:`Entry`] """ @abstractmethod def getAll(self): """ Get status history for all device managers on all nodes :returns: list of history entries :rtype: [:class:`Entry`] """ @abstractmethod def getLatest(self, node, name): """ Get latest status for device manager with specified name on specified node :param node: node name :type node: str :param name: device manager name :type name: str :returns: history entry :rtype: :class:`Entry` """ @abstractmethod def remove(self, node=None, name=None): """ Remove status history for device managers with specified names on specified nodes. node and name: remove history for specific device on a specific node node and no name remove history for all devices on a specific node no node and name remove history for specific device on all nodes no node and no name remove history for all devices on all nodes :param node: node name :type node: str :param name: device manager name :type name: str """ class Entry(object): """ History entry with timestamp and status information :param timestamp: datetime instance :type timestamp: :class:`Datetime` :param status: status :type status: :class:`SystemManagerStatus` or :class:`DeviceManagerStatus` """ def __init__(self, timestamp, status): self.timestamp = timestamp self.status = status class NodeHistory(object): """ System manager history """ __metaclass__ = ABCMeta @abstractmethod def add(self, node, status, ttl=None): """ Add status for system manager with on specified node :param node: node name :type node: str :param status: status :type status: :class:`SystemManagerStatus` :param ttl: time to live (in seconds), infinite by default :type ttl: int """ @abstractmethod def get(self, node, limit=None): """ Get status history for system manager on specified node :param node: node name :type node: str :param limit: number of statuses to return :type limit: int :returns: list of history entries :rtype: [:class:`Entry`] """ @abstractmethod def getAll(self): """ Get status history for all system managers on all nodes :returns: list of history entries :rtype: [:class:`Entry`] """ @abstractmethod def getLatest(self, node): """ Get latest status for system manager on specified node :param node: node name :type node: str :returns: history entry :rtype: :class:`Entry` """ @abstractmethod def remove(self, node=None): """ Remove status history for system managers on specified nodes. node: remove history for specific node no node remove history for all nodes :param node: node name :type node: str """
26.065089
90
0.595687
506
4,405
5.162055
0.171937
0.036753
0.039816
0.052067
0.743492
0.725115
0.690276
0.642802
0.642802
0.548622
0
0.003031
0.325993
4,405
168
91
26.220238
0.876726
0.604994
0
0.482759
0
0
0
0
0
0
0
0
0
1
0.37931
false
0
0.034483
0
0.586207
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
0
0
0
2
330bcb8284fec7ff83c5b51b2973e481ae9b2a12
1,376
py
Python
app/main/models/utils.py
tmeftah/e-invoice
7cfe31e9391eb60ab3d06f0055bd2f1e9a524971
[ "MIT" ]
2
2019-06-10T19:30:06.000Z
2020-04-30T01:05:04.000Z
app/main/models/utils.py
tmeftah/e-invoice
7cfe31e9391eb60ab3d06f0055bd2f1e9a524971
[ "MIT" ]
null
null
null
app/main/models/utils.py
tmeftah/e-invoice
7cfe31e9391eb60ab3d06f0055bd2f1e9a524971
[ "MIT" ]
3
2019-01-23T21:37:29.000Z
2020-04-08T13:22:29.000Z
from datetime import datetime import sqlalchemy as sa from flask_sqlalchemy import Model from sqlalchemy import ForeignKey from sqlalchemy.ext.declarative import declared_attr from sqlalchemy.orm import relationship from app.main.extensions import db class BaseMixin(Model): def save_to_db(self): try: db.session.add(self) db.session.commit() except: db.session.rollback() raise def delete_from_db(self): try: db.session.delete(self) db.session.commit() except: db.session.rollback() raise class UserMixin(BaseMixin, Model): @declared_attr def createdAt(cls): return sa.Column(sa.DateTime, default=datetime.utcnow) @declared_attr def updateAt(cls): return sa.Column(sa.DateTime) @declared_attr def createdBy_id(cls): return sa.Column(sa.Integer, ForeignKey('users.id'), nullable=False) @declared_attr def updatedBy_id(cls): return sa.Column(sa.Integer, ForeignKey('users.id')) @declared_attr def createdBy(cls): return relationship( 'UserModel', foreign_keys=[cls.createdBy_id]) @declared_attr def updatedBy(cls): return relationship( 'UserModel', foreign_keys=[cls.updatedBy_id])
23.322034
62
0.634448
157
1,376
5.44586
0.324841
0.098246
0.105263
0.079532
0.423392
0.381287
0.318129
0.215205
0.215205
0.105263
0
0
0.277616
1,376
58
63
23.724138
0.860161
0
0
0.409091
0
0
0.024709
0
0
0
0
0
0
1
0.181818
false
0
0.159091
0.136364
0.522727
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
33119609fa28c4ed894cccea42375ff194c70e59
4,719
py
Python
mboxstats/mboxstats.py
ruettet/mailboxstatistics
ba1296ca441ab646fc92b9bcc5962a8ccf532f19
[ "Apache-2.0" ]
null
null
null
mboxstats/mboxstats.py
ruettet/mailboxstatistics
ba1296ca441ab646fc92b9bcc5962a8ccf532f19
[ "Apache-2.0" ]
null
null
null
mboxstats/mboxstats.py
ruettet/mailboxstatistics
ba1296ca441ab646fc92b9bcc5962a8ccf532f19
[ "Apache-2.0" ]
null
null
null
import codecs import locale from mailbox import mbox from re import sub from re import compile from re import IGNORECASE from datetime import datetime from collections import Counter class MailboxStatistics(object): def __init__(self): """ Generic MailboxStatistics object that contains the statistics calculations. """ self.mailbox = [] def get_number_of_mails(self): return len(self.mailbox) def __get_from_values(self): return [message['from'] for message in self.mailbox] def get_from_value_counts(self): """ :return: A Counter object with the frequency of all possible 'from' values. """ return Counter(self.__get_from_values()) def __get_to_values(self): return [message['to'] for message in self.mailbox] def get_to_value_counts(self): """ :return: A Counter object with the frequency of all possible 'to' value """ return Counter(self.__get_to_values()) def get_number_of_mails_per_hour(self): """ :return: A Counter object with the amount of mails received per hour. """ return Counter([message['sent'].strftime('%Y-%m-%d %H') for message in self.mailbox]) def get_number_of_mails_per_hour_of_day(self): """ :return: A Counter object with the total amount of mail per hour of the day [00 - 23]. """ return Counter([message['sent'].strftime('%H') for message in self.mailbox]) def get_number_of_mails_per_day(self): """ :return: A Counter object with the amount of mail per day. """ return Counter([message['sent'].strftime('%Y-%m-%d') for message in self.mailbox]) def get_number_of_mails_per_weekday(self): """ :return: A Counter object the amount of mails per week day [0 - 6]. """ return Counter([message['sent'].weekday() for message in self.mailbox]) def __get_subject_tokens(self): return [token for message in self.mailbox for token in message['subject'].split()] def get_subject_token_frequencies(self): """ :return: A Counter object with the frequencies of the (lowercased) tokens in the subject line. """ return Counter(self.__get_subject_tokens()) # TODO def get_subject_token_frequencies_by_from_values(self): # TODO def get_igraph(self): # TODO def get_igraph_edgelist(self): # TODO def filter_mailbox_on_to_values(self, to_values=[], operator='or', strict=True): # TODO def filter_mailbox_on_from_value(self, from_value=compile('', IGNORECASE)): class OutlookMailboxStatistics(MailboxStatistics): def __init__(self, path_to_mbox_file, mbox_file_encoding, mbox_file_datetime_locale, mbox_file_datetime_format): """ Parses the text file that results from saving (multiple) messages in MS Outlook as text. :param path_to_mbox_file: full path to mbox file :param mbox_file_encoding: encoding of mbox file, for MS Outlook, this is typically latin1 :param mbox_file_datetime_locale: locale to be used for parsing the datetime field :param mbox_file_datetime_format: format of the datetime string for parsing """ MailboxStatistics.__init__(self) with codecs.open(path_to_mbox_file, 'r', mbox_file_encoding) as mailbox_file: self.raw_messages = mailbox_file.read().split("From:\t") for raw_message in self.raw_messages: if len(raw_message.split('\n')) > 5: message = {'from': raw_message.split('\n')[0].strip()} to_line = compile('To:\t(.+?)\r\n').findall(raw_message) message['to'] = [sub('[\'"]', '', item).strip() for item in to_line[0].split(';')] if len(to_line) > 0 else [] locale.setlocale(locale.LC_ALL, mbox_file_datetime_locale) message['sent'] = datetime.strptime(compile('Sent:\t(.+?)\r\n').findall(raw_message)[0], mbox_file_datetime_format) locale.resetlocale() subject_line = compile('Subject:\t(.+?)\r\n').findall(raw_message) message['subject'] = sub('(re|fw):', '', subject_line[0].lower()) if len(subject_line) > 0 else 'NA' self.mailbox.append(message) # class GMailMailboxStatistics(MailboxStatistics): # def __init__(self, path_to_mbox_file): # """ Parses the mbox file that results from a gmail export. # :param path_to_mbox_file: full path to the downloaded mbox file # """ # MailboxStatistics.__init__(self) # self.mailbox = mbox(path_to_mbox_file)
43.293578
116
0.647171
618
4,719
4.68932
0.20712
0.05245
0.038647
0.046929
0.376121
0.291235
0.284334
0.204279
0.118357
0.091442
0
0.003922
0.243484
4,719
109
117
43.293578
0.807843
0.342022
0
0
0
0
0.049653
0
0
0
0
0.009174
0
1
0.254902
false
0
0.156863
0.078431
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
0
1
0
0
2
331f06145206acb198e0044dbd6333cd441dd2cf
1,073
py
Python
doc/programming/parts/python-columninfo.py
laigor/sqlrelay-non-english-fixes-
7803f862ddbf88bca078c50d621c64c22fc0a405
[ "PHP-3.01", "CC-BY-3.0" ]
16
2018-04-23T09:58:33.000Z
2022-01-31T13:40:20.000Z
doc/programming/parts/python-columninfo.py
laigor/sqlrelay-non-english-fixes-
7803f862ddbf88bca078c50d621c64c22fc0a405
[ "PHP-3.01", "CC-BY-3.0" ]
null
null
null
doc/programming/parts/python-columninfo.py
laigor/sqlrelay-non-english-fixes-
7803f862ddbf88bca078c50d621c64c22fc0a405
[ "PHP-3.01", "CC-BY-3.0" ]
4
2020-12-23T12:17:54.000Z
2022-01-04T20:46:34.000Z
from SQLRelay import PySQLRClient con=PySQLRClient.sqlrconnection('sqlrserver',9000,'/tmp/example.socket','user','password',0,1) cur=PySQLRClient.sqlrcursor(con) cur.sendQuery('select * from my_table') con.endSession() for i in range(0,cur.colCount()-1): print 'Name: ', cur.getColumnName(i) print 'Type: ', cur.getColumnType(i) print 'Length: ', cur.getColumnLength(i) print 'Precision: ', cur.getColumnPrecision(i) print 'Scale: ', cur.getColumnScale(i) print 'Longest Field: ', cur.getLongest(i) print 'Nullable: ', cur.getColumnIsNullable(i) print 'Primary Key: ', cur.getColumnIsPrimaryKey(i) print 'Unique: ', cur.getColumnIsUnique(i) print 'Part Of Key: ', cur.getColumnIsParyOfKey(i) print 'Unsigned: ', cur.getColumnIsUnsigned(i) print 'Zero Filled: ', cur.getColumnIsZeroFilled(i) print 'Binary: ', cur.getColumnIsBinary(i) print 'Auto Increment:', cur.getColumnIsAutoIncrement(i)
44.708333
94
0.629077
112
1,073
6.017857
0.544643
0.115727
0
0
0
0
0
0
0
0
0
0.009816
0.240447
1,073
23
95
46.652174
0.817178
0
0
0
0
0
0.254427
0
0
0
0
0
0
0
null
null
0.05
0.05
null
null
0.7
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
0
0
0
1
0
2
33257a0af8469e27f7a0ccf12276dbf023a6e9b0
276
py
Python
pythonx/lints/vim/vint.py
maralla/validator.vim
fd5ec0891cbd035bd572e74d684b8afd852b87bf
[ "MIT" ]
255
2016-09-08T12:12:26.000Z
2022-03-10T01:50:06.000Z
pythonx/lints/vim/vint.py
maralla/vim-fixup
fd5ec0891cbd035bd572e74d684b8afd852b87bf
[ "MIT" ]
56
2016-09-09T05:53:24.000Z
2020-11-11T16:02:05.000Z
pythonx/lints/vim/vint.py
maralla/vim-linter
fd5ec0891cbd035bd572e74d684b8afd852b87bf
[ "MIT" ]
23
2016-09-09T13:37:51.000Z
2019-04-08T22:31:24.000Z
# -*- coding: utf-8 -*- from validator import Validator class VimVint(Validator): __filetype__ = 'vim' checker = 'vint' args = '-w --no-color' regex = r""" .+?: (?P<lnum>\d+): (?P<col>\d+): \s(?P<text>.+)"""
17.25
31
0.434783
29
276
4
0.827586
0
0
0
0
0
0
0
0
0
0
0.005556
0.347826
276
15
32
18.4
0.638889
0.076087
0
0
0
0
0.462451
0
0
0
0
0
0
1
0
false
0
0.1
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
0
0
1
0
0
2
3335e848cff8038f4a309c43400a1a6a921170c6
985
py
Python
isomyr/tests/test_thing.py
dave-leblanc/isomyr
2eae8067687408ba48e0a88de97fbd4fe6d57848
[ "BSD-3-Clause" ]
null
null
null
isomyr/tests/test_thing.py
dave-leblanc/isomyr
2eae8067687408ba48e0a88de97fbd4fe6d57848
[ "BSD-3-Clause" ]
null
null
null
isomyr/tests/test_thing.py
dave-leblanc/isomyr
2eae8067687408ba48e0a88de97fbd4fe6d57848
[ "BSD-3-Clause" ]
null
null
null
from unittest import TestCase from isomyr.thing import Thing from isomyr.world.world import Scene class ThingOfThingsRemoveObjectTestCase(TestCase): def setUp(self): self.scene = Scene(0) self.scene.addObject(Thing(name="apple")) self.scene.addObject(Thing(name="orange")) self.scene.addObject(Thing()) def test_byName(self): self.assertEquals(len(self.scene.objectList), 3) result = self.scene.removeObject(name="apple") self.assertEquals(result, True) self.assertEquals(len(self.scene.objectList), 2) def test_byInstance(self): self.assertEquals(len(self.scene.objectList), 3) instance = self.scene.getObject("orange") result = self.scene.removeObject(instance=instance) self.assertEquals(result, True) self.assertEquals(len(self.scene.objectList), 2) def test_byNameWithNotFoundError(self): pass def test_withNoIndexError(self): pass
29.848485
59
0.684264
112
985
5.982143
0.303571
0.147761
0.113433
0.137313
0.423881
0.343284
0.343284
0.343284
0.214925
0.214925
0
0.006378
0.204061
985
32
60
30.78125
0.848214
0
0
0.333333
0
0
0.022335
0
0
0
0
0
0.25
1
0.208333
false
0.083333
0.125
0
0.375
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
33442932bed34ae8a7cfa58a82b7cd61d3e5042f
145
py
Python
tests/conftest.py
Anishmourya/flask-restx-api
6e64a22ce14dd97d69809c3b50cb5781918fd1d4
[ "MIT" ]
3
2020-04-01T15:10:59.000Z
2021-09-30T13:00:20.000Z
tests/conftest.py
Anishmourya/flask-restx-api
6e64a22ce14dd97d69809c3b50cb5781918fd1d4
[ "MIT" ]
null
null
null
tests/conftest.py
Anishmourya/flask-restx-api
6e64a22ce14dd97d69809c3b50cb5781918fd1d4
[ "MIT" ]
null
null
null
import pytest from app import create_app @pytest.fixture def client(): app = create_app() client = app.test_client() return client
14.5
30
0.703448
20
145
4.95
0.5
0.181818
0
0
0
0
0
0
0
0
0
0
0.213793
145
9
31
16.111111
0.868421
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
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
3353952224984b77381aeb9e737b1658da3774db
727
py
Python
src/bioregistry/export/cli.py
biopragmatics/bioregistry
1c994b97f5bfe7151e01edb8e6a26edbaa30f33c
[ "MIT" ]
17
2021-09-14T17:58:16.000Z
2022-03-11T06:22:11.000Z
src/bioregistry/export/cli.py
biopragmatics/bioregistry
1c994b97f5bfe7151e01edb8e6a26edbaa30f33c
[ "MIT" ]
148
2021-09-18T08:52:46.000Z
2022-03-23T15:57:35.000Z
src/bioregistry/export/cli.py
biopragmatics/bioregistry
1c994b97f5bfe7151e01edb8e6a26edbaa30f33c
[ "MIT" ]
9
2021-09-28T20:18:53.000Z
2022-03-14T17:23:35.000Z
# -*- coding: utf-8 -*- """Export the Bioregistry.""" import click @click.command() @click.pass_context def export(ctx: click.Context): """Export the Bioregistry.""" from .prefix_maps import generate_contexts from .rdf_export import export_rdf from .sssom_export import export_sssom from .tables_export import export_tables from .tsv_export import export_tsv from .warnings_export import export_warnings from .yaml_export import export_yaml ctx.invoke(export_warnings) ctx.invoke(export_rdf) ctx.invoke(export_tsv) ctx.invoke(export_yaml) ctx.invoke(export_sssom) ctx.invoke(export_tables) ctx.invoke(generate_contexts) if __name__ == "__main__": export()
23.451613
48
0.727648
95
727
5.252632
0.294737
0.126253
0.216433
0.076152
0.1002
0
0
0
0
0
0
0.001672
0.177442
727
30
49
24.233333
0.832776
0.096286
0
0
0
0
0.012384
0
0
0
0
0
0
1
0.05
false
0.05
0.4
0
0.45
0
0
0
0
null
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
1
0
0
0
0
2
3360e8ecae40c8b015c6b7e2a1cd267c16fb7712
502
py
Python
model/combination_file.py
dokzai/WholeFoodsFrugality
0239dca601353524af0e1b317def40cdd51e4ea3
[ "CC0-1.0" ]
42
2021-06-05T01:16:23.000Z
2021-07-05T02:51:54.000Z
model/combination_file.py
dokzai/WholeFoodsFrugality
0239dca601353524af0e1b317def40cdd51e4ea3
[ "CC0-1.0" ]
2
2021-06-05T19:29:06.000Z
2021-09-01T19:10:53.000Z
model/combination_file.py
dokzai/WholeFoodsFrugality
0239dca601353524af0e1b317def40cdd51e4ea3
[ "CC0-1.0" ]
6
2021-06-05T02:44:16.000Z
2021-08-06T14:54:59.000Z
import model from model import whole_foods_sale from model import aldis_au_sale from model import aldis_us_sale from model import aldis_uk_sale def go(inputs, store_name): if store_name == 'WholeFoods': final_df = whole_foods_sale.items_on_sale() elif store_name == 'Aldi AU': final_df = aldis_au_sale.items_on_sale() elif store_name == 'Aldi US': final_df = aldis_us_sale.items_on_sale() elif store_name == 'Aldi UK': final_df = aldis_uk_sale.items_on_sale() return final_df.to_html()
27.888889
45
0.7749
87
502
4.068966
0.298851
0.127119
0.169492
0.169492
0.474576
0.271186
0.271186
0.271186
0
0
0
0
0.139442
502
18
46
27.888889
0.819444
0
0
0
0
0
0.06163
0
0
0
0
0
0
1
0.066667
false
0
0.333333
0
0.466667
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
68272da9ef5f1c688a86d4dfd33eef8b07b524c3
2,447
py
Python
laceworksdk/api/run_reports.py
kiddinn/python-sdk
23a33313f97337fddea155bcb19c8d5270fc8013
[ "MIT" ]
10
2021-03-20T18:12:16.000Z
2022-02-14T21:33:23.000Z
laceworksdk/api/run_reports.py
kiddinn/python-sdk
23a33313f97337fddea155bcb19c8d5270fc8013
[ "MIT" ]
10
2021-02-22T23:31:32.000Z
2022-03-25T14:11:27.000Z
laceworksdk/api/run_reports.py
kiddinn/python-sdk
23a33313f97337fddea155bcb19c8d5270fc8013
[ "MIT" ]
7
2021-06-18T18:17:12.000Z
2022-03-25T13:52:14.000Z
""" Lacework Run Reports API wrapper. """ import logging logger = logging.getLogger(__name__) class RunReportsAPI(object): """ Lacework RunReports API. """ def __init__(self, session): """ Initializes the RunReportsAPI object. :param session: An instance of the HttpSession class :return RunReportsAPI object. """ super(RunReportsAPI, self).__init__() self._session = session def run_report(self, type, account_id): """ A method to initiate a compliance assessment. :param type: A string representing the type of compliance assessment to initiate. :param account_id: A string representing the account identifier for which to initiate a compliance assessment. :return response json """ logger.info(f"Initiating '{type}' compliance assessment in Lacework...") # Build the Run Report request URI api_uri = f"/api/v1/external/runReport/{type}/{account_id}" response = self._session.post(api_uri) return response.json() def aws(self, aws_account_id): """ A method to initiate a compliance assessment for an AWS account. :param aws_account_id: A string representing which AWS account to assess. :return response json """ return self.run_report("aws", aws_account_id) def azure(self, azure_tenant_id): """ A method to initiate a compliance assessment for an Azure tenant. :param azure_tenant_id: A string representing which Azure tenant to assess. :return response json """ return self.run_report("azure", azure_tenant_id) def gcp(self, gcp_project_id): """ A method to initiate a compliance assessment for a GCP project. :param gcp_project_id: A string representing which GCP project to assess. :return response json """ return self.run_report("gcp", gcp_project_id) def integration(self, integration_guid): """ A method to run a compliance report based on a Lacework integration GUID. :param integration_guid: A string representing the Lacework integration ID to query. :return response json """ return self.run_report("integration", integration_guid)
25.489583
118
0.624029
282
2,447
5.255319
0.234043
0.016194
0.076923
0.07085
0.339406
0.24224
0.24224
0.217274
0.217274
0.060729
0
0.000585
0.302002
2,447
95
119
25.757895
0.867096
0.470781
0
0
0
0
0.120388
0.04466
0
0
0
0
0
1
0.24
false
0
0.04
0
0.52
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
68306374b036197a8b5db541b5852c5594665fb4
291
py
Python
coursera/a_8_4_romeo.py
polde-live/learnpython
ff8ec96db1951d99797205d0bd491e542152a36f
[ "Unlicense" ]
null
null
null
coursera/a_8_4_romeo.py
polde-live/learnpython
ff8ec96db1951d99797205d0bd491e542152a36f
[ "Unlicense" ]
null
null
null
coursera/a_8_4_romeo.py
polde-live/learnpython
ff8ec96db1951d99797205d0bd491e542152a36f
[ "Unlicense" ]
null
null
null
# fname = raw_input("Enter file name: ") fname = "romeo.txt" fh = open(fname) lst = list() def add_to_list(words): for word in words: if word not in lst: lst.append(word) for line in fh: words = line.split() add_to_list(words) lst.sort() print lst
17.117647
40
0.597938
46
291
3.673913
0.565217
0.059172
0.106509
0.16568
0
0
0
0
0
0
0
0
0.281787
291
17
41
17.117647
0.808612
0.130584
0
0
0
0
0.035714
0
0
0
0
0
0
0
null
null
0
0
null
null
0.083333
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
1
0
0
0
0
0
0
0
0
2
6831702b54dbaea7d1289e2c3040f25037a1de8b
262
py
Python
third_party/pdfium/build/gyp_pdfium.py
satorumpen/node-pdfium-native
90e5bf8bc69c80620f9f4231ebf8e39ef1178b8c
[ "BSD-2-Clause" ]
303
2015-03-13T08:31:24.000Z
2022-03-21T10:06:45.000Z
third_party/pdfium/build/gyp_pdfium.py
satorumpen/node-pdfium-native
90e5bf8bc69c80620f9f4231ebf8e39ef1178b8c
[ "BSD-2-Clause" ]
15
2015-04-03T02:33:53.000Z
2020-01-28T10:42:29.000Z
third_party/pdfium/build/gyp_pdfium.py
satorumpen/node-pdfium-native
90e5bf8bc69c80620f9f4231ebf8e39ef1178b8c
[ "BSD-2-Clause" ]
100
2015-03-13T08:28:56.000Z
2022-02-18T03:19:39.000Z
# Copyright 2014 PDFium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import os path = os.path.abspath(os.path.split(__file__)[0]) execfile(os.path.join(path, 'gyp_pdfium'))
29.111111
72
0.751908
45
262
4.266667
0.777778
0.125
0
0
0
0
0
0
0
0
0
0.022321
0.145038
262
8
73
32.75
0.834821
0.568702
0
0
0
0
0.091743
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
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
6833573a8789e8696ad0b078fc32733ac35d4da7
3,005
py
Python
tests/test_inlinequeryresultgame.py
ehsanbarkhordar/botcup
4e45c3df2dceb8afe3833c0e89813fa9493295ed
[ "MIT" ]
1
2019-10-22T03:46:17.000Z
2019-10-22T03:46:17.000Z
python-telegram-bot/tests/test_inlinequeryresultgame.py
shyguy-ry/paddingCheckBot
d0a60cc2f397b9b8e4d60bdea699a94beaff2ea1
[ "Apache-2.0" ]
null
null
null
python-telegram-bot/tests/test_inlinequeryresultgame.py
shyguy-ry/paddingCheckBot
d0a60cc2f397b9b8e4d60bdea699a94beaff2ea1
[ "Apache-2.0" ]
null
null
null
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2018 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Lesser Public License for more details. # # You should have received a copy of the GNU Lesser Public License # along with this program. If not, see [http://www.gnu.org/licenses/]. import pytest from telegram import (InlineKeyboardButton, InlineQueryResultGame, InlineQueryResultVoice, InlineKeyboardMarkup) @pytest.fixture(scope='class') def inline_query_result_game(): return InlineQueryResultGame(TestInlineQueryResultGame.id, TestInlineQueryResultGame.game_short_name, reply_markup=TestInlineQueryResultGame.reply_markup) class TestInlineQueryResultGame(object): id = 'id' type = 'game' game_short_name = 'game short name' reply_markup = InlineKeyboardMarkup([[InlineKeyboardButton('reply_markup')]]) def test_expected_values(self, inline_query_result_game): assert inline_query_result_game.type == self.type assert inline_query_result_game.id == self.id assert inline_query_result_game.game_short_name == self.game_short_name assert (inline_query_result_game.reply_markup.to_dict() == self.reply_markup.to_dict()) def test_to_dict(self, inline_query_result_game): inline_query_result_game_dict = inline_query_result_game.to_dict() assert isinstance(inline_query_result_game_dict, dict) assert inline_query_result_game_dict['type'] == inline_query_result_game.type assert inline_query_result_game_dict['id'] == inline_query_result_game.id assert (inline_query_result_game_dict['game_short_name'] == inline_query_result_game.game_short_name) assert (inline_query_result_game_dict['reply_markup'] == inline_query_result_game.reply_markup.to_dict()) def test_equality(self): a = InlineQueryResultGame(self.id, self.game_short_name) b = InlineQueryResultGame(self.id, self.game_short_name) c = InlineQueryResultGame(self.id, '') d = InlineQueryResultGame('', self.game_short_name) e = InlineQueryResultVoice(self.id, '', '') assert a == b assert hash(a) == hash(b) assert a is not b assert a == c assert hash(a) == hash(c) assert a != d assert hash(a) != hash(d) assert a != e assert hash(a) != hash(e)
39.539474
85
0.702163
389
3,005
5.179949
0.311054
0.098263
0.151861
0.187593
0.373697
0.25062
0.137965
0.066998
0
0
0
0.003822
0.216306
3,005
75
86
40.066667
0.851805
0.257238
0
0
0
0
0.032069
0
0
0
0
0
0.418605
1
0.093023
false
0
0.046512
0.023256
0.27907
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
683ea3da0b0b99dd76dd80bf6093b1dfbb0b984c
8,145
py
Python
lowendspirit/cloudflareAPI.py
boxcontrol/lowendspirit
d6ca41d14c1a974794c483d3baf885f1f3a40baf
[ "MIT" ]
3
2017-04-25T20:00:35.000Z
2021-12-03T01:28:38.000Z
lowendspirit/cloudflareAPI.py
boxcontrol/lowendspirit
d6ca41d14c1a974794c483d3baf885f1f3a40baf
[ "MIT" ]
null
null
null
lowendspirit/cloudflareAPI.py
boxcontrol/lowendspirit
d6ca41d14c1a974794c483d3baf885f1f3a40baf
[ "MIT" ]
2
2020-05-14T23:07:47.000Z
2022-01-08T16:49:05.000Z
import requests from requests.auth import HTTPBasicAuth import json import pprint class Cloudflare_Enduser_API: def __init__(self, cf_token, cf_email): self.cf_token = cf_token self.cf_email = cf_email self.headers = { 'Content-Type': 'application/json', 'X-Auth-Key': self.cf_token, 'X-Auth-Email': self.cf_email } def cfQuery(self, domain_id='', endpoint='', data={}): """ Main GET query function :param domain_id: ID of domain to query :param endpoint: user, zone, etc... :return: result cloudflare response """ if not domain_id and not endpoint: #print('domain id and endpoint not set') return requests.get(api_endpoint + '/zones' + domain_id + endpoint, headers=self.headers) elif domain_id and endpoint: return requests.get(api_endpoint + '/zones/' + domain_id + '/' + endpoint, headers=self.headers) elif endpoint: return requests.get(api_endpoint + '/' + endpoint, headers=self.headers) def cfQuery_patch(self, data, endpoint): """ Main PATCH query function :param domain_id: ID of domain to query :param endpoint: user, zone, etc... :param data: data to be patched :return: result cloudflare response """ auth = HTTPBasicAuth(self.cf_email, self.cf_token) return requests.patch(api_endpoint + endpoint, data=json.dumps(data), auth=auth, headers=self.headers) def cfQuery_post(self, data, endpoint): """ Main POST query function :param data: data to be posted :return: cloudflare response """ return requests.post(api_endpoint + endpoint, data=json.dumps(data), headers=self.headers) def cfQuery_delete(self, id, endpoint): return requests.delete(api_endpoint + endpoint + id, headers=self.headers) def cfQuery_put(self, data, endpoint): """ Main POST query function :param data: data to be posted :return: cloudflare response """ return requests.put(api_endpoint + endpoint, data=json.dumps(data), headers=self.headers) def pp_print_of(self, some_input): """ Preaty print the output :param some_input: anything it can be a function too :return: function output with pprint """ pp = pprint.PrettyPrinter(indent=4) return pp.pprint(some_input) def list_all(self): """ Get all data associated with cloudflare user :return: all data for the user account """ r = self.cfQuery().json() pp = pprint.PrettyPrinter(indent=4) return pp.pprint(r) def list_domain_ids(self): """ lists domain ID/'s :return: get list of all domain's and id's associated with cloudflare account """ r = self.cfQuery().json() records = [] for domain in r.get('result'): domain_name = domain.get('name') domain_id = domain.get('id') records.append((domain_name, domain_id)) return dict(records) def get_record(self, id): """ get dns records for given domain id :param id: you need to know the domain id that can be found through list_domain_ids function :return: return list of all dns records associated with domain """ domains = self.list_domain_ids() endpoint = 'dns_records' # endpoint of the query for CloudFlare API v4 if str(id) in domains.values(): r = self.cfQuery(domain_id=id, endpoint=endpoint) return r.json().get('result')[0].get('content') elif str(id) not in domains.values(): return ''.join('There is no domain with id: ' + str(id) + "\nlist od available domain id's is:\n" + json.dumps(domains)) def get_user(self): """ Get user info :return: return user info """ return self.cfQuery(endpoint='user').json() def patch_user(self, data): """ Update your user profile :param data: dictionary of data to be changed, :return: PATCH request to update user profile """ return self.cfQuery_patch(endpoint='/user', data=data) def get_user_billing_profile(self, x): """ User Billing Profile :param x: cloudflare app endpoint (profile, history) :return: current billing profile """ return self.cfQuery(endpoint='user/billing/' + x).json() def get_app_subscriptions(self, x=None): """ List all of your app subscriptions :param x: optional parameter to show info for app :return: list """ if x: return self.cfQuery(endpoint='user/billing/subscriptions/apps' + '/' + x).json() return self.cfQuery(endpoint='user/billing/subscriptions/apps').json() ######## FOR NOW WILL LEAVE OUT REST OF PAYED API CALLES def get_firewall_rules(self): """ List firewall access rules :param x: optional parameter to show info for app :return: list """ return self.cfQuery(endpoint='/user/firewall/access_rules/rules').json() def set_access_rule(self, data): return self.cfQuery_post(data, endpoint='/user/firewall/access_rules/rules').json() def update_access_rule(self, data): return self.cfQuery_patch(data, endpoint='/user/firewall/access_rules/rules').json() def del_access_rule(self, id): return self.cfQuery_delete(id, endpoint='/user/firewall/access_rules/rules/').json() ################################################################ ########## Domain related def add_new_zone(self, data): #return self.cfQuery_post(data, endpoint='/zones') pass def get_zone_details(self, id): return self.cfQuery(domain_id=id).json() ################################################################ ############## DNS Record def create_dns_record(self, id, data): return self.cfQuery_post(data, endpoint='/zones/' + id + '/dns_records').json() def get_dns_records(self, id): endpoint = '/dns_records' return self.cfQuery(domain_id=id, endpoint=endpoint).json() def get_dns_record_details(self, id, record_id): endpoint = '/dns_records/' + record_id return self.cfQuery(domain_id=id, endpoint=endpoint).json() def update_dns_record(self, data): endpoint = '/zones/' + data.get('zone_id') + '/dns_records/' + data.get('id') return self.cfQuery_put(data, endpoint=endpoint).json() def del_dns_record(self, zone_id, domain_id): endpoint = '/zones/' + zone_id + '/dns_records/' return self.cfQuery_delete(id=domain_id, endpoint=endpoint).json() ################################################################# ################## Analytics def get_zone_analytics(self, zone_id): endpoint = 'analytics/dashboard' return self.cfQuery(domain_id=zone_id, endpoint=endpoint).json() ################################################################## ################## Zone Firewall rules def get_zone_firewall_rules(self, zone_id): endpoint = 'firewall/access_rules/rules' return self.cfQuery(domain_id=zone_id, endpoint=endpoint).json() def create_zone_firewall_rule(self, zone_id, data): endpoint = '/zones/' + zone_id + '/firewall/access_rules/rules' return self.cfQuery_post(data=data, endpoint=endpoint).json() def update_zone_firewall_rule(self, zone_id, data): endpoint = '/zones/' + zone_id + '/firewall/access_rules/rules' return self.cfQuery_patch(data=data, endpoint=endpoint) def del_zone_firewall_rule(self, zone_id, data): endpoint = '/zones/' + zone_id + '/firewall/access_rules/rules' #return self.cfQuery_delete(id=data.get(id), endpoint=endpoint) pass
35.881057
108
0.59558
977
8,145
4.818833
0.14739
0.056075
0.075828
0.040782
0.490229
0.402082
0.385089
0.339847
0.265506
0.24554
0
0.000663
0.259177
8,145
226
109
36.039823
0.779582
0.210681
0
0.122642
0
0
0.112404
0.05477
0.009434
0
0
0
0
1
0.283019
false
0.018868
0.037736
0.056604
0.622642
0.056604
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
683fdfc38c6be9c97c19d59c1851c1bf1394efb9
1,912
py
Python
src/images/migrations/0004_auto_20200713_1943.py
thesus/bokstaever
e0a5e2614dd222ccd56a8945aba4fd28de85dd31
[ "MIT" ]
null
null
null
src/images/migrations/0004_auto_20200713_1943.py
thesus/bokstaever
e0a5e2614dd222ccd56a8945aba4fd28de85dd31
[ "MIT" ]
7
2019-11-18T16:11:01.000Z
2019-11-18T16:11:04.000Z
src/images/migrations/0004_auto_20200713_1943.py
thesus/bokstaever
e0a5e2614dd222ccd56a8945aba4fd28de85dd31
[ "MIT" ]
null
null
null
# Generated by Django 3.0.8 on 2020-07-13 19:43 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ("images", "0003_image_creation_date"), ] operations = [ migrations.AddField( model_name="image", name="feed", field=models.BooleanField(default=False, verbose_name="In feed"), ), migrations.AlterField( model_name="image", name="creation_date", field=models.DateTimeField(auto_now_add=True, verbose_name="Creation date"), ), migrations.AlterField( model_name="image", name="files", field=models.ManyToManyField(to="images.ImageFile", verbose_name="Files"), ), migrations.AlterField( model_name="image", name="thumbnail", field=models.ForeignKey( blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name="container", to="images.ImageFile", verbose_name="Thumbnail", ), ), migrations.AlterField( model_name="image", name="title", field=models.CharField(max_length=200, verbose_name="Title"), ), migrations.AlterField( model_name="imagefile", name="height", field=models.IntegerField(verbose_name="Height"), ), migrations.AlterField( model_name="imagefile", name="image_file", field=models.FileField(upload_to="", verbose_name="Image file"), ), migrations.AlterField( model_name="imagefile", name="width", field=models.IntegerField(verbose_name="Width"), ), ]
30.83871
88
0.550732
174
1,912
5.896552
0.37931
0.070175
0.170565
0.197856
0.391813
0.270955
0
0
0
0
0
0.017228
0.332113
1,912
61
89
31.344262
0.786218
0.023536
0
0.436364
1
0
0.128686
0.012869
0
0
0
0
0
1
0
false
0
0.036364
0
0.090909
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
685bdb02c954b53c73259dab606713b94ba02c39
330
py
Python
exec.py
developerHaneum/listBug
d3828813b36a533aef93ac691eeafb08a62a03c0
[ "MIT" ]
2
2021-07-07T06:38:05.000Z
2021-07-07T07:07:35.000Z
exec.py
developerHaneum/listBug
d3828813b36a533aef93ac691eeafb08a62a03c0
[ "MIT" ]
null
null
null
exec.py
developerHaneum/listBug
d3828813b36a533aef93ac691eeafb08a62a03c0
[ "MIT" ]
1
2021-07-07T06:38:06.000Z
2021-07-07T06:38:06.000Z
from clint.textui import * def Write(): i = 0 while True: i += 1 text = input(colored.cyan("%d: "%i)) if text == "q": sys.exit(0) def Print(): print(colored.cyan("-- Bug list --")) print(colored.cyan("-- ") + colored.red("<q:quit>") + colored.cyan(" --")) Write() Print()
22
78
0.490909
42
330
3.857143
0.595238
0.271605
0.197531
0
0
0
0
0
0
0
0
0.012821
0.290909
330
14
79
23.571429
0.679487
0
0
0
0
0
0.1
0
0
0
0
0
0
1
0.153846
false
0
0.076923
0
0.230769
0.153846
0
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
6865502dfb12453a7c664da7a679fbf4159aa717
477
py
Python
src/features/test_outlier_correction.py
KennedyMurphy/elomerchant
b6561de4e13a0bcfcda72bb99cec722a58e8f09e
[ "FTL" ]
null
null
null
src/features/test_outlier_correction.py
KennedyMurphy/elomerchant
b6561de4e13a0bcfcda72bb99cec722a58e8f09e
[ "FTL" ]
12
2019-12-26T17:02:54.000Z
2022-03-21T22:16:55.000Z
src/features/test_outlier_correction.py
KennedyMurphy/elomerchant
b6561de4e13a0bcfcda72bb99cec722a58e8f09e
[ "FTL" ]
null
null
null
import unittest import pandas as pd import numpy as np import src.features.outlier_correction as oc class TestFlagNormalOutliers(unittest.TestCase): def setUp(self): self.series = pd.Series(np.random.normal(0, 0.1, 1000)) self.series.loc[500] = -5 self.series.loc[42] = 5 def test_flag(self): outliers = oc.flag_normal_outliers(self.series, 5) self.assertTrue(outliers.loc[500]) self.assertTrue(outliers.loc[42])
26.5
63
0.677149
67
477
4.761194
0.477612
0.125392
0.081505
0.15674
0
0
0
0
0
0
0
0.053191
0.21174
477
18
64
26.5
0.795213
0
0
0
0
0
0
0
0
0
0
0
0.153846
1
0.153846
false
0
0.307692
0
0.538462
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
68725e7d29c539b971a9d4373987ad3774e42e53
1,950
py
Python
testAppium/conf/getStartActivityConfig.py
moulage/appium-android
082e4018673fecd260552d758f8a8ba154838b9a
[ "Apache-2.0" ]
null
null
null
testAppium/conf/getStartActivityConfig.py
moulage/appium-android
082e4018673fecd260552d758f8a8ba154838b9a
[ "Apache-2.0" ]
null
null
null
testAppium/conf/getStartActivityConfig.py
moulage/appium-android
082e4018673fecd260552d758f8a8ba154838b9a
[ "Apache-2.0" ]
null
null
null
# !/usr/bin/env python # -*- coding = utf-8 -*- # @Author:wanghui # @Time: # @File:getStartActivityConfig.py import configparser import os BASE_DIR = os.path.dirname(os.path.abspath(__file__)) class GetStartActivityConfig(object): def __init__(self): self.config = configparser.ConfigParser() self.read_config() def read_config(self): """读取配置文件""" try: self.config.read(os.path.join(BASE_DIR, '')) except Exception as e: print(f'配置文件不正确: ', e) return None def get_set_up(self): """获取setUp的信息""" return self.config.items('SETUP') def get_tear_down(self): """获取setUp的信息""" return self.config.items('TEARDOWN') def get_sections(self): """ 获取所有的section """ return self.config.sections() def get_option(self, section): """获取当前section下的所有options""" return self.config.options(section) def get_section_items(self, section): """获取当前section下的所有键值对""" return self.config.items(section) def get_section_password(self, section, option): """获取当前option对应的值""" return self.config.get(section, option) def check_config(self, *arg): """检查配置文件信息是否正确""" try: self.read_config() if len(arg) == 1: # 判断是否有section return self.config.has_section(arg[0]) elif len(arg) == 3: # 判断section下 option是否正确 if self.config[arg[0]][arg[1]] == arg[2]: return True else: return False else: return False except Exception as e: return False def main(): config = GetStartActivityConfig() print(config.get_set_up()) # print(config.get_section_items('360')) # print(config.get_section_password('360', 'platformVersion')) if __name__ == '__main__': main()
25
66
0.578462
208
1,950
5.235577
0.379808
0.091827
0.102847
0.057851
0.064279
0.064279
0
0
0
0
0
0.009441
0.293846
1,950
77
67
25.324675
0.781409
0.177949
0
0.25
0
0
0.019317
0
0
0
0
0
0
1
0.227273
false
0.022727
0.045455
0
0.568182
0.045455
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
687be2e6d6e71a7b227db867acdd0430e68a8454
1,977
py
Python
testing/composite.py
aheadley/pynemap
f2aa373e7c43755ce73c0a60110b609018cd2dcb
[ "MIT" ]
6
2015-10-15T08:28:19.000Z
2021-11-17T23:02:02.000Z
testing/composite.py
aheadley/pynemap
f2aa373e7c43755ce73c0a60110b609018cd2dcb
[ "MIT" ]
null
null
null
testing/composite.py
aheadley/pynemap
f2aa373e7c43755ce73c0a60110b609018cd2dcb
[ "MIT" ]
null
null
null
#!/usr/bin/python import numpy class Color(object): lower_bound = 0 upper_bound = 255 def __init__(self, r, g, b, a): self.r = r self.g = g self.b = b self.a = a def __str__(self): return '(%s, %s, %s, %s)' % (self.r, self.g, self.b, self.a) def composite_pixels(src, dest): new_color = Color(0,0,0,0) new_color.r = src.a * src.r * dest.a + src.r * (1 - dest.a) + dest.r * dest.a * (1 - src.a) new_color.g = src.a * src.g * dest.a + src.g * (1 - dest.a) + dest.g * dest.a * (1 - src.a) new_color.b = src.a * src.b * dest.a + src.b * (1 - dest.a) + dest.b * dest.a * (1 - src.a) new_color.a = src.a * dest.a + src.a * (1 - dest.a) + dest.a * (1 - src.a) return new_color def simple_composite_pixels(src, dest): return Color( (src.r * src.a)/255 + ((dest.r * dest.a) * (255 - src.a))/255**2, (src.g * src.a)/255 + ((dest.g * dest.a) * (255 - src.a))/255**2, (src.b * src.a)/255 + ((dest.b * dest.a) * (255 - src.a))/255**2, src.a + dest.a - (src.a * dest.a)/255, ) def overlay_pixel(src, dest): a = numpy.array([ (src[0] * src[3]) / 255 + ((dest[0] * dest[3]) * (255 - src[3])) / 255 ** 2, (src[1] * src[3]) / 255 + ((dest[1] * dest[3]) * (255 - src[3])) / 255 ** 2, (src[2] * src[3]) / 255 + ((dest[2] * dest[3]) * (255 - src[3])) / 255 ** 2, src[3] + dest[3] - (src[3] * dest[3]) / 255, ], dtype=numpy.uint8) print [ (src[0] * src[3]) / 255 + ((dest[0] * dest[3]) * (255 - src[3])) / 255 ** 2, (src[1] * src[3]) / 255 + ((dest[1] * dest[3]) * (255 - src[3])) / 255 ** 2, (src[2] * src[3]) / 255 + ((dest[2] * dest[3]) * (255 - src[3])) / 255 ** 2, src[3] + dest[3] - (src[3] * dest[3]) / 255, ] print src, dest, a return a if __name__ == '__main__': a = (120,120,120,255) b = (117,176,73,255) c = (134,96,67,255) d = (38,92,255,100) e = (0,0,0,0) print overlay_pixel(a,e) print (a[0] * a[3]) / 255 + ((e[0] * e[3]) * (255 - a[3])) / 255 ** 2
35.303571
92
0.494689
371
1,977
2.557951
0.145553
0.096944
0.088514
0.069547
0.404636
0.387777
0.363541
0.306639
0.246575
0.246575
0
0.144869
0.245827
1,977
56
93
35.303571
0.491616
0.008093
0
0.166667
0
0
0.012239
0
0
0
0
0
0
0
null
null
0
0.020833
null
null
0.083333
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
null
0
0
0
0
1
0
0
0
0
0
0
0
0
2
687e76240c6372225f7e38483f2cc12aea5247cb
611
py
Python
autocomplete/survey.py
converj/reasonSurvey
dd40784da4b07cfeb9fd873bab820d627cb026c1
[ "Apache-2.0" ]
null
null
null
autocomplete/survey.py
converj/reasonSurvey
dd40784da4b07cfeb9fd873bab820d627cb026c1
[ "Apache-2.0" ]
null
null
null
autocomplete/survey.py
converj/reasonSurvey
dd40784da4b07cfeb9fd873bab820d627cb026c1
[ "Apache-2.0" ]
null
null
null
# Import external modules. from google.appengine.ext import ndb import logging # Import local modules. from configAutocomplete import const as conf from constants import Constants class Survey(ndb.Model): surveyId = ndb.StringProperty() # Primary key title = ndb.StringProperty() introduction = ndb.StringProperty() creator = ndb.StringProperty() allowEdit = ndb.BooleanProperty() freezeUserInput = ndb.BooleanProperty( default=False ) hideReasons = ndb.BooleanProperty( default=False ) # Experimental option questionIds = ndb.StringProperty( repeated=True ) # Ordered
27.772727
77
0.747954
63
611
7.253968
0.587302
0.185996
0.109409
0.131291
0
0
0
0
0
0
0
0
0.173486
611
21
78
29.095238
0.904951
0.140753
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.307692
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
688122f978cd09ce576380b1318b3268f2968ae6
271
py
Python
python/cuspatial/cuspatial/utils/traj_utils.py
kkraus14/cuspatial
efe4c6de76c7e4f4888fb27425f3cfb42493a5ac
[ "Apache-2.0" ]
2
2020-01-30T15:10:05.000Z
2020-07-13T04:16:42.000Z
python/cuspatial/cuspatial/utils/traj_utils.py
kkraus14/cuspatial
efe4c6de76c7e4f4888fb27425f3cfb42493a5ac
[ "Apache-2.0" ]
null
null
null
python/cuspatial/cuspatial/utils/traj_utils.py
kkraus14/cuspatial
efe4c6de76c7e4f4888fb27425f3cfb42493a5ac
[ "Apache-2.0" ]
1
2021-02-22T08:31:00.000Z
2021-02-22T08:31:00.000Z
def get_ts_struct(ts): y=ts&0x3f ts=ts>>6 m=ts&0xf ts=ts>>4 d=ts&0x1f ts=ts>>5 hh=ts&0x1f ts=ts>>5 mm=ts&0x3f ts=ts>>6 ss=ts&0x3f ts=ts>>6 wd=ts&0x8 ts=ts>>3 yd=ts&0x1ff ts=ts>>9 ms=ts&0x3ff ts=ts>>10 pid=ts&0x3ff return y,m,d,hh,mm,ss,wd,yd,ms,pid
11.291667
35
0.616236
73
271
2.260274
0.369863
0.218182
0.145455
0.181818
0.333333
0
0
0
0
0
0
0.128319
0.166052
271
23
36
11.782609
0.60177
0
0
0.238095
0
0
0
0
0
0
0.151852
0
0
1
0.047619
false
0
0
0
0.095238
0
0
0
0
null
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
68855b61bab7f85695a5b52312067872e87f33fd
295
py
Python
tests/basics/builtin_sorted.py
84KaliPleXon3/micropython-esp32
a64dc82742749cf4a4bbe5688dde05122fb38f56
[ "MIT" ]
1
2020-04-24T06:09:44.000Z
2020-04-24T06:09:44.000Z
tests/basics/builtin_sorted.py
84KaliPleXon3/micropython-esp32
a64dc82742749cf4a4bbe5688dde05122fb38f56
[ "MIT" ]
null
null
null
tests/basics/builtin_sorted.py
84KaliPleXon3/micropython-esp32
a64dc82742749cf4a4bbe5688dde05122fb38f56
[ "MIT" ]
null
null
null
# test builtin sorted try: sorted set except: import sys print("SKIP") sys.exit() print(sorted(set(range(100)))) print(sorted(set(range(100)), key=lambda x: x + 100*(x % 2))) # need to use keyword argument try: sorted([], None) except TypeError: print("TypeError")
16.388889
61
0.630508
42
295
4.428571
0.571429
0.145161
0.150538
0.204301
0.236559
0
0
0
0
0
0
0.043103
0.213559
295
17
62
17.352941
0.758621
0.162712
0
0.153846
0
0
0.053279
0
0
0
0
0
0
1
0
true
0
0.076923
0
0.076923
0.307692
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
1
0
0
0
0
0
0
2
6885709e154f6ae3d0952842e393c4c290d87e3b
643
py
Python
addons/mendeley/tests/test_serializer.py
gaybro8777/osf.io
30408511510a40bc393565817b343ef5fd76ab14
[ "Apache-2.0" ]
628
2015-01-15T04:33:22.000Z
2022-03-30T06:40:10.000Z
addons/mendeley/tests/test_serializer.py
gaybro8777/osf.io
30408511510a40bc393565817b343ef5fd76ab14
[ "Apache-2.0" ]
4,712
2015-01-02T01:41:53.000Z
2022-03-30T14:18:40.000Z
addons/mendeley/tests/test_serializer.py
Johnetordoff/osf.io
de10bf249c46cede04c78f7e6f7e352c69e6e6b5
[ "Apache-2.0" ]
371
2015-01-12T16:14:08.000Z
2022-03-31T18:58:29.000Z
# -*- coding: utf-8 -*- """Serializer tests for the Mendeley addon.""" import pytest from addons.base.tests.serializers import CitationAddonSerializerTestSuiteMixin from addons.base.tests.utils import MockFolder from addons.mendeley.tests.factories import MendeleyAccountFactory from addons.mendeley.serializer import MendeleySerializer from tests.base import OsfTestCase pytestmark = pytest.mark.django_db class TestMendeleySerializer(CitationAddonSerializerTestSuiteMixin, OsfTestCase): addon_short_name = 'mendeley' Serializer = MendeleySerializer ExternalAccountFactory = MendeleyAccountFactory folder = MockFolder()
30.619048
81
0.819596
62
643
8.451613
0.516129
0.076336
0.053435
0.072519
0
0
0
0
0
0
0
0.001754
0.11353
643
20
82
32.15
0.917544
0.097978
0
0
0
0
0.013937
0
0
0
0
0
0
1
0
false
0
0.5
0
0.916667
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
688600d6cad34394de4e5a48da1144fe75003447
465
py
Python
src/project/_tests/base.py
pviojo/boilerplate-flask-api
4e3832cc1a6979019311e01f60227ace0f2c3259
[ "MIT" ]
null
null
null
src/project/_tests/base.py
pviojo/boilerplate-flask-api
4e3832cc1a6979019311e01f60227ace0f2c3259
[ "MIT" ]
null
null
null
src/project/_tests/base.py
pviojo/boilerplate-flask-api
4e3832cc1a6979019311e01f60227ace0f2c3259
[ "MIT" ]
null
null
null
from app import run_migration from flask import current_app as app from flask_testing import TestCase from project import db class BaseTestCase(TestCase): def create_app(self): app.config.from_object('project.configs.TestingConfig') return app def setUp(self): run_migration() def tearDown(self): db.session.remove() db.drop_all() def assert201(self, response): self.assert_status(response, 201)
22.142857
63
0.692473
60
465
5.233333
0.55
0.076433
0
0
0
0
0
0
0
0
0
0.016713
0.227957
465
20
64
23.25
0.857939
0
0
0
0
0
0.062366
0.062366
0
0
0
0
0.133333
1
0.266667
false
0
0.266667
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
1
0
0
0
0
1
0
0
2
68907c9f56a7dff7255659e5fac49a90b9c790a1
1,444
py
Python
chemreg/auth/tests/test_views.py
Chemical-Curation/chemcurator
bcd7fab84e407f06502e6873c38820724d4e54e7
[ "MIT" ]
1
2020-10-05T18:02:24.000Z
2020-10-05T18:02:24.000Z
chemreg/auth/tests/test_views.py
Chemical-Curation/chemcurator_django
bcd7fab84e407f06502e6873c38820724d4e54e7
[ "MIT" ]
207
2020-01-30T19:17:44.000Z
2021-02-24T19:45:29.000Z
chemreg/auth/tests/test_views.py
Chemical-Curation/chemcurator_django
bcd7fab84e407f06502e6873c38820724d4e54e7
[ "MIT" ]
null
null
null
from base64 import b64encode import pytest @pytest.mark.django_db def test_login_view(user, client, settings): """Test that the login view can login and logout.""" login_url = f"/{settings.LOGIN_URL.strip('/')}/" # Django doesn't store the raw password, so we need to set one we know. password = "A test password" user.set_password(password) user.save() # Test login with valid credentials auth_str = b64encode(f"{user.username}:{password}".encode()).decode() client.credentials(HTTP_AUTHORIZATION=f"Basic {auth_str}") response = client.post(login_url) assert response.status_code == 200 assert response.data["username"] == user.username assert response.data["email"] == user.email # Get user using just session ID client.credentials() response = client.get(login_url) assert response.status_code == 200 assert response.data["username"] == user.username assert response.data["email"] == user.email # Logout using just session ID response = client.delete(login_url) assert response.status_code == 200 assert not response.data["username"] assert not response.data["email"] # Test with invalid credentials response = client.post(login_url) assert response.status_code == 403 response = client.get(login_url) assert response.status_code == 403 response = client.delete(login_url) assert response.status_code == 403
32.088889
75
0.702216
191
1,444
5.198953
0.340314
0.140987
0.084592
0.132931
0.469285
0.469285
0.469285
0.466264
0.4572
0.21148
0
0.020478
0.188366
1,444
44
76
32.818182
0.826792
0.166898
0
0.551724
0
0
0.108131
0.049455
0
0
0
0
0.413793
1
0.034483
false
0.103448
0.068966
0
0.103448
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
0
0
1
0
0
0
0
0
2
68aaa854df265e745f3f5094661f5862c8bd4125
846
py
Python
tests/test_android_here.py
b3b/pythonhere
edd45b4f5087d63e1bf265ec6a7c6ade23580de3
[ "MIT" ]
2
2021-01-06T19:38:25.000Z
2022-01-25T10:00:20.000Z
tests/test_android_here.py
b3b/pythonhere
edd45b4f5087d63e1bf265ec6a7c6ade23580de3
[ "MIT" ]
1
2021-01-04T10:44:12.000Z
2021-01-04T10:44:12.000Z
tests/test_android_here.py
b3b/pythonhere
edd45b4f5087d63e1bf265ec6a7c6ade23580de3
[ "MIT" ]
null
null
null
import pytest @pytest.mark.parametrize( "script", (None, "test.py"), ) def test_restart_app(mocked_android_modules, app_instance, test_py_script, script): from android_here import restart_app restart_app(script) def test_script_path_resolved(mocked_android_modules, app_instance, test_py_script): from android_here import resolve_script_path path = resolve_script_path("test.py") assert path.startswith("/") and path.endswith("test.py") def test_absolute_script_path_resolved(mocked_android_modules, app_instance, test_py_script): from android_here import resolve_script_path assert resolve_script_path(test_py_script) == test_py_script def test_pin_shortcut(mocker, mocked_android_modules, app_instance, test_py_script): from android_here import pin_shortcut pin_shortcut("test.py", "test label")
32.538462
93
0.795508
121
846
5.140496
0.239669
0.096463
0.115756
0.14791
0.607717
0.490354
0.490354
0.490354
0.421222
0.421222
0
0
0.122931
846
25
94
33.84
0.838275
0
0
0.117647
0
0
0.053191
0
0
0
0
0
0.117647
1
0.235294
false
0
0.294118
0
0.529412
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
2
d799c19014a1b79f5fe8a1069ce05224e3482da3
1,591
py
Python
workflows/pipe-common/pipeline/autoscaling/cloudprovider.py
NShaforostov/cloud-pipeline
8d25b2b5f4838be569d9c25a307b77df5b0e73fc
[ "Apache-2.0" ]
null
null
null
workflows/pipe-common/pipeline/autoscaling/cloudprovider.py
NShaforostov/cloud-pipeline
8d25b2b5f4838be569d9c25a307b77df5b0e73fc
[ "Apache-2.0" ]
378
2021-03-25T20:09:54.000Z
2021-10-01T01:02:39.000Z
workflows/pipe-common/pipeline/autoscaling/cloudprovider.py
NShaforostov/cloud-pipeline
8d25b2b5f4838be569d9c25a307b77df5b0e73fc
[ "Apache-2.0" ]
2
2019-08-09T18:04:54.000Z
2019-08-11T19:03:06.000Z
# Copyright 2017-2019 EPAM Systems, Inc. (https://www.epam.com/) # # 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. LIMIT_EXCEEDED_ERROR_MASSAGE = 'Instance limit exceeded. A new one will be launched as soon as free space will be available.' LIMIT_EXCEEDED_EXIT_CODE = 6 class AbstractInstanceProvider(object): def run_instance(self, is_spot, bid_price, ins_type, ins_hdd, ins_img, ins_key, run_id, kms_encyr_key_id, num_rep, time_rep, kube_ip, kubeadm_token): pass def find_and_tag_instance(self, old_id, new_id): pass def verify_run_id(self, run_id): pass def check_instance(self, ins_id, run_id, num_rep, time_rep): pass def get_instance_names(self, ins_id): pass def find_instance(self, run_id): pass def terminate_instance(self, ins_id): pass def terminate_instance_by_ip(self, node_internal_ip, node_name): pass def find_nodes_with_run_id(self, run_id): instance = self.find_instance(run_id) return [instance] if instance is not None else []
32.469388
125
0.715273
245
1,591
4.42449
0.510204
0.0369
0.041513
0.02952
0.135609
0
0
0
0
0
0
0.010359
0.211188
1,591
48
126
33.145833
0.853386
0.366436
0
0.347826
0
0
0.092555
0
0
0
0
0
0
1
0.391304
false
0.347826
0
0
0.478261
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
1
0
1
0
0
0
0
0
2
d79e215cb8f499e47e5107fabf650f63a2a2ff52
305
py
Python
text-classify/test.py
ubear/MachineLearn
c24947f7078269f51bf7ee0d2167ca6b71152d1e
[ "MIT" ]
null
null
null
text-classify/test.py
ubear/MachineLearn
c24947f7078269f51bf7ee0d2167ca6b71152d1e
[ "MIT" ]
null
null
null
text-classify/test.py
ubear/MachineLearn
c24947f7078269f51bf7ee0d2167ca6b71152d1e
[ "MIT" ]
null
null
null
#coding:utf-8 import re import math from docclass import Classifier def test_infc_func(): c = Classifier(getfeatures=None) c.infc("python", "good") c.infc("python", "good") c.infc("the", "bad") c.infc("the", "good") print c.fc if __name__ == "__main__": test_infc_func()
15.25
36
0.629508
44
305
4.090909
0.568182
0.111111
0.133333
0.166667
0.194444
0.194444
0
0
0
0
0
0.004132
0.206557
305
19
37
16.052632
0.739669
0.039344
0
0.166667
0
0
0.140411
0
0
0
0
0
0
0
null
null
0
0.25
null
null
0.083333
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
1
0
0
0
0
0
0
0
0
2
d79fcf121072d7dc68656d391c409e397c811e06
333
py
Python
src/chapter2/exercise7.py
group6BCS1/BCS-2021
272b1117922163cde03901cfdd82f8e0cfab9a67
[ "MIT" ]
null
null
null
src/chapter2/exercise7.py
group6BCS1/BCS-2021
272b1117922163cde03901cfdd82f8e0cfab9a67
[ "MIT" ]
null
null
null
src/chapter2/exercise7.py
group6BCS1/BCS-2021
272b1117922163cde03901cfdd82f8e0cfab9a67
[ "MIT" ]
null
null
null
c = float(input("Enter Amount Between 0-99 :")) print(c // 20, "Twenties") c = c % 20 print(c // 10, "Tens") c = c % 10 print(c // 5, "Fives") c = c % 5 print(c // 1, "Ones") c = c % 1 print(c // 0.25, "Quarters") c = c % 0.25 print(c // 0.1, "Dimes") c = c % 0.1 print(c // 0.05, "Nickles") c = c % 0.05 print(c // 0.01, "Pennies")
19.588235
47
0.51952
68
333
2.544118
0.352941
0.277457
0.16185
0.092486
0
0
0
0
0
0
0
0.131274
0.222222
333
16
48
20.8125
0.53668
0
0
0
0
0
0.225225
0
0
0
0
0
0
1
0
false
0
0
0
0
0.5
0
0
0
null
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
1
0
2
d7bb7502a2e24be8eaf3bc4172023cbaaaa79d16
1,716
py
Python
PythonExercicios/ex045.py
Caio-Moretti/115.Exercicios-Python
7e66fb1f44ea3eb4ade63f37d843242ac42ade84
[ "MIT" ]
null
null
null
PythonExercicios/ex045.py
Caio-Moretti/115.Exercicios-Python
7e66fb1f44ea3eb4ade63f37d843242ac42ade84
[ "MIT" ]
null
null
null
PythonExercicios/ex045.py
Caio-Moretti/115.Exercicios-Python
7e66fb1f44ea3eb4ade63f37d843242ac42ade84
[ "MIT" ]
null
null
null
from random import choice from time import sleep jokenpo = ['Pedra', 'Papel', 'Tesoura'] jokenposter_stainger = choice(jokenpo) jogador = int(input('Qual a sua jogada?' '\n1. Pedra' '\n2. Papel' '\n3. Tesoura' '\nEscolha: ')) print('\nJO...') sleep(1) print('KEN...') sleep(1) print('PO!!!' '\n ') if jogador == 1: print('Você: Pedra') elif jogador == 2: print('Você: Papel') elif jogador == 3: print('Você: Tesoura') else: print('Escolha uma opção válida.') print('Jokenposter Stainger: {}'.format(jokenposter_stainger)) sleep(2) print('--' * 20) if jokenposter_stainger == 'Pedra' and jogador == 1: print('Empate!') w = 0 elif jokenposter_stainger == 'Pedra' and jogador == 2: print('Você ganhou!') w = 2 elif jokenposter_stainger == 'Pedra' and jogador == 3: print('Você perdeu!') w = 1 elif jokenposter_stainger == 'Papel' and jogador == 1: print('Você perdeu!') w = 1 elif jokenposter_stainger == 'Papel' and jogador == 2: print('Empate!') w = 0 elif jokenposter_stainger == 'Papel' and jogador == 3: print('Você ganhou!') w = 2 elif jokenposter_stainger == 'Tesoura' and jogador == 1: print('Você ganhou!') w = 2 elif jokenposter_stainger == 'Tesoura' and jogador == 2: print('Você perdeu!') w = 1 elif jokenposter_stainger == 'Tesoura' and jogador == 3: print('Empate!') w = 0 if w == 0: print('Jokenposter Stainger: Vamo de novo! Ta com medinho?') elif w == 1: print('Jokenposter Stainger: OTÁRIO ') elif w == 2: print('Jokenposter Stainger: TAAAVA DEMORAANDO! Revanche!') else: print(' ') print('--' * 20)
23.189189
64
0.597902
212
1,716
4.787736
0.268868
0.280788
0.181281
0.050246
0.470936
0.431527
0.370443
0.299507
0.22069
0.22069
0
0.026174
0.243007
1,716
73
65
23.506849
0.755196
0
0
0.387097
0
0
0.269231
0
0
0
0
0
0
1
0
false
0
0.032258
0
0.032258
0.370968
0
0
0
null
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
d7c2573fe1dc3783d90bd1abbefb46141b4afea9
15,240
py
Python
data/test/test_queue.py
giuseppe/quay
a1b7e4b51974edfe86f66788621011eef2667e6a
[ "Apache-2.0" ]
2,027
2019-11-12T18:05:48.000Z
2022-03-31T22:25:04.000Z
data/test/test_queue.py
giuseppe/quay
a1b7e4b51974edfe86f66788621011eef2667e6a
[ "Apache-2.0" ]
496
2019-11-12T18:13:37.000Z
2022-03-31T10:43:45.000Z
data/test/test_queue.py
giuseppe/quay
a1b7e4b51974edfe86f66788621011eef2667e6a
[ "Apache-2.0" ]
249
2019-11-12T18:02:27.000Z
2022-03-22T12:19:19.000Z
import json import time import pytest from contextlib import contextmanager from datetime import datetime, timedelta from functools import wraps from data.database import QueueItem from data.queue import ( WorkQueue, MINIMUM_EXTENSION, queue_items_locked, queue_items_available, queue_items_available_unlocked, ) from test.fixtures import * QUEUE_NAME = "testqueuename" class AutoUpdatingQueue(object): def __init__(self, queue_to_wrap): self._queue = queue_to_wrap def _wrapper(self, func): @wraps(func) def wrapper(*args, **kwargs): to_return = func(*args, **kwargs) self._queue.update_metrics() return to_return return wrapper def __getattr__(self, attr_name): method_or_attr = getattr(self._queue, attr_name) if callable(method_or_attr): return self._wrapper(method_or_attr) else: return method_or_attr TEST_MESSAGE_1 = json.dumps({"data": 1}) TEST_MESSAGE_2 = json.dumps({"data": 2}) TEST_MESSAGES = [json.dumps({"data": str(i)}) for i in range(1, 101)] @contextmanager def fake_transaction(arg): yield @pytest.fixture() def transaction_factory(): return fake_transaction def gauge_value(g): return g.collect()[0].samples[0].value @pytest.fixture() def queue(transaction_factory, initialized_db): return AutoUpdatingQueue(WorkQueue(QUEUE_NAME, transaction_factory)) def test_get_single_item(queue, transaction_factory): # Add a single item to the queue. queue.put(["abc", "def"], TEST_MESSAGE_1, available_after=-1) # Have two "instances" retrieve an item to claim. Since there is only one, both calls should # return the same item. now = datetime.utcnow() first_item = queue._select_available_item(False, now) second_item = queue._select_available_item(False, now) assert first_item.id == second_item.id assert first_item.state_id == second_item.state_id # Have both "instances" now try to claim the item. Only one should succeed. first_claimed = queue._attempt_to_claim_item(first_item, now, 300) second_claimed = queue._attempt_to_claim_item(first_item, now, 300) assert first_claimed assert not second_claimed # Ensure the item is no longer available. assert queue.get() is None # Ensure the item's state ID has changed. assert first_item.state_id != QueueItem.get().state_id def test_extend_processing(queue, transaction_factory): # Add and retrieve a queue item. queue.put(["abc", "def"], TEST_MESSAGE_1, available_after=-1) queue_item = queue.get(processing_time=10) assert queue_item is not None existing_db_item = QueueItem.get(id=queue_item.id) # Call extend processing with a timedelta less than the minimum and ensure its # processing_expires and state_id do not change. changed = queue.extend_processing(queue_item, 10 + MINIMUM_EXTENSION.total_seconds() - 1) assert not changed updated_db_item = QueueItem.get(id=queue_item.id) assert existing_db_item.processing_expires == updated_db_item.processing_expires assert existing_db_item.state_id == updated_db_item.state_id # Call extend processing with a timedelta greater than the minimum and ensure its # processing_expires and state_id are changed. changed = queue.extend_processing(queue_item, 10 + MINIMUM_EXTENSION.total_seconds() + 1) assert changed updated_db_item = QueueItem.get(id=queue_item.id) assert existing_db_item.processing_expires != updated_db_item.processing_expires assert existing_db_item.state_id != updated_db_item.state_id # Call extend processing with a timedelta less than the minimum but also with new data and # ensure its processing_expires and state_id are changed. changed = queue.extend_processing( queue_item, 10 + MINIMUM_EXTENSION.total_seconds() - 1, updated_data="newbody" ) assert changed updated_db_item = QueueItem.get(id=queue_item.id) assert existing_db_item.processing_expires != updated_db_item.processing_expires assert existing_db_item.state_id != updated_db_item.state_id assert updated_db_item.body == "newbody" def test_same_canonical_names(queue, transaction_factory): queue_items_locked.labels(queue._queue_name).set(0) queue_items_available.labels(queue._queue_name).set(0) queue_items_available_unlocked.labels(queue._queue_name).set(0) id_1 = int(queue.put(["abc", "def"], TEST_MESSAGE_1, available_after=-1)) id_2 = int(queue.put(["abc", "def"], TEST_MESSAGE_2, available_after=-1)) assert id_1 + 1 == id_2 assert not queue._currently_processing assert gauge_value(queue_items_locked) == 0 assert gauge_value(queue_items_locked) + gauge_value(queue_items_available_unlocked) == 1 one = queue.get(ordering_required=True) assert one is not None assert one.body == TEST_MESSAGE_1 assert queue._currently_processing assert gauge_value(queue_items_locked) == 1 assert gauge_value(queue_items_locked) + gauge_value(queue_items_available_unlocked) == 1 two_fail = queue.get(ordering_required=True) assert two_fail is None assert gauge_value(queue_items_locked) == 1 assert gauge_value(queue_items_locked) + gauge_value(queue_items_available_unlocked) == 1 queue.complete(one) assert not queue._currently_processing assert gauge_value(queue_items_locked) == 0 assert gauge_value(queue_items_locked) + gauge_value(queue_items_available_unlocked) == 1 two = queue.get(ordering_required=True) assert two is not None assert queue._currently_processing assert two.body == TEST_MESSAGE_2 assert gauge_value(queue_items_locked) == 1 assert gauge_value(queue_items_locked) + gauge_value(queue_items_available_unlocked) == 1 def test_different_canonical_names(queue, transaction_factory): queue_items_locked.labels(queue._queue_name).set(0) queue_items_available.labels(queue._queue_name).set(0) queue_items_available_unlocked.labels(queue._queue_name).set(0) queue.put(["abc", "def"], TEST_MESSAGE_1, available_after=-1) queue.put(["abc", "ghi"], TEST_MESSAGE_2, available_after=-1) assert gauge_value(queue_items_locked) == 0 assert gauge_value(queue_items_locked) + gauge_value(queue_items_available_unlocked) == 2 one = queue.get(ordering_required=True) assert one is not None assert one.body == TEST_MESSAGE_1 assert gauge_value(queue_items_locked) == 1 assert gauge_value(queue_items_locked) + gauge_value(queue_items_available_unlocked) == 2 two = queue.get(ordering_required=True) assert two is not None assert two.body == TEST_MESSAGE_2 assert gauge_value(queue_items_locked) == 2 assert gauge_value(queue_items_locked) + gauge_value(queue_items_available_unlocked) == 2 def test_canonical_name(queue, transaction_factory): queue.put(["abc", "def"], TEST_MESSAGE_1, available_after=-1) queue.put(["abc", "def", "ghi"], TEST_MESSAGE_1, available_after=-1) one = queue.get(ordering_required=True) assert QUEUE_NAME + "/abc/def/" != one two = queue.get(ordering_required=True) assert QUEUE_NAME + "/abc/def/ghi/" != two def test_expiration(queue, transaction_factory): queue_items_locked.labels(queue._queue_name).set(0) queue_items_available.labels(queue._queue_name).set(0) queue_items_available_unlocked.labels(queue._queue_name).set(0) queue.put(["abc", "def"], TEST_MESSAGE_1, available_after=-1) assert gauge_value(queue_items_locked) == 0 assert gauge_value(queue_items_locked) + gauge_value(queue_items_available_unlocked) == 1 one = queue.get(processing_time=0.5, ordering_required=True) assert one is not None assert gauge_value(queue_items_locked) == 1 assert gauge_value(queue_items_locked) + gauge_value(queue_items_available_unlocked) == 1 one_fail = queue.get(ordering_required=True) assert one_fail is None time.sleep(1) queue.update_metrics() assert gauge_value(queue_items_locked) == 0 assert gauge_value(queue_items_locked) + gauge_value(queue_items_available_unlocked) == 1 one_again = queue.get(ordering_required=True) assert one_again is not None assert gauge_value(queue_items_locked) == 1 assert gauge_value(queue_items_locked) + gauge_value(queue_items_available_unlocked) == 1 def test_alive(queue, transaction_factory): # No queue item = not alive. assert not queue.alive(["abc", "def"]) # Add a queue item. queue.put(["abc", "def"], TEST_MESSAGE_1, available_after=-1) assert queue.alive(["abc", "def"]) # Retrieve the queue item. queue_item = queue.get() assert queue_item is not None assert queue.alive(["abc", "def"]) # Make sure it is running by trying to retrieve it again. assert queue.get() is None # Delete the queue item. queue.complete(queue_item) assert not queue.alive(["abc", "def"]) def test_specialized_queue(queue, transaction_factory): queue.put(["abc", "def"], TEST_MESSAGE_1, available_after=-1) queue.put(["def", "def"], TEST_MESSAGE_2, available_after=-1) my_queue = AutoUpdatingQueue(WorkQueue(QUEUE_NAME, transaction_factory, ["def"])) two = my_queue.get(ordering_required=True) assert two is not None assert two.body == TEST_MESSAGE_2 one_fail = my_queue.get(ordering_required=True) assert one_fail is None one = queue.get(ordering_required=True) assert one is not None assert one.body == TEST_MESSAGE_1 def test_random_queue_no_duplicates(queue, transaction_factory): for msg in TEST_MESSAGES: queue.put(["abc", "def"], msg, available_after=-1) seen = set() for _ in range(1, 101): item = queue.get() json_body = json.loads(item.body) msg = str(json_body["data"]) assert msg not in seen seen.add(msg) for body in TEST_MESSAGES: json_body = json.loads(body) msg = str(json_body["data"]) assert msg in seen def test_bulk_insert(queue, transaction_factory): queue_items_locked.labels(queue._queue_name).set(0) queue_items_available.labels(queue._queue_name).set(0) queue_items_available_unlocked.labels(queue._queue_name).set(0) with queue.batch_insert() as queue_put: queue_put(["abc", "def"], TEST_MESSAGE_1, available_after=-1) queue_put(["abc", "def"], TEST_MESSAGE_2, available_after=-1) queue.update_metrics() assert not queue._currently_processing assert gauge_value(queue_items_locked) == 0 assert gauge_value(queue_items_locked) + gauge_value(queue_items_available_unlocked) == 1 with queue.batch_insert() as queue_put: queue_put(["abd", "def"], TEST_MESSAGE_1, available_after=-1) queue_put(["abd", "ghi"], TEST_MESSAGE_2, available_after=-1) queue.update_metrics() assert not queue._currently_processing assert gauge_value(queue_items_locked) == 0 assert gauge_value(queue_items_locked) + gauge_value(queue_items_available_unlocked) == 3 def test_num_available_between(queue, transaction_factory): now = datetime.utcnow() queue.put(["abc", "def"], TEST_MESSAGE_1, available_after=-10) queue.put(["abc", "ghi"], TEST_MESSAGE_2, available_after=-5) # Partial results count = queue.num_available_jobs_between(now - timedelta(seconds=8), now, ["abc"]) assert count == 1 # All results count = queue.num_available_jobs_between(now - timedelta(seconds=20), now, ["/abc"]) assert count == 2 # No results count = queue.num_available_jobs_between(now, now, "abc") assert count == 0 def test_incomplete(queue, transaction_factory): # Add an item. queue.put(["somenamespace", "abc", "def"], TEST_MESSAGE_1, available_after=-10) now = datetime.utcnow() count = queue.num_available_jobs_between(now - timedelta(seconds=60), now, ["/somenamespace"]) assert count == 1 # Retrieve it. item = queue.get() assert item is not None assert queue._currently_processing # Mark it as incomplete. queue.incomplete(item, retry_after=-1) assert not queue._currently_processing # Retrieve again to ensure it is once again available. same_item = queue.get() assert same_item is not None assert queue._currently_processing assert item.id == same_item.id def test_complete(queue, transaction_factory): # Add an item. queue.put(["somenamespace", "abc", "def"], TEST_MESSAGE_1, available_after=-10) now = datetime.utcnow() count = queue.num_available_jobs_between(now - timedelta(seconds=60), now, ["/somenamespace"]) assert count == 1 # Retrieve it. item = queue.get() assert item is not None assert queue._currently_processing # Mark it as complete. queue.complete(item) assert not queue._currently_processing def test_cancel(queue, transaction_factory): # Add an item. queue.put(["somenamespace", "abc", "def"], TEST_MESSAGE_1, available_after=-10) queue.put(["somenamespace", "abc", "def"], TEST_MESSAGE_2, available_after=-5) now = datetime.utcnow() count = queue.num_available_jobs_between(now - timedelta(seconds=60), now, ["/somenamespace"]) assert count == 2 # Retrieve it. item = queue.get() assert item is not None # Make sure we can cancel it. assert queue.cancel(item.id) now = datetime.utcnow() count = queue.num_available_jobs_between(now - timedelta(seconds=60), now, ["/somenamespace"]) assert count == 1 # Make sure it is gone. assert not queue.cancel(item.id) def test_deleted_namespaced_items(queue, transaction_factory): queue = AutoUpdatingQueue(WorkQueue(QUEUE_NAME, transaction_factory, has_namespace=True)) queue.put(["somenamespace", "abc", "def"], TEST_MESSAGE_1, available_after=-10) queue.put(["somenamespace", "abc", "ghi"], TEST_MESSAGE_2, available_after=-5) queue.put(["anothernamespace", "abc", "def"], TEST_MESSAGE_1, available_after=-10) # Ensure we have 2 items under `somenamespace` and 1 item under `anothernamespace`. now = datetime.utcnow() count = queue.num_available_jobs_between(now - timedelta(seconds=60), now, ["/somenamespace"]) assert count == 2 count = queue.num_available_jobs_between( now - timedelta(seconds=60), now, ["/anothernamespace"] ) assert count == 1 # Delete all `somenamespace` items. queue.delete_namespaced_items("somenamespace") # Check the updated counts. count = queue.num_available_jobs_between(now - timedelta(seconds=60), now, ["/somenamespace"]) assert count == 0 count = queue.num_available_jobs_between( now - timedelta(seconds=60), now, ["/anothernamespace"] ) assert count == 1 # Delete all `anothernamespace` items. queue.delete_namespaced_items("anothernamespace") # Check the updated counts. count = queue.num_available_jobs_between(now - timedelta(seconds=60), now, ["/somenamespace"]) assert count == 0 count = queue.num_available_jobs_between( now - timedelta(seconds=60), now, ["/anothernamespace"] ) assert count == 0
34.247191
98
0.720997
2,101
15,240
4.940505
0.098049
0.054913
0.060694
0.080925
0.735934
0.711079
0.697977
0.658382
0.631792
0.611175
0
0.014407
0.175656
15,240
444
99
34.324324
0.811828
0.087992
0
0.519298
0
0
0.038742
0
0
0
0
0
0.364912
1
0.080702
false
0
0.031579
0.010526
0.140351
0
0
0
0
null
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
2
d7c7d36b08b7910b33e0fece9387522df88e2cd2
3,105
py
Python
commands/FBTextInputCommands.py
zddd/chisel
7782bdde3062e15ccbdc5f617aa3a8f096b6751b
[ "MIT" ]
1
2020-03-04T20:24:33.000Z
2020-03-04T20:24:33.000Z
commands/FBTextInputCommands.py
zddd/chisel
7782bdde3062e15ccbdc5f617aa3a8f096b6751b
[ "MIT" ]
null
null
null
commands/FBTextInputCommands.py
zddd/chisel
7782bdde3062e15ccbdc5f617aa3a8f096b6751b
[ "MIT" ]
null
null
null
#!/usr/bin/python # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import os import lldb import fblldbbase as fb import fblldbviewhelpers as viewHelpers ACCESSIBILITY_ID = 0 REPLACEMENT_TEXT = 1 INPUT_TEXT = 0 def lldbcommands(): return [ FBInputTexByAccessibilityIdCommand(), FBInputTexToFirstResponderCommand(), ] class FBInputTexByAccessibilityIdCommand(fb.FBCommand): def name(self): return 'settext' def description(self): return 'Set text on text on a view by accessibility id.' def args(self): return [ fb.FBCommandArgument(arg='accessibilityId', type='string', help='The accessibility ID of the input view.'), fb.FBCommandArgument(arg='replacementText', type='string', help='The text to set.') ] def run(self, arguments, options): self.findView(rootView(), arguments[ACCESSIBILITY_ID], arguments[REPLACEMENT_TEXT]) def findView(self, view, searchIdentifier, replacementText): views = subviewsOfView(view) for index in range(0, viewsCount(views)): subview = subviewAtIndex(views, index) self.findView(subview, searchIdentifier, replacementText) else: identifier = accessibilityIdentifier(view) if isEqualToString(identifier, searchIdentifier): setTextInView(view, replacementText) class FBInputTexToFirstResponderCommand(fb.FBCommand): def name(self): return 'setinput' def description(self): return 'Input text into text field or text view that is first responder.' def args(self): return [ fb.FBCommandArgument(arg='inputText', type='string', help='The text to input.') ] def run(self, arguments, options): self.findFirstResponder(rootView(), arguments[INPUT_TEXT]) def findFirstResponder(self, view, replacementText): views = subviewsOfView(view) if isFirstResponder(view): setTextInView(view, replacementText) else: for index in range(0, viewsCount(views)): subview = subviewAtIndex(views, index) self.findFirstResponder(subview, replacementText) # Some helpers def rootView(): return fb.evaluateObjectExpression('[[UIApplication sharedApplication] keyWindow]') def subviewsOfView(view): return fb.evaluateObjectExpression('[%s subviews]' % view) def subviewAtIndex(views, index): return fb.evaluateObjectExpression('[%s objectAtIndex:%i]' % (views, index)) def viewsCount(views): return int(fb.evaluateExpression('(int)[%s count]' % views)) def accessibilityIdentifier(view): return fb.evaluateObjectExpression('[%s accessibilityIdentifier]' % view) def isEqualToString(identifier, needle): return fb.evaluateBooleanExpression('[%s isEqualToString:@"%s"]' % (identifier, needle)) def setTextInView(view, text): fb.evaluateObjectExpression('[%s setText:@"%s"]' % (view, text)) viewHelpers.flushCoreAnimationTransaction() def isFirstResponder(view): return fb.evaluateBooleanExpression('[%s isFirstResponder]' % view)
30.145631
113
0.732689
329
3,105
6.896657
0.349544
0.028206
0.056413
0.022477
0.196562
0.163949
0.092552
0.058175
0.058175
0.058175
0
0.001915
0.159098
3,105
102
114
30.441176
0.867101
0.070209
0
0.304348
0
0
0.153766
0.015967
0
0
0
0
0
1
0.275362
false
0
0.057971
0.202899
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
1
0
0
0
2
d7d7eb91cc6291ffc2e3931f28156e9ccd13a035
1,826
py
Python
inaworld/tokens.py
epfahl/inaworld
886bd1c0ce143eb09d5fe3c479e0ed0e796bf836
[ "MIT" ]
null
null
null
inaworld/tokens.py
epfahl/inaworld
886bd1c0ce143eb09d5fe3c479e0ed0e796bf836
[ "MIT" ]
null
null
null
inaworld/tokens.py
epfahl/inaworld
886bd1c0ce143eb09d5fe3c479e0ed0e796bf836
[ "MIT" ]
null
null
null
"""Tokenize a document. *** NLTK tokenization and this module have been deprecated in favor of a sklearn-based solution. However, NLTK may offer more options for tokenization, stemming, etc., this module is retained for future reference. """ import re import nltk import toolz as tz re_not_alpha = re.compile('[^a-zA-Z]') STOPWORDS = set(nltk.corpus.stopwords.words('english')) def is_alpha(tt): """Given a POS tagged token (<token>, <pos>), return True if the token has only alphabetic characters (i.e., no punctuation or numbers). """ return not bool(re_not_alpha.search(tt[0])) def not_proper(tt): """Given a POS tagged token (<token>, <pos>), return True if the token is not tagged as a proper noun ('NNP'). """ return (tt[1] != 'NNP') def not_stopword(tt): """Given a POS tagged token (<token>, <pos>), return True if the token is not a stopword. """ return (tt[0] not in STOPWORDS) def lower(tt): """Given a POS tagged token (<token>, <pos>), return (<token>.lower(), <pos>). """ return (tt[0].lower(), tt[1]) def stem(tt): """Given a POS tagged token (<token>, <pos>), return (<stemmed token>, <pos>). """ return (nltk.stem.lancaster.LancasterStemmer().stem(tt[0]), tt[1]) def remove_pos(tt): """Given a POS tagged token (<token>, <pos>), return only the token. """ return tt[0] def tokenize(doc, with_stem=False): """Given a document string, return a list of tokens. """ pipeline = [ (filter, is_alpha), (filter, not_proper), (map, lower), (filter, not_stopword)] if with_stem: pipeline += [(map, stem)] pipeline += [(map, remove_pos)] return list(tz.thread_last( nltk.tag.pos_tag(nltk.tokenize.word_tokenize(doc)), *pipeline))
25.71831
79
0.624863
261
1,826
4.306513
0.348659
0.072064
0.087189
0.058719
0.238434
0.238434
0.238434
0.238434
0.238434
0.142349
0
0.00563
0.221796
1,826
70
80
26.085714
0.785362
0.461665
0
0
0
0
0.021205
0
0
0
0
0
0
1
0.241379
false
0
0.103448
0
0.586207
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
d7d93021ccae0a77677be8252a5390c6ed0ed049
686
py
Python
sympycore/heads/arithmetic.py
radovankavicky/pymaclab
21da758f64ed0b62969c9289576f677e977cfd98
[ "Apache-2.0" ]
96
2015-01-25T05:59:56.000Z
2021-12-29T14:05:22.000Z
sympycore/heads/arithmetic.py
1zinnur9/pymaclab
21da758f64ed0b62969c9289576f677e977cfd98
[ "Apache-2.0" ]
3
2015-12-17T19:25:46.000Z
2018-06-19T07:05:20.000Z
sympycore/heads/arithmetic.py
1zinnur9/pymaclab
21da758f64ed0b62969c9289576f677e977cfd98
[ "Apache-2.0" ]
36
2016-01-31T15:22:01.000Z
2021-03-29T07:03:07.000Z
#obsolete, each head should be defined in a separate file __all__ = ['FLOORDIV', 'MOD'] from .base import NaryHead class ModHead(NaryHead): """ ModHead represents module n-ary operation, data is a n-tuple of expression operands. """ op_mth = '__mod__' op_rmth = '__rmod__' op_symbol = '%' def __repr__(self): return 'MOD' class FloordivHead(NaryHead): """ FloordivHead represents floor-division n-ary operation, data is a n-tuple of expression operands. """ op_mth = '__floordiv__' op_rmth = '__rfloordiv__' op_symbol = '//' def __repr__(self): return 'FLOORDIV' MOD = ModHead() FLOORDIV = FloordivHead()
18.540541
59
0.653061
82
686
5.04878
0.52439
0.05314
0.062802
0.082126
0.36715
0.36715
0.246377
0.246377
0.246377
0.246377
0
0
0.237609
686
36
60
19.055556
0.791587
0.348397
0
0
0
0
0.160099
0
0
0
0
0
0
1
0.142857
false
0
0.071429
0.142857
0.785714
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
d7ddf28312cf505e16bdb958ec521e74d90b4d5b
898
py
Python
glycowork/tests/test_hierarchyfilter.py
Old-Shatterhand/glycowork
544fde03dd38cf95fb97792e050d7ff68f5637b1
[ "MIT" ]
22
2021-04-22T23:53:26.000Z
2022-03-21T00:36:32.000Z
glycowork/tests/test_hierarchyfilter.py
Old-Shatterhand/glycowork
544fde03dd38cf95fb97792e050d7ff68f5637b1
[ "MIT" ]
3
2021-04-23T13:01:07.000Z
2022-03-16T19:13:12.000Z
glycowork/tests/test_hierarchyfilter.py
Old-Shatterhand/glycowork
544fde03dd38cf95fb97792e050d7ff68f5637b1
[ "MIT" ]
2
2021-07-06T14:13:40.000Z
2021-12-15T15:12:37.000Z
import glycowork from glycowork.glycan_data.loader import df_species from glycowork.ml.train_test_split import * train_x, val_x, train_y, val_y, id_val, class_list, class_converter = hierarchy_filter(df_species, rank = 'Kingdom') print(train_x[:10]) train_x, val_x, train_y, val_y, id_val, class_list, class_converter = hierarchy_filter(df_species, rank = 'Kingdom', wildcard_seed = True, wildcard_list = linkages, wildcard_name = 'bond') print(train_x[-10:])
56.125
112
0.406459
74
898
4.567568
0.418919
0.071006
0.053254
0.059172
0.491124
0.491124
0.491124
0.491124
0.491124
0.491124
0
0.009639
0.537862
898
15
113
59.866667
0.804819
0
0
0.166667
0
0
0.020045
0
0
0
0
0
0
1
0
true
0
0.25
0
0.25
0.166667
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
2