text stringlengths 8 6.05M |
|---|
from tqdm import tqdm
from src.model_neurosat_v2 import NeuroSAT2
from utils.config import Config
import PyMiniSolvers.minisolvers as minisolvers
import random
import numpy as np
import os
from utils.create_database_random import DataGenerator, ProblemsLoader
from src.model_neurosat import *
from torch.utils.tensorboar... |
# /usr/local/lib/python2.7/dist-packages/scrapy/core/scheduler.py |
import os
def clearscreen():
print("start clear")
os.system('clear')
print("clear complete")
def fun1():
print("start clear")
os.system('clear')
print("clear complete")
|
print('input your elements(one by one in a column) then just enter:')
try:
my_list = []
while True:
my_list.append(int(input()))
except:
print('your list: ', my_list, end='\n\n')
for i in my_list:
if i%3 == 0 :
print(i)
input('press enter to exit')
|
import pylab as P
def plotAB(dataA,dataB):
"""Draw two data lines on two axes"""
P.clf()
f=P.figure(figsize=(8,5))
ax1 = f.add_subplot(111)
ax2 = ax1.twinx()
xA = range(len(dataA))
lA=ax1.plot(xA,dataA,color="blue", ls="-")
xB = range(len(dataB))
lA=ax2.plot(xB,dataB,color="green"... |
# -*- coding: utf-8 -*-
"""
Created on Mon Apr 15 15:08:08 2019
@author: Vall
"""
import iv_save_module as ivs
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.widgets as wid
import os
from tkinter import Tk, messagebox
#%%
def interactiveLegend(ax, labels=False, show_default=True,
... |
class Plane:
def __init__(self, name, airspeed = 0, altitude = 0, direction = 0, vspeed = 0, fuel = 0):
self.name = str(name)
self.airspeed = airspeed
self.altitude = altitude
self.direction = direction
self.vspeed = vspeed
self.fuel = fuel
def engines(s... |
import os
basedir = os.path.abspath(os.path.dirname(__file__))
class Config(object):
DEBUG = False
TESTING = False
CSRF_ENABLED = True
SECRET_KEY = 'shjbxhud9280h1gx9eub9sugue'
SQLALCHEMY_DATABASE_URI = "mysql://itcom:72167964c1f4740fe8@10.16.45.109:3306/it_company"
class Static(object):
LAG... |
######################################################################################
#__author__ = "Gaurav Sharma" #
#__copyright__ = "Copyright 2014, School of Public Health, University of Maryland" #
#__department__ = "Telecommunications" ... |
from MakeMyTrip.Pages.WebPage import *
from MakeMyTrip.Resources.Locators import Locators
import time
class FindHotel(WebPage):
popup_xpath = Locators.popup_xpath
login_menu_xpath = Locators.login_menu_xpath
city_label_xpath = Locators.city_label_xpath
city_textbox_xpath = Locators.city_textbox_xpath
... |
import time
import pygame
from bullet import Bullet
from flagzombie import Flagzombie
from peashooter import Peashooter
from sun import Sun
from sunflower import Sunflower
from wallnut import Wallnut
from zombie import Zombie
pygame.init()
backgdsize = (1000, 600)
screen = pygame.display.set_mode(backgdsize)
pygame.d... |
"""Reports presence information into Zookeeper.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import time
import logging
import sys
import kazoo
from treadmill import exc
from treadmill import sysinfo
from tre... |
import torch
import numpy as np
import pandas as pd
from MyDataLoader import *
from CNN import *
from FC import *
from AlexNet import *
def is_right(prediction, label):
index = -1
max = -1
pred = prediction.data.numpy()
for i in range(len(pred[0])):
if pred[0][i] > max:
max = pred[0... |
import sys
#starting number in sequence
value1 = '21'
#calculate value2 digits of sequence
value2 = '40'
# write your solution here
def fib(x,y):
fib_sequence = ''
counter = 0
a, b = 0, 1
while counter < y:
if a == x:
fib_sequence += f'{b}'
counter += 1... |
import cv2
import numpy as np
import pyautogui as pag
import keyboard
# open settingS file contaning basic configs
with open("settings.txt") as f:
lines = f.readlines()
scaling_factor = int(lines[0].split("=")[-1].strip()) # ratio of object movement to mouse pointer movement
click_thresho... |
import matplotlib.pyplot as plt
import numpy as np
def get_data(filename):
return np.loadtxt("dataSets/" + filename + ".txt")
def plot_data(filename):
data = get_data(filename)
for point in data:
plt.plot(point[0], point[1], 'ro')
plt.title(filename)
plt.show()
print(get_data("gmm"))
p... |
import unittest
from botsrc import Bot
class BotTestCase(unittest.TestCase):
def setUp(self):
self.Bot = Bot(473559457, ":AAH5NFuZppQP0PrypaussjDoo_d0FpJUDxg")
def test_bot_connect(self):
self.assertEqual(self.Bot.getMe(), True, 'cannot connect')
if __name__ == '__main__':
unittest... |
# Work With Python3
import os
import stat
from shutil import rmtree
from subprocess import check_call
def resolve_path(rel_path):
return os.path.abspath(os.path.join(os.path.dirname(__file__), rel_path))
def rmtree_silent(root):
def remove_readonly_handler(fn, root, excinfo):
if fn is os.rmdir:
... |
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.support import expected_conditions as ec
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.common.exceptions import WebDriverExc... |
"""Custom authentication for DRF."""
from django.urls import reverse
from django.utils.translation import gettext_lazy as _
from django_otp.models import Device
from drf_spectacular.contrib.rest_framework_simplejwt import SimpleJWTScheme
from rest_framework import status
from rest_framework.exceptions import APIExcep... |
import os
import logging
from aws import SNS
def sender_stdout(report, **kwargs):
print(report)
return True
def sender_sns(report, **kwargs):
logging.info('sending report over SNS %s',os.environ['SNS_TOPIC'])
subject = 'ASG Subnet Audit Report'
return SNS(kwargs['region']).publish(
Topi... |
"""
zum etwas austesten und zwischenspeichern gedacht
"""
import random
# my_list = ['Holz', 'Wasser', 'Mücke']
#
# print(my_list[my_list.index('Holz')+1])
# print(my_list.index('Holz')+1)
#
# my_dict = {'item': {
# 'potion': {
# 'manapotion': 3,
# 'healingpotion... |
'''
Created on 2017年2月4日
@author: admin
import userinfo # 导入函数
# 获取字典数据
info = userinfo.zidian()
# 通过 items() 循环读取元组(键/值对)
for us, pw in info.items():
print(us)
print(pw)
'''
import csv # 导入 csv 包
from _csv import Dialect
# 读取本地 CSV 文件
my_file = 'F:\\workspace\\hola world\\selenium\\userinfo.csv'
data=csv.re... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# The above encoding declaration is required and the file must be saved as UTF-8
"""
Якщо одного слова для змістовної назви недостатньо, слова в імені змінної розділюються підкресленням.
Int - цілі числа: 1, 2, 0, -10, 9999 і т.д.
Відображаються просто як числа.
Для перетворен... |
import os
import sys
import urllib2
import subprocess
from copy import deepcopy
from distutils import version
PYTHON_VERSIONS = ['2.6', '2.7', '3.1', '3.2', '3.3', '3.4']
SCRIPT = """
# Create virtual environment
/opt/local/bin/virtualenv-{pv} -v {full}
# Install Cython
{full}/bin/pip install Cython
"""
def setup_v... |
diccionario ={
"redes_socioales":["Twitter","Facebook","LidenIn"],
3:"Tres",
"hola":"Mundo"
}
print "ver diccionario: \n",diccionario
print "existe hola :",diccionario.has_key("hola")
print "ver en forma de lista :\n",diccionario.items()
print "ver lista de key :\n",diccionario.keys()
print "ver lista de los va... |
# Libraries
import json
import os
from flask import Flask, render_template, request, redirect, jsonify, \
abort, url_for, session, _request_ctx_stack, flash
from flask_cors import CORS
from six.moves.urllib.parse import urlencode
import sys
import datetime
from sqlalchemy import func, desc, join
# Constants for Au... |
def b2a_hex(val: any) -> bytes: ...
def a2b_hex(val: str) -> bytes: ...
|
import utils_tasks as utils
import hydra
import os
import logging
log = logging.getLogger(__name__)
def run_task(task):
log.info(f"Task name: {task.name}")
task_args = task.args if "args" in task else ""
task_args = task_args.replace("$\\", "\\$")
command = f"CUDA_VISIBLE_DEVICES={utils.WORKER_CUDA_... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='CreateProfile',
fields=[
('id', models.AutoFiel... |
"""
* Copyright 2020, Departamento de sistemas y Computación,
* Universidad de Los Andes
*
*
* Desarrolado para el curso ISIS1225 - Estructuras de Datos y Algoritmos
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published b... |
from build_manifest import build_manifest
from diff_maker import diff_maker
if __name__ == "__main__":
diff_maker.build_diff_files('src','CCC')
build_manifest.custom_package_xml_generator('CCC') |
jack_age = int(input())
alex_age = int(input())
lana_age = int(input())
print(min(alex_age, jack_age, lana_age))
|
# Importing Modules
import os
from fpdf import *
from docx2pdf import convert
from tkinter import *
from tkinter import filedialog, messagebox, simpledialog
from emoji import emojize
# Making global variables and dictionaries
select = 0
values = {"Docx to PDF": "1", "Txt to PDF": "2"}
file_path = ''
path =... |
import os
import smtplib
import hashlib
import logging
import traceback
from datetime import datetime
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from ckanpackager.lib.utils import BadRequestError
from ckanpackager.lib.resource_file import ResourceFile
from ckanpackager.lib.stati... |
class Borg:
"""Borg pattern making the class attributes global"""
_shared_data = {} #Attribute dictionary
def __init__(self):
self.__dict__ = self._shared_data # Make it attribute dictonary
class Singleton(Borg): #inherits from the Borg class
"""This class now shares all its attributes a... |
from . import szh
# 示例
# 本地测试访问地址 http://localhost:5000/interGroup
@szh.route('/interGroup')
def add_fri():
return '进入群成功'
|
# pieces.py --- includes all class declarations for the various chess pieces
from moves import getPawnMoves, getRookMoves, getBishopMoves, getKnightMoves, getKingMoves, checkAllMoves, removeKingTake
class Piece:
def __init__(self, pos, colour):
self.pos = pos
self.colour = colour
self.moveN... |
# Import DQoc HTML from lp:ubuntu-ui-toolkit
import os, sys, re
import zlib
import simplejson
from django.core.files import File
from django.core.files.storage import get_storage_class
from ..models import *
from . import Importer
__all__ = (
'SphinxImporter',
)
SECTIONS = dict()
class SphinxImporter(Importe... |
# ******************************************
# * File: IfTest.py
# * A test program for if statement
# ******************************************
random.seed(time.clock())
x = random.randint(0,100)
y = random.randint(0,100)
print ("X = ", x, " Y = ", y)
if x == y:
print ('X is equal to Y')
else:
print ('X is... |
# Generated by Django 2.2.2 on 2019-08-01 15:28
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('contacts', '0016_auto_20190801_2023'),
]
operations = [
migrations.AddField(
model_name='inbox',
name='listing',
... |
"""
This file is part of pysofar: A client for interfacing with Sofar Ocean's Spotter API
Contents: Classes for representing devices and data grabbed from the API
Copyright 2019-2022
Sofar Ocean Technologies
Authors: Mike Sosa et al.
"""
from pysofar.sofar import SofarApi, WaveDataQuery
# --------------------- Dev... |
data=[8,1,7,9,6,5,10]
data=[7,8,9,1,2,3,4,-100,-99,6,7]
data=[9]
data=[]
length = len(data)
num=[0 for i in range(0,length)]
res = [0 for i in range(0,length)]
sample=[[-1 for i in range(0,length)] for j in range(0,length)]
for i in range(0,length):
for j in range(0,length):
sample[i][j] = data[j]
sample=[... |
import prompt
from typing import Callable
from brain_games.games.game_types import Game
ATTEMPTS = 3
def run(rules: str,
create_game: Callable[[], Game],
name: str) -> None:
print(rules)
def game(attempts):
if attempts == 0:
return print(f"Congratulations, {name}!")
... |
from django import forms
from .models import Contact
from captcha.fields import CaptchaField
class ContactForm(forms.ModelForm):
captcha = CaptchaField()
class Meta:
model = Contact
fields = ('name', 'email', 'text', 'captcha') |
def isPalindrome(string):
return string[::-1] == string
A = input()
a = isPalindrome(A)
if a:
print(1)
else:
print(0)
# Done
|
import esp
import machine
import network
import dht
from bme280 import BME280
import ujson as json
from utime import sleep
from umqtt.simple import MQTTClient
MQTT_SERVER = "10.254.0.1"
SENSOR_NAME = "afra-t1"
DHT_TOPIC = "afra-t1"
BME_TOPIC = "afra-t2"
GPIO_DHT = 26
GPIO_SCL = 22
GPIO_SDA = 21
# how often it shoul... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 19 15:04:08 2018
@author: ravila
"""
from Bio import SeqIO
import glob
import pandas as pd
from multiprocessing import Pool
import numpy as np
import sys
def get_reading_frame(seq, n):
"""Takes a sequence string and an integer shift
retrun... |
import pymysql.cursors
connection = pymysql.connect(host=#'hostname',
user=#'username',
password=#'password',
db=#'dbname',
charset=#'utf8',
cursorclass=pymysql.cursors.DictCursor)... |
from kts_linguistics.corpora.corpora import Corpora
from kts_linguistics.spellcheck.spellfix import spellfix_word
from kts_linguistics.string_transforms.abstract_transform import AbstractByWordTransform
class SpellfixTransform(AbstractByWordTransform):
def __init__(self,
corpora: Corpora,
... |
from transformers import ElectraForSequenceClassification
from utils_electra import ElectraClassificationHeadCustom
def get_last_dropout(model):
if isinstance(model, ElectraForSequenceClassification):
if isinstance(model.classifier, ElectraClassificationHeadCustom):
return model.classifier.dro... |
__all__ = ["BaseModel","CardModel","HeroModel"] |
from flask import Flask, redirect, url_for, render_template
app = Flask(__name__)
@app.route('/<name>')
def home(name):
return render_template("index.html", content=name, radiation=999, gang=["joe", "mama", "kek"])
@app.route("/admin")
def admin():
return redirect(url_for("home"))
if __name__ == '__main__':... |
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import unittest
import pytest
from pants.option.option_value_container import OptionValueContainerBuilder
from pants.option.ranked_value import Rank, RankedValue
class OptionValueConta... |
#!/usr/bin/env python3
import matplotlib.pyplot as plt
import numpy as np
import sys
sys.path.append('../../py')
from DREAM.DREAMOutput import DREAMOutput
do = DREAMOutput('output.h5')
do.eqsys.T_cold.plot(t=[0,5,10,15,-1], show=False)
plt.show()
|
n = int(input())
d = []
e = []
c = 0
for i in range(n):
temp = input().split()
if temp[1] == "D":
d.append(int(temp[0]))
else:
e.append(int(temp[0]))
for s in d:
if s in e:
c += 1
e.pop(e.index(s))
print(c)
|
"""Update user tables
Revision ID: 43cda5e14cf0
Revises: 3473402c38bc
Create Date: 2012-11-14 23:11:34.817678
"""
revision = '43cda5e14cf0'
down_revision = '3473402c38bc'
from alembic import op
import sqlalchemy as db
from datetime import datetime
def upgrade():
op.create_table('users',
db.Column('id'... |
# NameError: name 'pirnt' is not defined
# pirnt("hello")
# IndentationError: unexpected indent
# print("hello")
# SyntaxError: invalid syntax
# print("hello ") print("world")
|
import media
import fresh_tomatoes
import csv
# Define a function that read myMovie.csv
# and create Movie instance from the csv file
def get_movie_list(file_name):
# Initialize a list for storing movie data
movie_list = []
# Read file.csv and create media.Movie Instances
with open(file_name, 'rt') as movie_c... |
from .ResNet import *
from .googlenet import *
from .lenet import *
from .mobilenet import *
from .shufflenet import *
from .vgg import *
from .dpn import *
from .preact_resnet import *
from .senet import * |
inputFile = open("Day3\inputFile.txt","r")
inputTestFile = open("Day3\inputTestFile.txt","r")
Lines = inputFile.readlines()
def problem1():
"""
You start on the open square (.) in the top-left corner and need to reach the bottom (below the bottom-most row on your map).
The toboggan can only follow... |
import copy
will = ["Will", 28, ["Python", "C#", "JavaScript"]]
# wilber = copy.copy(will)
wilber = copy.deepcopy(will)
print(id(will))
print(will)
print([id(ele) for ele in will])
print(id(wilber))
print(wilber)
print([id(ele) for ele in wilber])
print('--------------------------------------')
will[0] = "Wilb... |
nomeCompleto = input('Digite o seu nome e o sobrenome: ')
nome,sobrenome = nomeCompleto.split(' ')
print(f'seu nome e {nome} {sobrenome}')
|
class Datum:
def __init__(self,val,err):
self.val = val
self.err = err
def __add__(self, other):
import math as m
return Datum(self.val+other.val, m.sqrt(self.err**2+other.err**2) )
def __str__(self):
return "%f +/- %f"%(self.val, self.err)
class Person:
def __in... |
# Generated by Django 3.1 on 2020-09-03 13:27
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='MostRecent',
fields=[
('id', models.AutoField... |
try:
import amath.ext as _b
except ModuleNotFoundError:
print("_basic failed to import")
GammaN = 10
GammaR = 10.900511
GammaDk = [2.48574089138753565546e-5, 1.05142378581721974210, -3.45687097222016235469, 4.51227709466894823700,
-2.98285225323576655721, 1.05639711577126713077, -1.95428773191645869... |
"""
剑指 Offer 58 - II. 左旋转字符串
字符串的左旋转操作是把字符串前面的若干个字符转移到字符串的尾部。请定义一个函数实现字符串左旋转操作的功能。比如,输入字符串"abcdefg"和数字2,该函数
将返回左旋转两位得到的结果"cdefgab"。
"""
"""
其实还是栈堆的知识,就不赘述了。
"""
def reverseLeftWords(s: str, n: int) -> str:
return s[n:] +s[:n]
if __name__ == '__main__':
res = reverseLeftWords("abcde",1)
print(res) |
from django.test import TestCase
from apps.jogo.models import Jogo
from apps.jogo.mixins.tabuleiro import Tabuleiro
class JogoTestCase(TestCase):
def setUp(self):
self.jogo = Jogo()
self.tabuleiro = Tabuleiro()
self.jogo.iniciar_jogo()
for n in range(1,301):
self.jogo.... |
from django import forms
import django_tables2 as tables
from orderedtable.models import Project
CHOICE = (
('distance', 'distance'),
('rate', 'rate'),
('project_size', 'project_size'),
('completion_date', 'completion_date'),
)
class ImportJson(forms.Form):
json = forms.FileField(required=True)
... |
"""
Robotritons testing version of gps navigation.
Purpose: Use reliable GPS data to control vehicle speed and calculate waypoint heading.
Requirements: A vehicle with at least one speed controller and one servo, and one Ublox NEO-M8N Standard Precision GNSS Module. The python modules sys, time, spidev, math, navio.ut... |
import sys
from PySide2.QtWidgets import QWidget, QMessageBox, QApplication
import pandas as pd
from PySide2.QtGui import QTextCursor
from Funkcje.SzukanieMetodDlaMiar.searchingBestMethodCelinskiHarabasz import szukanieCH
from Funkcje.SzukanieMetodDlaMiar.searchingBestMethodDaviesBoudlin import szukanieDaviesBoudlin... |
import re
import unittest
import datetime
import time
import validator.utils
#----------------------------------------------------------------------------------------------
class lhcbTest(unittest.TestCase):
def __init__(self, test_name, entry, value, test_class):
unittest.TestCase.__init__(self, test_na... |
import numpy as np
import warnings
from sklearn.model_selection import KFold, RepeatedKFold
class DoubleMLResampling:
def __init__(self,
n_folds,
n_rep,
n_obs,
apply_cross_fitting):
self.n_folds = n_folds
self.n_rep = n_rep
... |
# -*- coding: utf-8 -*-
class Environment:
def __init__(self, parent=None):
self.bindings = {}
self.parent = parent
def __getitem__(self, key):
return self.bindings[key] if key in self.bindings else self.parent[key]
def __setitem__(self, key, value):
self.bindings[key] = ... |
"""PSIT2017"""
import pygal #เรียกใช้ Pygal
def main():
"""Render Employee or Unemployee"""
chart = pygal.Line(title='กราฟเส้นแสดงตัวเลขผู้ว่างงานและผู้มีงานทำของคนไทยทั่วประเทศ ระหว่างปี 2550-2559') #ชื่อกราฟ แสดงอยู่บนสุด
chart.x_labels = ('2550', '2551', '2552', '2553', '2554', '2555', '2556', '2557', '2... |
import boto3
region = 'us-west-2'
ec2client = boto3.client('ec2', region_name=region)
response = client.create_volume(
AvailabilityZone='region',
# Encrypted=True|False,
# Iops=123,
# KmsKeyId='string',
# OutpostArn='string',
# Size=123,
SnapshotId='snap-09adcc2b712086452',
VolumeTyp... |
#!/usr/bin/env python3
#
# This file is part of LUNA.
#
# Copyright (c) 2020 Great Scott Gadgets <info@greatscottgadgets.com>
# SPDX-License-Identifier: BSD-3-Clause
import os
from amaranth import Elaboratable, Module, Cat
from usb_protocol.emitters import DeviceDescriptorCollection
from luna ... |
import pygame
import pygame.camera
from pygame.locals import *
from datetime import datetime
from BluetoothCom import BluetoothComm
# Steering angle must be from -180 to 180
# used DroidCam to use phone camera for video streaming to the laptop
DEVICE = '/dev/video0'
SIZE = (640, 480)
# folder where images will be ... |
def warcaby(matrix, gracz):
rows = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H']
retValue = ""
for i in range(8):
for j in range(8):
if matrix[i][j] == 1:
if i + 1 <= 6 and j + 1 <= 6:
if matrix[i + 1][j + 1] == 2 and matrix[i + 2][j + 2] == 0:
... |
import csv
import face_recognition
import pickle
"""
csv_reader = csv.reader(open('../data/train.csv', encoding='utf-8'))
train_imgs = []
train_img_codings = []
train_labels = []
count = 0
try:
for item in csv_reader:
img_path = '%s%s' % ('../data/train/', item[0])
img = face_recognition.load_image... |
#------------------------------------------------------------------------------#
# Imports
#------------------------------------------------------------------------------#
from flask import Flask, render_template, jsonify, abort, request
from flask.ext.sqlalchemy import SQLAlchemy
import string
import random
import dat... |
import uuid
def create_a_not_really_a_secret():
return uuid.uuid4() # lgtm [py/not-sensitive-data]
def main():
print(create_a_not_really_a_secret())
main()
|
from rubicon_ml.viz.common.dropdown_header import dropdown_header
__all__ = ["dropdown_header"]
|
n = int(input())
d = 0
x = 0
for i in range(n):
j = [int(x) for x in input().split()]
if j[0] == j[1] - 1 or j[0] == j[1] - 2 or j[0] - 5 == j[1] - 1 or j[0] - 5 == j[1] - 2:
d += 1
else:
x += 1
print("dario" if d>x else "xerxes") |
i=input("Input a String:") #Taking an input string from the user
temp=i
if temp[::-1]==i: #Checking string is palindrome or not
print("The string is a palindrome")
else:
print("The string is not a palindrome")
|
import os
import json
class en_US():
def __init__(self):
with open(file=os.path.dirname(__file__)+"\\assest\\lang\\en_US.json",mode="r",encoding="utf-8") as f:
self.__langDict__=json.load(f)
class zh_TW():
def __init__(self):
with open(file=os.path.dirname(__file__)+"\\assest\\lang\... |
import cv2
import imutils
import time
model_path = "emotions-recognition-retail-0003.xml"
pbtxt_path = "emotions-recognition-retail-0003.bin"
net = cv2.dnn.readNet(model_path, pbtxt_path)
face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
cascade_scale = 1.2
cascade_neighbors = 6
minFaceSize =... |
# -*- coding: utf-8 -*-
from sqlalchemy.schema import Column, ForeignKey, UniqueConstraint
from sqlalchemy.types import Integer, String, Text, DateTime
from ..extensions import db
class Star(db.Model):
__tablename__ = 'stars'
id = Column(Integer, primary_key = True)
repo_id = Column(Integer)
user_id... |
# -*- encoding: utf-8 -*-
from openerp import models
import re
class res_partner(models.Model):
_inherit = 'res.partner'
def name_search(self, cr, user, name, args=None, operator='ilike',
context=None, limit=100):
if not args:
args = []
if context is None:
... |
# Solidity-Compatible EIP20/ERC20 Token
# Implements https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
# Author: Phil Daian
# The use of the uint256 datatype as in this token is not
# recommended, as it can pose security risks.
# This token is intended as a proof of concept towards
# language... |
class Persist:
def __init__(self, function):
self.function = function
def __call__(self, *args, **kwargs):
# We can add some code
# before function call
self.function(*args, **kwargs)
print(self.function)
print("DATABASE PERSISTANCE")
# We can also add... |
# FUNCOES UTEIS
def rl_quotes(value):
return '\'' + value + '\''
def r_quotes(value):
return value + '\''
def l_quotes(value):
return '\'' + value
def param_parse(param, sql):
for key, value in param.items():
if type(value) == str:
sql = sql.replace(key, rl_quot... |
from data import DataLoader
from data import DcardDataset
from data import customed_collate_fn
from data import cut_validation
import model
from args import get_args
import torch
from utils import save_training_args
from utils import check_save_path
from utils import set_random_seed
import os
import sys
import time
de... |
c = int(input('Primeiro termo da progressão: '))
r = int(input('Razão: '))
u = c + (10) * r
for c in range(c, u, r):
print(c, end=' . ') |
import json
import requests
from spotibot.core.objects import Time
from spotibot.core.objects.General import Image, ExternalUrl, ExternalId
from spotibot.mongo.utils.Handlers import object_handler, get_serializable
class Album:
"""Auto-generated attribute instantiation docstring for album
object (simplifie... |
#!/usr/bin/env python3
with open('input.txt', 'r') as f:
data = f.readline().strip()
#data = '{}' # 1 characters.
#data = '{{{}}}' # 6 characters.
#data = '{{},{}}' # 5 characters.
#data = '{{{},{},{{}}}}' # 16 characters.
#data = '{<a>,<a>,<a>,<a>}' # 1 characters.
#data = '{{<ab>},{<ab>},{<ab>},{<ab>}}' # 9 cha... |
a = set(range(1, 10001))
i = 1
while i <= 10000:
generated_num = sum([int(c) for c in str(i)]) + i
if generated_num in a:
a.remove(generated_num)
i += 1
for i in a:
print(i)
|
# This file is part of beets.
# Copyright 2016, Pedro Silva.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, mod... |
# -*- coding: utf-8 -*-
from flask import current_app
from ..extensions import db
from .models import *
|
from io import BytesIO
# noinspection PyPackageRequirements
import zopfli
from django.contrib.staticfiles.storage import ManifestStaticFilesStorage
from django.contrib.staticfiles.utils import matches_patterns
from django.core.files.base import File
class GzipMixin:
"""
Brings the Gzip-ability if mixed with ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.