index int64 0 1,000k | blob_id stringlengths 40 40 | code stringlengths 7 10.4M |
|---|---|---|
988,000 | fe25e9f93fc6bb460c9a9a10ce277feb84aa76f0 | import time
from selenium import webdriver
import selenium
from selenium import webdriver
from selenium.webdriver.chrome.options import Options as ChromeOptions
# Give Language code in which you want to translate the text:=>
#lang_code = 'sq'
chrome_op = ChromeOptions()
chrome_op.add_argument('--headless')
... |
988,001 | 96ea8a322c122086b67ffba671eacf605227f63e | #ブロックを各方向に3つ配置するクラス
class ThreePutBlock():
#初期化(コンストラクタ)
def __init__(self, mc, blockName, pos):
self.blockName = blockName
self.pos = pos
self.mc = mc
#x座標方向にブロックを配置
def verticalXPlacement(self):
print(self.pos)
print(self.blockName)
self.mc.setBlocks(s... |
988,002 | 667744a611b6e9004b8c842818fdbd12d840500d | # -*- coding: utf-8 -*-
"""
Created on Mon Jul 31 22:10:50 2017
@author: user
"""
## Introduction to the Bag-of-words model
import numpy as np
from sklearn.feature_extraction.text import CountVectorizer
count = CountVectorizer()
docs = np.array([
'The sun is shining',
'The weather is sweet',
'... |
988,003 | cec085dd09db4b3a0b271d8f1b1570ceda834c50 | from sqlalchemy import Column, INT, CHAR, BOOLEAN, BLOB
from . import base
class Token(base.Base):
__tablename__ = 'token'
token = Column(CHAR(5), primary_key = True, autoincrement = False)
project_id = Column(INT, primary_key = True, autoincrement = False)
owner = Column(BLOB, nullable = False)
u... |
988,004 | f19749cc4be5bd06ce9695b50783b1ad9483ad57 | from tkinter import *
from pygame import mixer
from automatExeptions import TypeObjectException, NotStrException
def set_text(obj, text:str): ## elementy sterujące z obj i przypisanie text
"""
Ustawia tekst na kontrolki
Argumenty:
obj () - element sterujący
text (str) - tekst do napisania... |
988,005 | 2bb92d0c2becfa47ac957caa6e3a20371f6517c9 | from django import forms
from fishbytes.models import Catch
# class ProfileForm(forms.ModelForm):
# class Meta:
# model=User
# fields = ('username')
class CatchForm(forms.ModelForm):
size = forms.CharField(label="Size (inches):")
weight = forms.CharField(label="Weight (lbs):")
date = ... |
988,006 | 599f5840824f1460446d76ee6a3220e723b71263 | import os
import sys
import struct
import socket
from time import sleep
from optparse import OptionParser
#NOTE: due to the fact that the ethernet once transfer max is 1500bytes buffer
#and the command max is write config need 7int(28bytes),so we recommand you that
#once transfer command number max is not overflow 50 ... |
988,007 | 7d3aaf3018e3402e9a9f7395bf26645bbccdb3bb | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Demonstrate usage of LFPy.Network with network of ball-and-stick type
morphologies with active HH channels inserted in the somas and passive-leak
channels distributed throughout the apical dendrite. The corresponding
morphology and template specifications are in the file... |
988,008 | baf412a3085550a14cb7a1ef38c5c7a7978ad539 | # !/usr/bin/python
# -*- coding: UTF-8 -*-
"""
visdom,基础模型,正则化,动量,lr衰减
"""
import torch
from torch.utils.data import DataLoader
from torchvision import datasets, transforms
from visdom import Visdom
# pip install visdom
# python -m visdom.server / visdom
class MLP(torch.nn.Module):
def __init__(self) -> Non... |
988,009 | b95e3cfbc3eb7d797079071f2a4383bc6ed88ef9 | from botocore import session
import json
import datetime
from datetime import tzinfo
from dateutil.tz import *
import time
class StateFunctionWrapper(object):
"""A wrapper for State Function"""
def __init__(self, *args, **kwargs):
self._session = session.get_session()
self.client = self._sessi... |
988,010 | 4ccedcb381b0a8b573adaa77b6c8fd3033c77920 | """
Author: Srayan Gangopadhyay
2020-08-06
met.no symbol names mapped to emoji
"""
symbols = {
'fog': '🌫',
'heavyrain': '🌧',
'heavyrainandthunder': '⛈',
'heavyrainshowers_day': '🌧',
'heavyrainshowers_night': '🌧',
'heavyrainshowers_polartwilight': '🌧',
'heavyrainshowersandthunder_day':... |
988,011 | 3f38509080fe33991cf7193c27661f0f3679dac3 | # - Create a variable named `ai`
# with the following content: `[3, 4, 5, 6, 7]`
# - Print the sum of the elements in `ai`
ai =[ 3, 4, 5, 6, 7]
def summa(x):
total=0
for i in range(len(x)):
total+= x[i]
print(summa(ai)) |
988,012 | bcb9bc525f768b060eb138dce9a9ffc4cdaace70 | # -*- coding: utf-8 -*
class ConfigParam:
# params = {"embedding_size": 6, "feature_size": 0, "field_size": 0, "batch_size": 64, "learning_rate": 0.001,"epochs":200,
# "optimizer": "adam", "data_path": "../data/ml-1m/", "model_dir": "../data/model/essm/", "hidden_units":[8]}
def __init__(self... |
988,013 | 559f2a8cefa543431b1f339a52e435f59ec34a43 | n, m = [int(i) for i in input().split()]
MOD = 10**9+7
arr = [[0]*m for i in range(n)]
for i in range(n):
inp = input()
for j in range(m):
arr[i][j] = inp[j]
def solve(arr,n,m):
dp = [[0]*(m+1) for i in range(n+1)]
for i in range(1,n+1):
if arr[i-1][0]=='#':
break
... |
988,014 | 14099e2347bf092623a6f020a56d3c6fe5925597 | from django.db import models
from django.contrib.auth.models import User
from django.db.models.signals import post_save
def user_is_basenodeadmin(userobj, *basenode_modelsclasses):
"""
Check if the given user is admin on any of the given
``basenode_modelsclasses``.
:param basenode_modelsclasses:
... |
988,015 | 71471ad966704ecab1d1ec0e33c433ca36039829 | num1 = input("Enter the first number: ")
num2 = input("Enter the second number: ")
num3 = input("Enter the third number: ")
if num1 > num2:
if num1 > num3:
print(str(num1) + " is greater")
else:
print(str(num3) + " is greater")
else:
print(str(num2) + " is greater")
|
988,016 | 0512abc769cc8b621a1ee6cfa668a4d6b41e9984 | ii = [('CookGHP3.py', 1), ('MarrFDI.py', 1), ('SadlMLP.py', 2), ('UnitAI.py', 1), ('LeakWTI3.py', 1), ('ChalTPW2.py', 1), ('AdamWEP.py', 1), ('FitzRNS3.py', 49), ('WilkJMC2.py', 2), ('CrokTPS.py', 1), ('ClarGE.py', 1), ('LyelCPG.py', 1), ('AinsWRR.py', 1), ('BackGNE.py', 6), ('BachARE.py', 5), ('WestJIT.py', 1), ('Fitz... |
988,017 | d6a7b6d290650adcb76df256fcfc3772446385f6 |
def count_smileys(lst):
from re import match
return len([x for x in lst if match("[:;][-~]?[\)D]",x)])
|
988,018 | 76523f259ab1dd65607cfe46d9e56a1a510248a7 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.ParticipantInfo import ParticipantInfo
class AlipayCommerceEducateInfoParticipantCertifyModel(object):
def __init__(self):
self._apply_note_info = None
self._... |
988,019 | 3b88578086f3206a442e95abb4b88a0d2c17aab7 | from numpy import asarray
from numpy import arange
from numpy.random import rand
import math
import numpy as np
import argparse
def vector_arc_distance(v_1, v_2):
"""using two vectors with a length of 3, get the arc distances
based on https://stackoverflow.com/questions/52210911/great-circle-distance-between-... |
988,020 | 70bbb1d04bec0d9ec8f51ca2c37970c226dff963 | #!/usr/bin/python
from tkinter import *
import time
import math
import numpy as np
from sequence_generator import SequenceGenerator
SEQUENCE_DURATION_MS = 4000
# Noon, 3, Noon, 3, Noon, 9, Noon, 9
SEQUENCE = [0, 90, 0, 90, 0, -90, 0, -90]
# SEQUENCE = [0,90]
gui = Tk()
gui.geometry("800x800")
c = Canvas(gui ,width=8... |
988,021 | cfff891b6231b5399c1a0795c7dcde2665c1837a | # -*- coding: utf-8 -*-
import sys
sys.path.insert(0, 'src')
import json
import pickle
import zipfile
import os
os.environ['TF_CPP_MIN_LOG_LEVEL']='3'
import jieba
import keras
import numpy as np
from keras.applications.resnet50 import ResNet50
from keras.preprocessing.image import (load_img, img_to_array)
from tqdm i... |
988,022 | 56476b23c41882993a6a7a8d56dea9c95fff88b2 | import os
import io
import shlex
from datetime import datetime, timedelta
import getopt
import requests
from dogbot.cqsdk import CQImage, RcvdPrivateMessage
from PIL import Image
from config import config
from dogbot.cqsdk.utils import reply
BASE_URL = 'http://s3-ap-northeast-1.amazonaws.com/assets.millennium-war.net... |
988,023 | 9761985014678d04a67088e2817e98dd375bf0cc | from flask import Flask, render_template, g, request, redirect, url_for
import time
import RPi.GPIO as GPIO
app = Flask(__name__)
left_door = 24
right_door = 25
def open_door(door):
GPIO.setmode(GPIO.BCM)
GPIO.setup(door, GPIO.OUT, initial = GPIO.LOW)
GPIO.output(door, GPIO.HIGH)
time.sleep(.5)
... |
988,024 | 53d544b1878f041cfb51bfc2a49ae176ed9ad894 | # coding: utf-8
"""
FoneStorm API 2.4.0 (Thunder)
FracTEL's Middleware API
OpenAPI spec version: 2.4.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
# import models into model package
from .authorization import Authorization
from .... |
988,025 | 2fe5a9797f4da5deb1e5eece2ef574a8ab6e62ad | #list 복사
a= [1,2,3,4,5]
b=a
print(b)
print(id(a))
print(id(b))
print(a is b)
a[1]=8
print(b)
#[:] 같이 변경 X
a=[1,2,3]
b = a[:]
a[1] = 5
print(b)
print(a)
#copy 동일특성 [:]
from copy import copy
a = [1,2,3]
b = copy(a)
print(b is a)
#변수 만드는법
a,b = ('p','b')
(a, b) = 'p','b'
[a,b] = ['p','b']
a=b='b'
a,b = (3, 4)
a,b ... |
988,026 | 750407704c816481766086297c6c80df056e9420 | # %% [markdown]
# # データ構造と配列
# %%
import doctest
from typing import Any, MutableSequence, Sequence
import unittest
from unittest import result
from unittest.case import skip
import functools
# %% [markdown]
# ## データ構造と配列
# %% [markdown]
# ### 配列の必要性
class TestTotal(unittest.TestCase):
def test_5人の点数を読み込んで合計点平均点... |
988,027 | 970256ee81e13784efd6f58e9f1e3cb71c24bd65 | from launch import Packet
PROTOCOL = 1000
class Heartbeat(Packet):
protocol = 1000
type = 2000
|
988,028 | 698db856e58c39e7a579b0886a30fd85f22f8d51 | import logging
from sn_agent.job.job_descriptor import JobDescriptor
from sn_agent.ontology.service_descriptor import ServiceDescriptor
logger = logging.getLogger(__name__)
async def can_perform_service(app, service_descriptor: ServiceDescriptor):
logger.debug("get_can_perform: %s", service_descriptor)
ser... |
988,029 | 350e18f7c092fabc6ed7fa5b159e8eb8a8f1b4e5 | # Command line arguments: tax ids
# tax: path to taxonomy, e.g. ../../tax/ott/
# ids: path to ids file, e.g. ../../ids_that_are_otus.tsv
# To test:
# ../../bin/jython measure_coverage.py ../../t/tax/aster/ ../../ids_in_synthesis.tsv
from org.opentreeoflife.taxa import Taxonomy
import os, csv, sys
home = '../... |
988,030 | ba7d645282eb3d8b4b2755d4f0c5ba0ad05e5f89 | from fython.unit import *
class RPackageX(Unit):
unit = l.rpackagex |
988,031 | b0b2741b2cd18592bce5ba47db784a5477233970 | import doctest
import unittest
import buoy
unittest.TextTestRunner().run(doctest.DocTestSuite(buoy))
unittest.main()
|
988,032 | cb5d32fa1b828af82fa3b7390790b3e288860b3e | n=int(input())
s=input()
m=10**9+7
dict={}
for i in s:
if i not in dict:
dict[i]=1
else:
dict[i]+=1
ans=1
for i in dict:
ans*=dict[i]+1
print((ans-1)%m) |
988,033 | 66e171245fd3bb9c98f2e3e8cd7d8f77f30a12ab | import click
from parsec.cli import pass_context, json_loads
from parsec.decorators import custom_exception, text_output
@click.command('download_history')
@click.argument("history_id", type=str)
@click.argument("jeha_id", type=str)
@click.argument("outf", type=click.File('rb+'))
@click.option(
"--chunk_size",
... |
988,034 | f56e08a8f1d51d868bafcc805a61f6a3ee49ed22 | import dataloader as dl
import pandas as pd
import matplotlib.pyplot as plt
def get_turnover_sum(df):
res = df.groupby('date').sum()
res = res['turnover']
return res
def add_price_col(df):
res = df.copy()
res['price'] = (abs(res['turnover']) + abs(res['discount'])) / abs(res['quantity'])
return res
def add_di... |
988,035 | 1ea0aa03ca40953388632530e114ba2f4843fac9 | """
Facebook-DP-Downloader
Download the profile picture of any public profile on Facebook
by just having it's Facebook id
"""
import os
import requests
url="https://graph.facebook.com/{}/picture?type=large"
""" This url is the url provided by the Facebook graph api
which helps to get to the... |
988,036 | c35c12f94e5d36d63e4dd05a9c10ef6ec1752772 | # --------------------------------------------------------
# SpeechT5: Unified-Modal Encoder-Decoder Pre-Training for Spoken Language Processing (https://arxiv.org/abs/2110.07205)
# Github source: https://github.com/microsoft/SpeechT5/tree/main/SpeechT5
# Copyright (c) 2021 Microsoft
# Licensed under The MIT License [s... |
988,037 | 646c0ccf3ad5214291926efd8f5b2153531d9a53 | # encoding=utf8
from niapy.algorithms.basic import FlowerPollinationAlgorithm
from niapy.tests.test_algorithm import AlgorithmTestCase, MyProblem
class FPATestCase(AlgorithmTestCase):
def setUp(self):
AlgorithmTestCase.setUp(self)
self.algo = FlowerPollinationAlgorithm
def test_custom(self):
... |
988,038 | da4d46b72ab2a5ae167e7a881e3b08bda74d4660 | # -*- coding: utf-8 -*-
"""
Created on Sun Apr 5 13:07:14 2020
@author: James Cotter
"""
#import dictionary
from nltk.corpus import words
word_list = words.words()
def solver(letters,middle):
"""
Inputs:
letters: string, letters on the perimeter
middle: string, letter in the center (only one)... |
988,039 | 3eb6b7267b0266cd51d9b344bcfd42bbb758697a | import re
from datetime import datetime
from kconfig import chaptersBook, workGroupBook, labsBookByName
from kconfig import agileCalendar
from kernel.BacklogDeployer import BacklogDeployer
__author__ = "Manuel Escriche <mev@tid.es>"
__version__ = '1.2.0'
class IssueDefinition:
def __init__(self, action, sprint,... |
988,040 | cafafecc2fd65b5c5be897771404886ee957fe03 | # USAGE
# python color_kmeans.py --image images/jp.png --clusters 3
# import the necessary packages
from sklearn.cluster import KMeans
import matplotlib.pyplot as plt
import argparse, utils, os, cv2
args = {
'plot' : False,
'indir' : 'baltimore_images',
'outfile' : 'baltimore_features'
}
def make_hist(f, plo... |
988,041 | 6d73e5a2bf8981dbfd5fd46c628d57e80a7c49e5 | from app import app
from app import jobs
import time
import threading
import schedule
# 订阅 azz.net 某一个用户的最新作品
def subscribe_azz_user(username):
jobs.init_azz_net(username)
schedule.every(1).days.do(jobs.azz_net_job, username)
def subscribe_blog(key, func):
jobs.init_job(key, func)
schedule.every(15)... |
988,042 | c5f151a3be04cc6fe655f75a68db57fecf76962e | class Solution(object):
def calculate(self, s):
"""
:type s: str
:rtype: int
"""
#10:47
op = []
num = ''
sign = "+" #第一个数字
s = s.strip()
for i, c in enumerate(s):
if c.isdigit():
num += c
if c in ... |
988,043 | 957921649485af9a233b9f2cb19456617b8f60c7 | from django.urls import path, re_path
from . import views
urlpatterns = [
path('school_info/', views.school_list, name='school_info'),
path('school_info/<str:school_name>/', views.one_school, name='one_school'),
] |
988,044 | 94495aa0a16c6846dedd052f710bc667057a52e6 | # -*- coding: utf-8 -*-
"""
Created on Wed May 25 14:56:25 2016
实验,虚数
@author: aa
"""
from __future__ import division
from math import *
import numpy as np
import matplotlib.pyplot as plt
import scipy
A=np.array([[2,1+2j],[1-2j,3]])
dia,u=np.linalg.eig(A)
|
988,045 | efca715a56b771a385123208986638465632732d | s=str(input())
l=len(s)
ans=99999999999
for j in s:
temp=j
a=0
cnt=0
for i in range(l):
if s[i]!=temp:
cnt=cnt+1
else:
a=max(a,cnt)
cnt=0
a=max(a,cnt)
ans=min(a,ans)
print(ans) |
988,046 | a96c84cb6be77e6eb946bb8b8994af6963cb481b | # #*************************************************************
# File : msd.py
# Used for calculating MSD from trajectory files
# usage: python msd.py [-h] f atoms [name]
# positional arguments:
# f Name of the trajectory file
# atoms Total number of atoms
# optional arguments:
# na... |
988,047 | d08dbb1bcb3e515b95117eb3bfae673bbc22f2eb | from socket import *
import threading
from util.serverLog import *
from send.send import *
from util.jsonManager import *
from util.DBManager import updateIoTData
from util.DBManager import updateAndroidData
from util.DBManager import requestAndroidDataToIoT
from util.jsonManager import JsonToDataManager
from util.json... |
988,048 | d7dae77ea23cc3acd9725560f12775dcb67eca68 | def calcula_pi(n):
p = 1
a = list(range(n))
for i in (a):
p += (6/(i**2))
p = (p**(1/2))
return p |
988,049 | 1072a823d82efe3600107b7c92a05bbbfa69ac24 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import jwt
from django.conf import settings
from django.utils.translation import ugettext as _
from rest_framework import exceptions
from rest_framework.authentication import BaseAuthentication, get_authorization_header
from .models import AuthToken
cl... |
988,050 | b9ef8c01fea98ad6f5865d439630bf574e9b7b27 | import os
def op(num1,operation,num2):
num1 = int(num1)
num2 = int(num2)
if operation == "+":
return num1 + num2
elif operation == "-":
return num1 - num2
elif operation == "*":
return num1 * num2
elif operation == "/":
return num1 / num2
elif op... |
988,051 | a6c499e802bea6cb729f6760f1fa801992cc5084 | from django.db import models
class Job(models.Model):
image = models.ImageField(upload_to='images/')
title = models.CharField(max_length=80)
summary = models.CharField(max_length=200)
camera_model = models.CharField(max_length=120)
level = models.CharField(max_length=30)
photographer = models.... |
988,052 | 5be1bb2d970720d8364d423b6253e173fda97b97 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
CDR3translator
https://innate2adaptive.github.io/Decombinator/
Take decombined data and translates/extracts the CDR3 sequences.
In order to be classified as (potentially) productive, a rearrangement's CDR3s must be:
in-frame
lacking-stop codons
run from a cons... |
988,053 | 10133ffdebe5ed5fa76717f7359b46485a6ac54d | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2019/12/2 17:26
# @Author : 李亚东
# @Email : muziyadong@gmail.com
# @Software: PyCharm
from scrapy.cmdline import execute
execute(['scrapy','crawl','zhihuUser']) |
988,054 | 4a1e5b53070e0d032407c4f26de2e0c595a1c481 | import math
def determineOP(strOP):
op = [0, 0, 0, 33]
mLen = len(strOP) - 1
for i in range(mLen, -1, -1):
if i == mLen - 4:
op[0] = int(strOP[i])
elif i == mLen - 3:
op[1] = int(strOP[i])
elif i == mLen - 2:
op[2] = int(strOP[i])
elif i == mLen:
op[3] = int(s... |
988,055 | 899287e39c25b7b92baa494aba70e51d95edb4be | # author: Xiaote Zhu
import codecs
import json
import os
import datetime
import nltk
testDir = "../new_result/testData3"
predDirs = ["../new_result/predictions_sage3"]
global r
global c
r = 0
c = 0
def evaluate(predDir,dataDict):
global r, c
pred_count = 0
correct_count = 0
money = 1.0
predFile = codecs.open('%... |
988,056 | 7dc0ce9de312ad41a33a80bb96fe4fc5fdf655b7 | #!/usr/bin/python3
import os
class Color():
def __init__(self, rgb):
self.rgb = rgb
self.a = None
if len(rgb) == 3:
self.r = rgb[0]
self.g = rgb[1]
self.b = rgb[2]
elif len(rgb) == 6:
self.r = rgb[0:2]
self.g = rgb[2:4]
... |
988,057 | 0439a495136dab51fff016550b1e197457097b27 | import numpy as np
from bullet_safety_gym.envs import env_utils
from bullet_safety_gym.envs import bases, sensors, agents
from bullet_safety_gym.envs.obstacles import GoalZone, LineBoundary, CircleZone, \
Puck, Apple, Bomb
def angle2pos(pos1: np.ndarray, pos2: np.ndarray) -> float:
"""Calculate angle towards ... |
988,058 | 8340a4d311f78a5c56609db4889e1e5bd2fa91ff | #!/usr/bin/python
#encoding=UTF-8
import urllib,json,time,webbrowser,re
def get_data_from_tieba(pid):
def the_last_page(data):
return u'</head><body><div>您要浏览的贴子不存在<br/>' in data
def get_data():
p=1
while True:
data=urllib.urlopen("http://wapp.baidu.com/mo/m?kz=%s&pn=%d"%(pid,10*(p-1))).read().decode('... |
988,059 | f14131a95ad021a649769dfca9b3c78ec7f9a5d9 | import ML.ourML.NNModels as nnModels
import numpy as np
import tensorflow as tf
import cv2
from MLStatics import *
import random
class Scorer:
def __init__(self):
# Fix for GPU memory issue with TensorFlow 2.0 +
# https://stackoverflow.com/questions/41117740/tensorflow-crashes-with-cublas-status-... |
988,060 | ba381c66a33247d16515d4285ed434633579b345 | vv,ii,nn=map(int,input().split())
print(int((vv*ii)/(nn)))
|
988,061 | 071a6a925b14bf41218cfc2e6aae5e12a9390254 | import os.path
import pickle
from functools import reduce
from transactions.exception import InvalidTransactionException
class TransactionManager:
def __init__(self):
self.transactions = {}
if os.path.isfile("transactions.pkl"):
self.transactions = read_dict_from_file().transactions
... |
988,062 | d009b522123f26249b58eed17c865c0143bb5bcd | from __future__ import print_function
import numpy as np
from numpy.random import choice
from annsa.template_sampling import (apply_LLD,
rebin_spectrum,)
def choose_uranium_template(uranium_dataset,
sourcedist,
sourceheight,
... |
988,063 | cff746670ce9ec85ee250f8401c03981ca22d57f | # Copyright 2013 IBM Corp.
import powervc.common.client.extensions.base as base
from glanceclient.common import http
from glanceclient.common import utils
from glanceclient.v2 import image_members
from glanceclient.v2 import image_tags
from glanceclient.v2 import images
from glanceclient.v2 import schemas
class Ext... |
988,064 | cfd9fdbb6f8b5fc2b311a33bed378dca04b7d8f7 | #!/usr/bin/python3
'''
Test the module with an example.
'''
from matplotlib import pyplot
import numpy
import scipy.stats
import seaborn
import prob_spline
import test_common
import pandas as pd
msq_file = "Vector_Data(NoZeros).csv"
sigma_vals = 0
curve = prob_spline.MosCurve(msq_file,sigma_vals)
curve.plot()
|
988,065 | e4c7eb14ef54b1132c3484a59c1683c278e8b9d5 | __author__ = "akhtar"
def postorder_recursive(node):
"""
Recursive postorder traversal of a binary tree.
:param BTreeNode root: The root of the tree.
:return: nothing.
:rtype: None
"""
if node is None:
return
postorder_recursive(node.left)
postorder_recursive(node.rig... |
988,066 | a1a8536a6a951d9ec97dbe49022a92eb5c76e6cd | import numpy as np
import torch
from flame import FlameDecoder
import pyrender
import trimesh
from config import get_config
from vtkplotter import Plotter, datadir, Text2D, show, interactive
import vtkplotter.mesh
import time
from flame import FlameLandmarks
import os
import torch
import numpy as np
from tqdm import t... |
988,067 | a0f043672ef74fe4601c166cb9739ee64cbe4059 | from itertools import accumulate
from math import gcd
N = int(input())
*A, = map(int, input().split())
L = list(accumulate(A, gcd))
R = list(accumulate(A[::-1], gcd))[::-1]
ans = max(gcd(l, r) for l, r in zip([0]+L[:-1], R[1:]+[0]))
print(ans)
|
988,068 | edc98ecf9817908f78e050fcc879600d3e028dc4 | # Move this file into root folder of project !
import os
def main():
read_all_files(".", True)
def read_all_files(folder, root_folder: bool, nesting_depth: int = 0):
for file in os.listdir(folder):
if file in [".git", ".idea", ".project", ".settings"]:
continue
if ".p... |
988,069 | cd6326bb8d02b7e798e93ca8ff15c3ccd43c6fee | # -*- coding: utf-8 -*-
"""
Created on Mon Mar 12 14:51:47 2018
@author: Administrator
@description: numpy库操纵数组的一些方法
"""
import numpy as np
from numpy.matlib import randn
#定义数组类型
arr3 = np.array([1, 2, 3], dtype=np.float64)
arr4 = np.array([1, 2, 3], dtype=np.int32)
print(arr3.dtype)#float64
print(arr4.dtype)#in... |
988,070 | c9dfb846015d1b3e5e31d9aacdfb5a4e6489b75f | # -*- coding: utf-8 -*-
"""DNACenterAPI path_trace API fixtures and tests.
Copyright (c) 2019-2021 Cisco Systems.
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 wi... |
988,071 | 33512f5a23731c35508051e712722251659bed1c | import os
import argparse
import numpy as np
import torch
import torchvision
from torch import nn
import torch.nn.functional as nnf
import torch.optim as torchopt
import torch.nn.functional as F
from utils.data import *
from utils.networks import *
from utils.savedir import *
from utils.seeding import *
from utils.l... |
988,072 | f11454d8ee7c968042996a548954a10c4a44d35a | from application import db
from application.models import Base
from sqlalchemy.sql import text
class Sample(Base):
__tablename__="sample"
samplename = db.Column(db.String(144), nullable=False)
sampletype = db.Column(db.String(144), nullable=False, index=True)
species = db.Column(db.String(144), null... |
988,073 | 86788ac0a710542a7a6324e9b1482aabc0be3c11 | from django.db import models
from geopy import distance
# Create your models here.
class Occurrence(models.Model):
""" Describes the occurrence model"""
description = models.TextField(max_length=200, null=True, blank=True)
lat = models.FloatField(blank=True, default='')
lon = models.FloatField(blan... |
988,074 | 95a60dca8c52ed6760a9ba35b812687c7d4d013d | #!/usr/bin/env python
from kmexpert.cli import cli
def init_procedures():
# import here all relevant procedures
import example_procedure
if __name__ == '__main__':
init_procedures()
cli()
|
988,075 | bd196762dd1595934fcb855a83d691a02a5e86e1 | #!/usr/bin/env python3
import unittest
from ..recipe_reader import *
class TestAnnotatedRecipeReader(unittest.TestCase):
def test_test_setup(self):
self.assertTrue(True)
|
988,076 | e25e3f462503b12846d935a76b647ff294df0778 | import re
import json
from unittest import TestCase
from urllib import urlencode
from urlparse import urljoin, urlparse, parse_qs, urlunparse
from uuid import uuid4
import responses
import requests
from requests.auth import HTTPBasicAuth
from unicore.hub.client import AppClient, UserClient, ClientException
TICKET_I... |
988,077 | 5b1815f188aedce3bd63675a22d9c52877ec5895 | #!/usr/bin/env python2
# coding=utf-8
import argparse
import shutil
import sys
import tempfile
if sys.version_info.major == 2:
from pathlib2 import Path
else:
from pathlib import Path
def convert(rect_str):
"""把一条字符串转换为二级列表
rect_str: str, '561 281 33 25 608 285 32 26'
return: [[561, 201, 33, 25... |
988,078 | 775714b35c58505d5c3573326c0160b182913aed | #You have Python3 install to use this script
#Executing command
#$python3 pass_generator.py
string = input("Enter The Words You Want separated by commos :> ")
a = string.split(",")
n = (int(input("Enter number of Words you input above"))+1)
x = n
import itertools
for e in range(x):
for i in itertools.per... |
988,079 | a4a415477504e8f87bab5795771b21361ba6d090 | # Generated by Django 2.2.8 on 2022-04-21 07:27
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('events', '0008_attendanceform_description'),
('candidate', '0004_auto_20220404_1936'),
]
operations = [
... |
988,080 | a68aa23ba7f4fc7e4d9994feab89f732e7d1e4f3 | """
Tutorial - Object inheritance
You are free to derive your request handler classes from any base
class you wish. In most real-world applications, you will probably
want to create a central base class used for all your pages, which takes
care of things like printing a common page header and footer.
"""
import os.pa... |
988,081 | 5bff34ff04c5c69fef384bec7b077b1e455783e7 | # -*- coding: utf-8 -*-
"""microcms.models module, Page the core model of microcms.
THIS SOFTWARE IS UNDER BSD LICENSE.
Copyright (c) 2010-2012 Daniele Tricoli <eriol@mornie.org>
Read LICENSE for more informations.
"""
import datetime
from django.db import models
from django.contrib.auth.models import User
from djan... |
988,082 | 48f4266d25b68e30e13b9d76b806284d93107b88 | import os
import cv2
import numpy as np
import shutil
import json
import pickle
import glob
from pycocotools.coco import COCO
import colormap as colormap_utils
def vis_parsing(path, dir, colormap, im_ori, draw_contours):
parsing = cv2.imread(path, 0)
parsing_color_list = eval('colormap_utils.{}'.format(colorm... |
988,083 | d59f263b0bf1e7ea05b2f82a64e1ba3bb519f38c | from __future__ import print_function
import math
import os
import shelve
TABLE = "table"
DATA = "data"
CLASS = "class"
FILE_NAMES = "files"
FEATURE_NAMES = "features"
CLASS_MAL = 'M'
CLASS_BEN = 'B'
def convertToNumber(s):
return int.from_bytes(s.encode(), 'little')
def convertFromNumber(n):
return n.to_... |
988,084 | a44cc90990eed2fe1e7d663ab93eb7636fad176f | while True:
print "I have aids",
|
988,085 | 6f6f33236269029d132bfd857dc60b1e8f531b4d | # encoding=utf8
var1 = 'Hello World!'
var1 = "Python"
# 在 python 中赋值语句总是建立对象的引用值,而不是复制对象。因此,python 变量更像是指针,而不是数据存储区域,
print(var1)
# 三括号注释
var2 = """
>>> a = "asd"
>>> id(a)
4431000496
>>> a = "122"
>>> id(a)
4431000552
"""
print(var2)
# 第二部分
# 填充
var3 = "1234"
print(var3.center(10, "*"))
print(var3.ljust(10, '^'))
... |
988,086 | 50fc4a69b54c0e5d705be21278f71a2ca4a887ab | #!/usr/bin/env python3
class Donor:
def __init__(self, donor_id, age, sex, cells=[]):
self.donor_id = donor_id
self.age = age
self.sex = sex
self.cells = cells
class Cell:
def __init__(self, cell_barcode, sequenced_areas = []):
self.cell_barcode = cell_barcode
s... |
988,087 | 04d4b426f098025558222201d28f8bf1d0e47e44 | #This is a simple open a picture and display edges.
import cv2
import numpy as np
raw = cv2.imread("myTest.jpg")
img = cv2.imread("myTest.jpg", cv2.IMREAD_GRAYSCALE)
edges = cv2.Canny(img,200,200)
edgesBGR= cv2.cvtColor(edges,cv2.COLOR_GRAY2BGR)
rawEdges = cv2.add(raw,edgesBGR)
cv2.imshow('image',img)
cv2.imshow('ed... |
988,088 | 9aebbd588be262f69b1c07681e4fbc41995ad2ff | from bs4 import BeautifulSoup as bs
import requests as rq
import re
import pandas as pd
urlparts = ['http://www2.recife.pe.gov.br/servico/', '?op=NzQ0MQ==']
bairros = { \
'rpa1': ['bairro-do-recife',
'boa-vista',
'cabanga',
'coelhos',
'ilha-do-leite',
'ilha-joana-bezerra',
... |
988,089 | c318675f9890dab512ca0b10ef537a747a4833ff | import numpy as np
class AalenAdditive():
"""
Aalen's additive regression model
"""
def __init__(self, events, durations, X, entry_time = None):
"""
Params:
events (numpy.array): 0 or 1
durations (numpy.array): time at which event happened or observation was... |
988,090 | a3d24ddb10a03e078910b825032836145d9d7a06 | import random
import os
from flask import jsonify, request, render_template, redirect, url_for
from flask_wtf import FlaskForm
from wtforms import RadioField, TextField, TextAreaField, BooleanField
from wtforms import StringField, SelectMultipleField
from wtforms.validators import Required
from wtforms.widgets import L... |
988,091 | 0cc8a096bb5b1b81fa0268c78a698ba446d579c1 | import re
from urlparse import urlparse
import requests # Yes, you need to install that
from app import cache
def validateform(username):
if username==None:
return None
else:
if username.startswith('http://') or username.startswith('https://'):
try:
username = urlpa... |
988,092 | 4395bf4a95b42899e982b988144dc8009c8f879b | import RPi.GPIO as GPIO
button = 17
led = 18
GPIO.setmode(GPIO.BCM)
GPIO.setup(led,GPIO.OUT)
GPIO.setup(button,GPIO.IN)
while True:
if GPIO.input(button):
GPIO.output(led,GPIO.HIGH)
else:
GPIO.output(led,GPIO.LOW)
GPIO.cleanup()
|
988,093 | ddde8f981674abd40fc0043a4cdb296b84c86745 | # -*- coding: utf-8 -*-
"""
Created on Wed Aug 22 15:14:47 2018
Part 1 creating the multi-flavored option backtests: SAN
@author: dpsugasa
"""
import os, sys
import pandas as pd
from tia.bbg import LocalTerminal
import numpy as np
from datetime import datetime
from operator import itemgetter
import plotly
import plot... |
988,094 | bfd4368b219490c194b917ea98c89e234b9dc2c4 | from __future__ import annotations
from typing import List
from textual import events
from textual import messages
from textual.geometry import Size, SpacingDimensions
from textual.widget import Widget
from textual.view import View
from textual.layouts.vertical import VerticalLayout
from textual.views._window_view im... |
988,095 | 48b179f9f145098018dbe9d34642393e18e4f61c | """
This file contains method for topic assignment calculation on data.
Use calculate_assignments() for small data. (this method will return D x T dense matrix where D is the number of documents and T is the number of topics)
Use calculate_assignments_sparse() for large data. This will return D x T _sparse_ matrix whic... |
988,096 | 1418baeb7bbfd435fe5f40f7c06c4cabf2652119 | import sys
sys.stdin = open("도넛츠 합계.txt")
def donut(i, j):
global sum_edge_list
sum_edge = 0
for x in range(i, i+K):
for y in range(j, j+K):
if x == i or x == i+K-1:
sum_edge += data[x][y]
if y == j or y == j+K-1:
sum_edge += data[x][y]
... |
988,097 | d408934a887a1de45b7d36cfc8f607a65e290289 | import random
################# Fruit classes #################
class Fruit():
def __init__(self) -> None:
self.flavour, self.colour = random.choice(self.varieties)
def __repr__(self) -> str:
return f"<{self.flavour}, {self.colour}, {self.__class__.__name__}>"
class Apple(Fruit):
varie... |
988,098 | ef0024931e64dbf494b77f1833f793f2d0eca7ef | '''
Author:
Alexandros Kanterakis (kantale@ics.forth.gr)
This is a script to help grade exercises for this course
'''
import re
import os
import glob
import json
import email
import time
import argparse
import smtplib, ssl # For mail
import pandas as pd
from itertools import groupby
from collections import defaultd... |
988,099 | ef89794cd697007302b7e88a63a5c744b3dce877 | '''
@Author: your name
@Date: 2020-05-27 13:33:49
@LastEditTime: 2020-05-28 14:17:18
@LastEditors: Please set LastEditors
@Description: In User Settings Edit
@FilePath: /model-building/recommend/fm/inputs.py
'''
import tensorflow as tf
from collections import namedtuple
SparseFeature = namedtuple('SparseFeature', ['f... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.