text stringlengths 8 6.05M |
|---|
"""处理 okex ws 数据
"""
import json
import logging
import aioredis
from interceptor.interceptor import Interceptor, execute
from okws.ws.okex.decode import decode
from .candle import config as candle
from .normal import config as normal
logger = logging.getLogger(__name__)
class App(Interceptor):
MAX_ARRAY_LENGTH =... |
""""Classifies images using the dataset to train the model (features to be used mus be stored into files X,y)."""
import numpy as np
from skimage.io import imshow
from skimage.io import imread
from sklearn.preprocessing import normalize
from sklearn.neighbors import KNeighborsClassifier
from pickle import dump, load
... |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
# 时间函数
print "############################## 1. time时间模块"
# 时间间隔是以秒为单位的浮点小数
# 每个时间戳都以自从1970年1月1日午夜(历元)经过了多长时间来表示
import time # 引入 time 时间模块
a = time.time()
print '当前时间戳:' + str(a)
print "############################## 2. 时间元组"
# 用一个元组装起来的9组数字处理时间:
localtime = time.localt... |
from pathlib import Path
BASE_DIR = Path(__file__).parent
|
#Esse script devolve a corrente média de um csv gerado a apartir do log de voo gerado pela pixhawk e obtido pela qGroundControl
def corrente_media_de_um_logPX4_csv(nome_do_arquivo_ponto_csv):
import pandas as pd
import numpy as np
df = pd.read_csv(nome_do_arquivo_ponto_csv)
print(df.head())
corrente... |
for(int a0 = 0; a0 < T; a0++){
int L = in.nextInt();
long A = in.nextInt();
int N = in.nextInt();
int D = in.nextInt();
if (N<D || N>L || A<D){
System.out.println("SAD");
continue;
}
// Deal with th... |
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 3 18:42:01 2018
@author: lenovo
"""
import requests
from bs4 import BeautifulSoup
from datetime import datetime
from pandas import DataFrame
import math
import pandas as pd
class OperateHuanbao(object):
def __init__(self,dir_out='huanbao\\'):
self.... |
def partition(data, pivot_index, first_index, last_index):
pivot_value = data[pivot_index]
left_index = first_index
right_index = last_index
while True:
while left_index <= right_index and data[left_index] < pivot_value:
left_index += 1
while left_index <= right_index and ... |
# -*- coding: utf-8 -*-
import os
import sys
from elftools.elf.elffile import *
from elftools.common.exceptions import ELFError
import modules
from helper import Helper
class BinAnalyzer:
def __init__(self, args):
self.args = args
self.filelist = []
self.mod_list = modules.__all__
... |
n = int(input())
ans = [0 for i in range(n+1)]
ans[1] = 1
if n >= 2:
ans[2] = 2
for i in range(3, n+1):
ans[i] = ans[i-1]+ans[i-2]
print(ans[n] % 10007)
'''
1 2 3 5 8 13 21 34 55
''' |
X = int(input("Digite um número"))
lista = []
for i in range(1 , X+1):
if i %2 != 0:
lista.append(i)
print(lista)
|
from common.base import Base
from selenium import webdriver
import unittest
from time import sleep
login_url = "http://127.0.0.1:81/zentao/user-login-L3plbnRhby8=.html"
class LoginPage(Base):
#定位登录
loc_user = ("id","account")
loc_pwd = ("name","password")
loc_button = ("id","submit")
l... |
from models.reviews import ReviewSubmittal
from models.reviews import Review
import fastapi
from typing import Optional, List
from models.location import BeerPlace, Location
from services import review_service, beerplace_service
router = fastapi.APIRouter()
@router.get('/api/random_beerplace')
async def random_beerpl... |
from grpc_tools import protoc
protoc.main((
'',
'-I./todo/proto',
'--python_out=./todo/proto',
'--grpc_python_out=./todo/proto',
'./todo/proto/todo.proto',
)) |
from openspending.model import Dataset
from openspending.test import DatabaseTestCase, helpers as h
class MockEntry(dict):
name = "testentry"
label = "An Entry"
def __init__(self):
self['name'] = self.name
self['label'] = self.label
def make_dataset():
return Dataset(name='testdataset... |
import os
print("asdfsadf")
with open("sqlmap_list.txt") as f:
for line in f:
print(line)
os.system("python sqlmap\sqlmap.py " + line + ' --timeout=2') |
#munchkin_invaders.py
import sys
import pygame
from pygame.sprite import Group
#import class 'Settings' from settings.py
from settings import Settings
from game_stats import GameStats
from scoreboard import Scoreboard
from button import Button
#import class 'Ship' from ship.py
from ship import Ship
... |
from django.http import HttpResponse
from dialog_manager.serivices import get_all_intent
def index(request):
response = get_all_intent()
return HttpResponse(response)
|
from random import randint
import string
import requests
class Game:
LETTERS = string.ascii_uppercase[:27]
def __init__(self):
self.grid = []
for _ in range(0, 9):
self.grid.append(self.LETTERS[randint(0, 25)])
def is_valid(self, grid):
for i in grid:
if i ... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-12-19 04:52
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('nova', '0063_auto_20171219_1153'),
]
operations = [
migrations.AddField(
... |
import gym
from gym import wrappers, logger
import gridworld2
import numpy as np
import matplotlib
matplotlib.use("TkAgg")
from collections import defaultdict
''' init env'''
env = gym.make('gridworld-v1')
outdir = 'gridworld-v1/random-agent-results'
env = wrappers.Monitor(env, directory=outdir, force=... |
from .Node import Node
from .Stack import Stack
from .Queue import Queue
from .Link import Link
from .Bag import Bag
__about__ = ['Node', 'Stack', 'Queue', 'Link', 'Bag']
|
#!/usr/bin/env python
from setuptools import setup
CLASSIFIERS = """\
Development Status :: 4 - Beta
Intended Audience :: Science/Research
License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)
Operating System :: MacOS
Operating System :: Microsoft :: Windows
Operating System :: POSIX
Operating S... |
import pytest
import common
import sync
class TestSync:
@pytest.fixture(autouse=True)
def monkeypatch_clients(self, monkeypatch, mock_ddb_table, mock_box_client):
monkeypatch.setattr(common, "get_ddb_table", lambda: mock_ddb_table)
monkeypatch.setattr(common, "get_box_client", lambda: (mock_b... |
import web
import app
import application.models.model_main as model_main
render = web.template.render('application/views/carrito/', base="master.html")
class Pagar():
def GET(self):
try:
return render.pagar()
except Exception as e:
return "Error Pagar Controller" + str(e.ar... |
def count_vowels_consonants(word):
vowels = "aeiouyAEIOUY"
result_dictionary = {"vowels": 0, "consonants": 0}
for char in word:
if char in vowels:
result_dictionary["vowels"] += 1
else:
result_dictionary["consonants"] += 1
return result_dictionary
print(count_vo... |
from nltk.tokenize import word_tokenize
from nltk.corpus import stopwords
from KnowledgeEngine import KnowledgeEngine
import nltk
import pprint
from practnlptools.tools import Annotator
from NLPEngine import NaturalLanguageProcessor
from AnswerEngine import AnswerEngine
from Engine import Engine
"Engine main class"
c... |
import sys
input = sys.stdin.readline
#N個の変数v_1, ..., v_n
#Q個のクエリ
#各クエリはv_aにwを加えるという操作
#answerは各クエリに対してv_1 + ... + v_aを求める
#クエリごとにどんどんv_1, ..., v_nは更新される
#x-1となっているのは、リストが0番目からになっているから。
#x&(-x)で2進数で表した場合の最も下位にある1の位置を取り出すことができる。
#例えば,10 = 1010なら10を返し、7 = 111なら1を返す。
def main():
N, Q = map( int, input().split())
A... |
words_to_19 = ['one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen', 'seventeen', 'eighteen', 'nineteen']
words_len = map(lambda x: len(x), words_to_19)
words_teens = ['twenty', 'thirty', 'forty', 'fifty', 'sixty', 'seventy', 'e... |
a=float(input("zadej delku strany v cm: "))
nepravdiva_hodnota=a<0
if nepravdiva_hodnota:
print("debile")
elif a==0:
print("Nulova delka? Rly?")
else:
print("Obsah ctverce se stranou", a, "je", a*a, "cm2.")
print("Obvod ctverce se stranou", a, "je", 4*a, "cm.")
print("Kdyby to byl kruh, tak s polome... |
from RatVenture_functions import *
from RatVenture_classes import *
import sys
#Default values
v_filename = "save.txt"
v_location="0,0"
v_day = 1
v_rat_encounter = False
v_town_locations = ["0,0", "3,1", "5,2", "1,3", "4,6"]
v_orb_location = setOrbLocation(v_town_locations)
v_rat_king_alive = True
#Display Main Menu ... |
"""
Server to guess what ... serving ludos model.
This service is running a zmq client/server interface
to run the inference.
To access it, just connect to the server using
```
socket = context.socket(zmq.REQ)
socket.connect("tcp://IP_OF_THE_SERVER:PORT_OF_THE_SERVER")
```
The server expected request format and ser... |
def binary_to_decimal(binary_string):
return int(binary_string, base=2)
|
import math
def get_x_value(x):
return (x / 180) * math.pi
def get_factorial(degree):
factorial = 1
for i in range(1, degree + 1):
factorial *= i
return factorial
def get_sh_function_in_sequence(x, degree):
result = 0.0
for i in range(1, degree + 1):
degree = 2 * i - 1
... |
from django import forms
from django.forms import ModelForm
from .models import Article
class Form(ModelForm):
x = forms.IntegerField()
y = forms.IntegerField()
class Meta:
model = Article
fields = ['file_obj'] |
import sys
# This is a "glue" module
class Arguments:
def __init__(self):
self.argnum = len(sys.argv)
self.pdefault=1 #default value of p
self.pdef_unknown=0.5
self.pgranu = 4 # granularity for p, pgranu+1 discrete values from 0
# pclas is the matrix for c... |
Plane = [list(line.strip()) for line in open("input_11.txt").readlines()]
# Plane = [
# "L.LL.LL.LL",
# "LLLLLLL.LL",
# "L.L.L..L..",
# "LLLL.LL.LL",
# "L.LL.LL.LL",
# "L.LLLLL.LL",
# "..L.L.....",
# "LLLLLLLLLL",
# "L.LLLLLL.L",
# "L.LLLLL.LL",
# ]
W = len(Plane[0])
L = len(Plan... |
from django.apps import AppConfig
class MovieraterConfig(AppConfig):
name = 'movieRater'
|
from django.contrib import admin
from .models import Profile, Board, Photo, Reservation
# Register your models here.
admin.site.register(Profile)
admin.site.register(Board)
admin.site.register(Photo)
admin.site.register(Reservation)
|
import requests, sys
proxies = []
iter_proxies = []
def get_proxies(path="proxies.txt"):
global proxies
try:
with open(path, 'r') as file:
contents = file.readlines()
for i, x in enumerate(contents):
if x.lower() == 'none':
contents[i] = 'none'
else:
x = x.strip()
if x.count(":") > 2:... |
from renderer_strategy import WindowRendererStratgey
from map_registry import map_registry
from state import State
from constants import MessageID
from entity import create_entity_by_id
import pygame
class World(State):
def __init__(self, context, stack, map):
super().__init__()
self.context = con... |
from django.conf import settings
from apps.tests.utils import get_test_forms
def site(request):
test_form, test_formset = get_test_forms(request)
return {
'url_name': request.resolver_match.url_name,
'settings': settings,
'test_form': test_form,
'test_formset': test_formset,
... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import time
import sys
import io
import re
import math
import itertools
import collections
import bisect
#sys.stdin=file('input.txt')
#sys.stdout=file('output.txt','w')
#10**9+7
mod=1000000007
#mod=1777777777
pi=3.141592653589
IS=float('inf')
xy=[(1,0),(-1,0),(0,1),(0,-1)]
... |
#coding:utf-8
from selenium import webdriver
import time
driver = webdriver.Chrome()
driver =webdriver.Chrome()
driver .set_window_size(1080,800)
driver.implicitly_wait(20)
driver.get('http://www.scholat.com/login.html')
#username
time.sleep(1)
#driver.find_element_by_id("login_user").click()
driver.find_element_b... |
# Copyright (C) 2009 Kevin Ollivier All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and th... |
#! /usr/bin/python3
import matplotlib.pyplot as pylab
def isfetc_1D(L_list, min_spacing, rel_perm_list, salt_conc, pH, site_density, p_doping_density, n_doping_density, req_char, T, pK1, pK2, steric):
if steric==True:
import ISFETsolverSteric as isfs
else:
import I... |
def get_whole_play_n(l):
play_n = 0
for each in l:
play_n += each[1]
return play_n
def solution(genres, plays):
music_dict = {}
answer = []
for i, gp in enumerate(zip(genres, plays)):
g, p = gp
if g not in music_dict:
music_dict[g] = [(i, p)]
else:
... |
#Como utilizar cores no terminal em python
#Usando o codigo ANSI '\033[m
#Style(0,1,4, 7)
#text(30 até 37)
#Background (40 até 47)
print('Olá mundo!')
print('\033[31mOlá mundo!')
print('\033[32;43mOlá mundo!')
print('\033[1;34;43mOlá mundo!')
print('\033[1;35;43mOlá mundo!\033[m')
print('\033[7;30;45mOlá mundo!\033[m')... |
"""
We will use this script to teach Python to absolute beginners
The script is an example of salary calculation implemented in Python
The salary calculator:
Net_Income = Gross_Income - Taxable_Due
Taxable_Due = taxable_income + Social_security + Medicare_tax
Taxable_Income = Gross_Income -120,00
Soci... |
# Generated by Django 3.2.3 on 2021-08-03 16:10
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('movie', '0009_alter_backgroundphoto_image'),
]
operations = [
migrations.AddField(
model_name='movie',
name='tagline... |
from .djdt_flamegraph import FlamegraphPanel
|
#!/usr/bin/env python
from numpy.lib.npyio import save
import rospy
import rospkg
import cv2
import time
import numpy as np
import sys
from cv_bridge import CvBridge
from sensor_msgs.msg import Image
import os
def on_new_image(msg):
global frame_msg
frame_msg = msg
def create_input_label(frame):
img_lab... |
# Generated by Django 2.2.11 on 2020-04-12 15:02
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('wishlist', '0002_auto_20200412_1759'),
]
operations = [
migrations.RenameField(
model_name='wishlistmodel',
old_name='produ... |
import numpy as np
def mean_absolute_percentage_error(y_true, y_pred):
y_true, y_pred = np.array(y_true), np.array(y_pred)
return np.mean(np.abs((y_true - y_pred) / y_true)) * 100
def mean_absolute_error(y_true, y_pred):
y_true, y_pred = np.array(y_true), np.array(y_pred)
x = np.mean(np.abs(y_true -... |
#Import necessary packages
import cv2
import math, operator
import functools
def sendmail():
print("Accident: Send message to Control Room")
#Function to find difference in frames
def diffImg(t0, t1, t2):
d1 = cv2.absdiff(t2, t1)
d2 = cv2.absdiff(t1, t0)
return cv2.bitwise_and(d1, d2)
#Import video from... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('course_selection', '0014_auto_20150103_0906'),
]
operations = [
migrations.AlterField(
model_name='course_listin... |
# -*- coding:utf-8 -*-
# @Time:2021/3/6 18:48
# @Author: explorespace
# @Email: cyberspacecloner@qq.com
# @File: SVMwithSMO.py
# software: PyCharm
import numpy as np
import matplotlib.pyplot as plt
from sklearn.datasets import make_blobs, make_circles, make_moons
from sklearn.preprocessing import StandardScaler
cla... |
"""
test_djdt_flamegraph
----------------------------------
Tests for `djdt_flamegraph` module.
"""
import unittest
from djdt_flamegraph import djdt_flamegraph
from djdt_flamegraph import FlamegraphPanel
from djdt_flamegraph import flamegraph
class TestDjdtFlamegraph(unittest.TestCase):
def setUp(self):
... |
from .resnet3d import Resnet3DBuilder
|
import sys
def countingValleys(n, s):
current = 0
valleys = 0
for i in range(n):
j = 1 if s[i] == 'U' else -1
if current == 0 and j == -1:
valleys += 1
current += j
return valleys
if __name__ == '__main__':
lines = [i.strip() for i in sys.stdin]
n = int(lines[0])
s = lines[1]
result = countingVa... |
'''this is to test verious algorithms for determining the peice size of a torrent'''
def test(torrentSize):
#piece size = 2^(19+floor(max[Log[2, x] - 28, 0]/2)) # http://www.wolframalpha.com/input/?i=2%5E(19%2Bfloor(max%5BLog%5B2,+x%5D+-+28,+0%5D%2F2)),+x%3D1024*1024*1024*1024%2B1
#number of peices = ceil(x/2^... |
import os
class FileHandler:
def __init__(self, path):
self.path = path
def get(self):
with open(self.path) as data_file:
data = data_file.read()
return data
def set(self, data):
with open(self.path) as data_file:
data_file.write(data)
def del... |
import datetime as dt
import time
import quick_start
import Events_storage as EVENTS_STORAGE
def add_events(events):
for event in events:
# start = event['start'].get('dateTime', event['start'].get('date'))
# print(start, event['summary'])
# print(event)
date_time_event_al... |
from ninja import Router
router = Router()
@router.get("/health")
def get_health(request):
return {"result": True}
|
from django.db import models
from major.models import Major
from teacher.models import Teacher
# Create your models here.
class Classes(models.Model):
name = models.CharField(max_length = 20)
major = models.ForeignKey(Major,on_delete=models.DO_NOTHING)
teacher = models.ForeignKey(Teacher,on_delete=models.... |
from django.db import models
# Create your models here.
class Check(models.Model):
venue = models.CharField(max_length=255, db_index=True)
timestamp = models.DateTimeField(auto_now_add=True)
location_id = models.CharField(max_length=255, default="", db_index=True)
location = models.CharField(max_length... |
from was import app, db
from was.models import *
from was.utils import token, smtp
from was.decorators import args, auth
from urllib.request import urljoin
from flask import request, jsonify, render_template
from pony.orm import db_session, core
from datetime import datetime, timedelta
@app.route('/account/registerNew... |
# Pythom program to make an introduction
name = input('My name is Maeve. What is your name?\n')
print ('Hi,', name)
|
from tkinter import ttk
from tkinter import *
from db_class import Profile
window = Tk()
window.geometry("1000x500")
path = "Profiles.sql"
def View():
profiles = Profile(path)
data = profiles.get_all_profiles()
for profile in data:
print(profile) # it print all records in the database
tr... |
# Generated by Django 3.1.5 on 2021-04-18 14:56
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('home', '0002_notesinfo_date'),
]
operations = [
migrations.AlterField(
model_name='notesinfo',
name='date',
... |
#ece366Project 2
import numpy as np
import array as ar
def hexdecode(char):
return {
'0':0,
'1':1,
'2':2,
'3':3,
'4':4,
'5':5,
'6':6,
'7':7,
'8':8,
'9':9,
'a':10,
'b':11,
'c':12,
'd'... |
import zipfile
import os
# add more dirs ....
dirs = ['icons']
def zipdir(path, ziph):
# ziph is zipfile handle
for root, dirs, files in os.walk(path):
for file in files:
ziph.write(os.path.join(root, file))
zf = zipfile.ZipFile('code.zip', 'w')
for d in dirs:
zipdir(d, zf)
# if you... |
import tarfile
import os
from collections import defaultdict
from pprint import pprint
import cPickle as pickle
import numpy as np
import string
##this can only be run on meez02, computes the document frequency of each hashtag, creates a dictionary object where each key is the #hastag and value is the df (number of... |
import xml.etree.ElementTree as ET
import os
import re
from json import dumps
from pathlib import Path
import urllib.request, json
import time
import requests
from datetime import datetime
from datetime import date
# Gets the file path
def getFilePath():
cwd_path = os.path.dirname(os.path.abspath(__f... |
import os
import re
from typing import Tuple, List
class FileWriter:
def write(self, outdata: List[Tuple[str, str]], pathdir=os.getcwd() + "/tests/out/"):
'''The method write all files to a directory "pathdir"'''
pathdir = os.path.abspath(pathdir)
if not os.path.isdir(pathdir):
... |
import numpy as np
from textblob import TextBlob
import sqlite3
import flask
import requests
# i need asr code to generate speech and send it to a server with a timestamp along with the direction of sound at the time
#an endpoint to save it to a words table
@app.route('/word/', methods=['GET', 'POST'])
def... |
import numpy as np
import glob
from core.shelper import *
import logging
from model import sbss_net
from keras.utils import np_utils
import h5py
import os
def main(data_path, n_segments, data_save_path):
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
data_path_folder_names = os.listdir... |
import time
import requests
import pandas as pd
from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
import json
import win32com.client
import pypandoc
mainUrl="https://www.1800petmeds.com"
options = Options()
options.add_argument('--headless'... |
#Advanced HOUSE PRICE PREDICTIONS
# PART 1 :- Getting the Data
#Import the libraries
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
#Import the Dataset
train_df=pd.read_csv('train.csv')
test_df=pd.read_csv('test.csv')
#PART 2:-... |
# 전에 풀었던 문제인데 정확도와 효율성을 높이고자 하였으나.. 실패해서 예전에 풀었던 코드를 올립니다
def solution(food, k):
if sum(food) <= k:
return -1
L = len(food)
m = k // L # k번이 food를 돌 수 있는 최소 횟수 라고 생각
# 최소 횟수에 따른 food 처리 (m바퀴를 이미 돌았다 가정)
for i in range(L):
if food[i] <= m:
k -= food[i]
... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Mar 8 16:10:13 2019
@author: kai
"""
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 4 17:15:52 2019
@author: kai
"""
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as pt
import ti... |
from PyQt5.QtCore import QDateTime,Qt
datetime = QDateTime.currentDateTime()
print("Today Date And Time Is:"+datetime.toString(Qt.ISODate))
print("Adding 12 Days To The Date: {0}".format(datetime.addDays(12).toString(Qt.ISODate)))
print("Subtracting 25 Days:{0}".format(datetime.addDays(-25).toString(Qt.ISODate)))
pr... |
import subprocess
print (subprocess.checkoutput(["run_workflow.sh", "Consensus", donor, gnos_or_igcg]))
|
import logging
import socket
import os
import sys
HULU_ENV = os.environ.get("HULU_ENV", "dev")
HULU_DC = os.environ.get("HULU_DC", "els")
DONKI = os.getenv("DONKI", False)
SERVICE_NAME = "requestflow"
DOPPLER_NAME = "requestflow"
HOSTNAME = socket.gethostname()
BANC_PORT = os.getenv("BANC_PORT")
BANC_HOST = "127.0.0.... |
""" -------------------------------------------------------------------------------------------------------------------
ITEC 136: Lab 03
Develop a program that asks the user to enter a text.
The program should analyze the text and print out unique letters,
in alphabetical order,
with the percentage information... |
import sys
def get_lower_and_upper_bound(n):
i = 1
while pow(i, 3) < n:
i *= 2
if pow(i, 3) == n:
return (i, i)
lower = i // 2
upper = i
return (lower, upper)
def closest_to_n(n, lower, upper):
diff_below = n - pow(lower, 3)
diff_above = pow(upper, 3) - n
if d... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ui_dialog_information.ui'
#
# Created by: PyQt5 UI code generator 5.14.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Dialog_information(object):
def setupUi(self, Dialo... |
import numpy
import json
import csv
import collections
import operator
import codecs
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
region=[]
list_of_specialities=[]
spec_patient_analysis = collections.defaultdict(dict)
analyzed_data=collections.defaultdict(dict)
medicine_array=c... |
import tensorflow as tf
import numpy as np
# for generator
def get_conv2d_weights(name, shape, mask=None):
weights_initializer = tf.contrib.layers.xavier_initializer()
W = tf.get_variable(name, shape=shape, dtype=np.float32, initializer=weights_initializer)
if mask:
mask_filter = np.ones(shape, dty... |
from django.shortcuts import render
from rest_framework import viewsets
from .models import Project, ProjectMember
from .serializers import ProjectSerializer, ProjectMemberSerializer
# Create your views here.
class ProjectViewSet(viewsets.ModelViewSet):
queryset = Project.objects.all()
serializer_class = ... |
class Solution:
def longestValidParentheses(self, s: str) -> int:
max_len = 0
dp = [0 for _ in range(len(s))]
for i in range(1, len(s)):
if s[i] == ')':
if s[i - 1] == '(':
dp[i] = dp[i - 2] + 2 if i >= 2 else 2
elif s[i - 1] ==... |
# -*- coding: utf-8 -*-
"""
Created on Fri Feb 2 10:52:55 2018
@author: lcristovao
"""
from keras.models import Sequential
from keras.layers import Dense
from keras.models import model_from_json
import numpy
import os
import pandas as pd
from sklearn import preprocessing
def categoricalToNumeric(array):
le = pr... |
from django.db import models
from django.contrib.auth.models import User
from django.utils import timezone
class ClientsGroup(models.Model):
name = models.CharField(max_length=30)
def __str__(self):
return self.name
class ScootersGroup(models.Model):
name = models.CharField(max_length=30)
... |
spam_lines = [" ".join(x.split("\t")[1:]) for x in open("../data/SMSSpamCollection") if x.split('\t')[0] == "spam"]
ham_lines = [" ".join(x.split("\t")[1:]) for x in open("../data/SMSSpamCollection") if x.split('\t')[0] == "ham"]
print(" ".join(ham_lines))
|
import logSetup
if __name__ == "__main__":
print("Initializing logging")
logSetup.initLogging()
import TextScrape.TextScrapeBase
import readability.readability
import bs4
import webFunctions
class Scrape(TextScrape.TextScrapeBase.TextScraper):
tableKey = 'yora'
loggerPath = 'Main.Yor.Scrape'
pluginName = 'Yor... |
# coding: utf-8
class Solution(object):
def isAnagram(self, s, t):
"""
:type s: str
:type t: str
:rtype: bool
"""
d = {}
for c in s:
if c in d:
d[c] += 1
else:
d[c] = 1
for c in t:
i... |
# Módulo destinado a escribir las estructuras de datos que serán ser utilizadas
class Node:
def __init__(self, value=None):
self.value = value
self.next = None
def __lt__(self, other):
if self.value < other.value:
return True
else:
return False
de... |
{
'name': 'Delphinus',
'author': 'Optesis SA',
'version': '1.4.0',
'category': 'Tools',
'description': """
permet de faire une descripotion ...
""",
'summary': 'Module de ...',
'sequence': 9,
'depends': ['base', 'account', 'account_accountant', 'purchase','sale','jt_amount_in_words']... |
#!/usr/bin/env python
# coding: utf-8
import pkg_resources
extensions = [
'sphinx.ext.autodoc',
]
templates_path = ['_templates']
source_suffix = '.rst'
master_doc = 'index'
project = 'ircproto'
author = u'Alex Grönholm'
copyright = '2016, ' + author
v = pkg_resources.get_distribution('ircproto').parsed_version
... |
'''Shorty App Settings'''
from django.conf import settings
ADMIN_ENABLED = getattr(settings, 'SHORTY_ADMIN_ENABLED', True)
EXTERNAL_FLAG = getattr(settings, 'SHORTY_EXTERNAL_FLAG', False)
CANONICAL_DOMAIN = getattr(settings, 'SHORTY_CANONICAL_DOMAIN', None)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.