index int64 0 1,000k | blob_id stringlengths 40 40 | code stringlengths 7 10.4M |
|---|---|---|
986,900 | 5ea8778ed55731df707beaa878df3c44bc6a5857 | import cv2
# Face classifier
face_detector = cv2.CascadeClassifier(r'C:/Users/ymatse/Smile_detector/haarcascade_frontalface_default.xml')
smile_detector = cv2.CascadeClassifier(r'C:/Users/ymatse/Smile_detector/haarcascade_smile.xml')
# Grab Webcam feed
webcam = cv2.VideoCapture(0)
# Show the current frame
while ... |
986,901 | d0969c48fdf16bd31104d12dad1442806250fafd | #! /usr/bin/env python
# -*- coding:utf-8 -*-
# @Time : 2020/7/23 9:32 AM
# @Author: zhangzhihui.wisdom
# @File:generator.py
# the method of creating generator :
# the first method : only change the list comprehension [] to {}
# L = [x * x for x in range(10)]
# g = (x * x for x in range(10)) L is a list,while g is a g... |
986,902 | 452350f342839e8e2a1fb1ae83e52fcb34de7773 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'mainwidget.ui'
#
# Created by: PyQt5 UI code generator 5.8.2
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_mainForm(object):
def setupUi(self, mainForm):
mainForm.s... |
986,903 | d73499ace5cddebddef6fbdbf6a59441b968c3b3 | import pandas as pd
import numpy as np
def get_ticker(ticker):
data = pd.read_csv('stock_data.csv')
cik = data[data['Ticker'] == ticker]['CIK'].item()
name = data[data['Ticker'] == ticker]['Name'].item()
exchange = data[data['Ticker'] == ticker]['Exchange'].item()
return cik, name, exchange |
986,904 | 5d35bca0c9ff731eea98971ff9f0545765440ec7 | # Write a program, which find all the numbers between 100 and 500
# such that each digit of the number is odd and then print the numbers.
# For example, 111 is the first number between 100 and 500 which all the digits are odd.
# you may want to use for loop, and list to program this task)
num1 = 100
num_list = [... |
986,905 | 2ce82b829671a158eb392ad2eddd931a3ab1086f | import opennlpModels
from opennlpModels import SentenceDetector
from opennlpModels import Tokenizer
from opennlpModels import NameFinder
from opennlpModels import PosTagger
from opennlpModels import Chunker
a = Chunker()
a.setInputFile("tempBuffer/chunkerInput.txt")
a.run()
a.printOutput()
|
986,906 | 7485322804a283eef530d81725fe25b979f205c6 | from django.db import models
class Document(models.Model):
docfile = models.FileField(upload_to='videos/%Y/%m/%d')
|
986,907 | 4b203714d20dae8ded6b838427e3967ca71c868b | import numpy as np
import matplotlib.pyplot as plt
# 参考该 https://matplotlib.org/2.0.2/contents.html
x = np.linspace(-2*np.pi, 2*np.pi, 256)
# 画画sin和cos线
cos = np.cos(x)
sin = np.sin(x)
plt.plot(x, cos, '--', linewidth=2)
plt.plot(x, sin)
plt.show() |
986,908 | 06921893916f9c8f1d02d9e219a66e00b79c19ae | '''
Python Starter Code
>> python main.py
'''
import os
import requests
from datetime import datetime
URL = "https://lyft-vingkan.c9users.io"
TEAM = os.environ["TEAM_SECRET"]
'''
Helper Methods
'''
# Get Trips
def get_trips(query):
query["team"] = TEAM
response = requests.get(URL + "/trips/", params=query)
retur... |
986,909 | f2eceb92ca4c86ce027b0a120f51ef3e244808e4 | # wrapper around python.platform
import platform
import getpass
def origin_hostname():
return getpass.getuser()
def origin_hardname():
return platform.node() |
986,910 | c88f06340bae9353130c64c1ee25be89474758fa | #demonstrate slice of strings
word="pizza"
print(word[:])
print(
"""
0 1 2 3 4 5
+--+--+--+--+--+
| p| i| z| z| a|
+--+--+--+--+--+
-5-4 -3 -2 -1
"""
)
print("Enter start and end index for slice 'pizza' which you want")
print("Press Enter to exit, not enter start index")
start=None
while start!="":
start=(i... |
986,911 | 26f2663a148144af76f36e3f17ce9c5c7420f9ad | import os
import ctypes
import functools
from .hk_define import *
from .hk_struct import LPNET_DVR_DEVICEINFO_V30, NET_DVR_FOCUSMODE_CFG, NET_DVR_JPEGPARA
from .hikvision_infrared import get_temper_info
# 禁止使用logging模块
def _release_wrapper(func):
@functools.wraps(func)
def inner(*args, **kwargs):
re... |
986,912 | d68581d367a957022d4555f7a30ed6d0e8a0214d | # Task 1
import time
class TrafficLight:
def __init__(self):
self._color_1 = 'red'
self._color_2 = 'yellow'
self._color_3 = 'green'
def running(self):
print(self._color_1)
time.sleep(7)
print(self._color_2)
time.sleep(2)
print(self._color_3)
... |
986,913 | 939e5f5f713ef0e67ad9d75fd4e263cb59d814d5 | '''
本模块的任务是获取求职列表
'''
from spider4 import Spider4
import re #引入正则模块
from urllib import request #引入数据请求模块
class Spider3():
def __init__(self, url):
self.url = url
root_pattern = '"job_href":"([\s\S]*?)","job_name"' #相关信息正则表达式-类变量
'''
抓取数据方法fetch_content
'''
def fetch_content(s... |
986,914 | 906448853099d29a8b7bdb906f77543e30feb154 |
#NLP Sentiment Analysis
from google.cloud import language
from google.cloud.language import enums
from google.cloud.language import types
from google.cloud import bigtable
#Import the necessary methods from tweepy library
from tweepy.streaming import StreamListener
from tweepy import OAuthHandler
from tw... |
986,915 | e8b357b1c1407f393eef02b2b39245410909800e | #!/Library/Frameworks/Python.framework/Versions/3.9/bin/python3
from DoublyLinkedList import DoublyLinkedList
from os import system
import copy
listLinked=DoublyLinkedList(5)
option=1
while option!='0':
system("clear")
print('1. Insert End')
print('2. Delete First')
print('3. Get')
print('4. Show List')
... |
986,916 | 2c818fc974b5e158299ff498d9bd783cd6867224 | # Copyright (c) Huoty, All rights reserved
# Author: Huoty <sudohuoty@163.com>
import sys
from dnspx.cli import main
if __name__ == "__main__":
sys.argv[0] = "dnspx"
sys.exit(main())
|
986,917 | d9856f7143024c2ee72b463ab0e6e7b02dfb0436 | import matplotlib.pyplot as plt
import numpy as np
from score_post import time_basic_score
from taylorDiagram import plot_daylor_graph
from taylorDiagram import plot_daylor_graph_new
fontsize = 14
def plot_categories(fig0, obs, mod, j):
[h_obs, d_obs, m_obs, y_obs, h_t_obs, d_t_obs, m_t_obs, y_t_obs] = obs
[h_... |
986,918 | 72959a838c71747f6b4bc878dda1821735b5c9c4 | from django.db import models
from datetime import datetime
from django.utils import timezone
from django.utils.html import format_html
# Create your models here.
class ApiKey(models.Model):
url = models.TextField()
userId = models.CharField(max_length=255)
authKey = models.CharField(max_length=255)
st... |
986,919 | 5746804655b28aa7a49aa5c73a97d58e2736679a | import matplotlib.pyplot as pl
import socket, time, sys, traceback, math, json, random, string, numpy as np
try:
import audiodev, audiospeex
except:
print 'cannot load audiodev.so and audiospeex.so, please set the PYTHONPATH'
traceback.print_exc()
sys.exit(-1)
def getTerminalSize():
import os
env =... |
986,920 | ff026a59f63303576c52d53e5eac041795be5e05 | #!/usr/bin/env python
# coding: utf-8
# # Homework 3 - Ames Housing Dataset
# For all parts below, answer all parts as shown in the Google document for Homework 3. Be sure to include both code that justifies your answer as well as text to answer the questions. We also ask that code be commented to make it easier to f... |
986,921 | faebb708ca7059ffdcb57938b2ef45fc4bdb7662 |
def fibo(n):
pre = 0
cur = 1
if n < 2:
return n
else:
for i in range(2, n+1):
pre, cur = cur, pre + cur
return cur
n = int(input())
print(fibo(n))
|
986,922 | 207116f6cd08a7262fd4e90cb99bbaff5aa50dba | #!/usr/bin/python3
#coding:utf-8
"""
主程序文件
"""
from flask import Flask
def create_app():
app = Flask(__name__)
app.config['SECRET_KEY'] = 'hello-world-2016'
from controller.home import home as home_blueprint
from controller.ghdn.home import ghdn as ghdn_blueprint
from controller.ghdn.drug import dr... |
986,923 | ec63bf9d7db9caafa0e1c3ebc82a2487e762731a | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
from __future__ import annotations
import array as ar
import functools
from abc import abstractmethod
from dataclasses import dataclass
from typing import (
Any,
Callable,
Dict,
Iterable,
List,
Literal,
Mapping,
O... |
986,924 | ff121508fee09e093a5044dc55c2a65892945acf | from typing import Any, Optional, Union
from executor.meta.env_var import must_extract_env_var
from executor.meta.meta import set_meta_information, has_meta_information, get_meta_information
__order_key = "order"
def has_order(obj: Any) -> bool:
return has_meta_information(obj, __order_key)
def get_order(obj:... |
986,925 | 7fc156f7b96cc2742effd447b5872df6148bbffc | def index_of_caps(word):
idxs = []
for idx, letter in enumerate(word):
if letter.isupper():
idxs.append(idx)
return idxs
print(index_of_caps("aLoR")) |
986,926 | 49a7a3fe71dd8c8470da2b0f5792ec728ef22254 | from datetime import datetime, timezone
from typing import List
from sqlalchemy.sql import and_, or_, select
from raddar.db.database import analysis, database, project, secret
from raddar.lib.managers.repository_manager import get_branch_name
from raddar.models import models
from raddar.schemas import schemas
async... |
986,927 | 2cf0e7c72308c87c7ccb8e69b052f4a083e95963 | from funkyrolodex import FunkyRolodex
import time
start_time = time.time()
parser = FunkyRolodex()
if __name__ == '__main__':
parser.process_entries('sample-shafayet.in')
parser.jsonify('result.out')
print time.time() - start_time, 'seconds'
|
986,928 | aa07a91b6af6aae37940af78409b4050fd903113 | #!/usr/bin/env python
# -*- coding: utf-8 -*
import sys
import rospy
import serial
reload(sys)
sys.setdefaultencoding('utf-8')
ser = serial.Serial('COM0', 38400)
print ser.isOpen()
def send(m_sspeed_x,m_sspeed_y,m_sspeed_w):
checksum = 0x00
m_state = 0x11
m_Estop = 0x00
m_cinstruction=[0,0,0, 0,0,... |
986,929 | b1529c895264103278c63baab45e52b2c230fb30 | # coding=utf-8
import pandas as pd
from pandas import DataFrame
import matplotlib.pyplot as plt
import numpy as np
import math
def NMI(A,B):
dict1=dict()
dict2=dict()
dict3=dict()
first=DataFrame({"A":A,"B":B})
tmp1=first["A"].groupby([first["A"],first["B"]])
tmp2=first["A"].groupby([first["A"]... |
986,930 | fa71b49e6d9a79c4df430b40b9a5f8d7a7a5fc2a | #! /usr/bin/env python3
import json
import urllib.request
import pandas as pd
from extractData import *
selectedCountries = ["China",
"Malaysia",
"Australia",
"New Zealand",
# "Italy",
# "Japan",
# "Singapore",
# "Norway... |
986,931 | 1497db63b47c656df1ff443cc69498e637b082c9 | #!/usr/bin/python
# -*-Python-script-*-
#
#/**
# * Title : http request status code
# * Auther : by Alex, Lee
# * Created : 06-11-2015
# * Modified : 06-18-2015
# * E-mail : cine0831@gmail.com
#**/
import os
import sys
import socket
import time
import threading
import httplib
import optparse
import time
import... |
986,932 | 2f56d55f6c1bb846a482a114e9a0034e5354cde8 | n = int(input())
a = list(map(int, input().split()))
z = []
for i in a:
if a.count(i)%2 == 1:
z.append(i)
z.sort()
ans = 0
z.reverse()
for i in range(len(z)-1):
if i%2 == 0:
ans+= z[i] - z[i+1]
print(ans) |
986,933 | f5dffb00919686e58c4c0299daf08dc164a6d2d9 | #!/usr/bin/env python3
from astropy.io import fits
import scipy as sp
import matplotlib.pyplot as plt
from astropy.convolution import convolve, Box1DKernel
class Spectrum:
#a class to read and store information from the .fits files of DR1 spectra
def __init__(self, path):
#takes the file path of the .... |
986,934 | 5baa83b4dab007d4227a8593dd25874ceaedd64c | __author__ = 'David Rapoport'
import requests
import os
from urllib2 import urlopen
import json
import datetime
from PIL import Image
from StringIO import StringIO
import sys
import time
import stat
import subprocess
import wx
from sys import argv
reload(sys)
sys.setdefaultencoding('UTF-8')
def fixCWKD():
path =os.g... |
986,935 | 82211b8aa766f6752b9f2505c23d1d332454137a | from typing import Optional, List, Tuple
from agoraapi.common.v3 import model_pb2
from agora import solana
from agora.solana import memo, token, system
from .creation import Creation
from .invoice import InvoiceList, Invoice
from .memo import AgoraMemo
from .payment import ReadOnlyPayment
from .transaction_type impor... |
986,936 | 268a7b7a594ada5751936ba1ae5e9e9526a7326a | # !/usr/bin/env python
# coding: utf-8
import os
import jinja2
from wildzh.utils import constants
__author__ = 'zhouhenglc'
abs_dir = os.path.abspath(os.path.dirname(__file__))
temp_dir = os.path.join(abs_dir, 'docx_template')
_ENV = jinja2.Environment()
class XmlObj(object):
temp_name = ""
temp_str = N... |
986,937 | 6d6a4911ea6a13ca49507e8a338136e98f003731 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# EXPLANATION:
# This file reads in the people.csv and the files from the /data folder, and
# uses these data to create the nodes-and-edges.js.
# -----------------------------------------------... |
986,938 | 612b3a83ac203237a5386800f2127473e557a71f | from flask import Flask
app = Flask(__name__)
@app.route('/', methods=['GET'])
def home():
return "<h1>GET API </h1><p> Create a get api using python flask</p>"
app.run()
|
986,939 | 40728aeb26d115866a7a18d5bd944e4b01aadcaf | import os
import das
sandia_info = {
'name': os.path.splitext(os.path.basename(__file__))[0],
'mode': 'Sandia DSM'
}
def das_info():
return sandia_info
def params(info, group_name=None):
gname = lambda name: group_name + '.' + name
pname = lambda name: group_name + '.' + GROUP_NAME + '.' + name
... |
986,940 | af4f1b93d4cb18933e9bd340b13c69ab5bfedd35 | # viewer_cluster.py
#Programmer: Tim Tyree
#Date: 3.22.2022
#the idea is to generate a lot of textures, batch_size, quickly on gpu, and then to make one task for each batch_size on a cpu processor that does matplotlib
from ..utils.parallel import eval_routine_daskbag
def eval_viewer_cluster(task_lst,routine_to_png,npa... |
986,941 | 64520b48a701fab205cf9007ab6bcf4d4cbf25d7 |
import networkx as nx
from math import sqrt, fabs
from sensors.pointsamplecam import PointSampleImage
#@profile
def extract_blobs_closest_points(this_robot, in_image, active_mask):
""" Extracts blobs from the given image, each represented by the pixel
closest to the robot. """
out_image = PointSampleImag... |
986,942 | 426be99cf83f2e8aae644b8d05a4955d96971fd3 | from corsair import init, set_color_corsair
from nzxt import set_color_nzxt
from razer import init_razer, set_color_razer, heartbeat_thread
import threading, time
from flask import Flask, request
from debounce import debounce
def from_hsv(hsv):
[h, s, v] = hsv
c = v * s
x = c * (1 - abs((h/60) % 2 - 1))
... |
986,943 | 8e67898af8e1d8a24681d4222f972d2fd3f5507a | # github.com/spokenlore
# Project Euler Problem 8
# What is the largest product that can be made with 13 consecutive numbers in this 1000 digit number?
# Answer: 23514624000
import time
from math import pow
fullNum = 7316717653133062491922511967442657474235534919493496983520312774506326239578318016984801869478851843... |
986,944 | 269ad5fa21b488f306cbfd5d9080e44fdfea4a83 | #!/usr/bin/env python
import sys
import time
import platform
import tkinter as tk
from ant.core import driver
from ant.core import node
from usb.core import find
from PowerMeterTx import PowerMeterTx
from config import DEBUG, LOG, NETKEY, POWER_SENSOR_ID
antnode = None
power_meter = None
def stop_ant():
if pow... |
986,945 | 6f6f3c15ecc4b3e9235bad0104f92fbc670dc5ee | import pandas as pd
import os
import numpy as np
import matplotlib.pyplot as plt
df = pd.read_csv("~/Desktop/adult.txt", header=None)
df = df.iloc[np.random.permutation(len(df))]
df.columns = ["age", "workclass", "fnlwgt", "education", "education-num", "maritalstatus", "occupation", "relationship",
"r... |
986,946 | 9f9bf15aeb4652b25d9d9057d757ab5244b72786 | import psutil
import sys
import getopt
def analyze(pid):
manager = psutil.Process(pid)
mem_percent = manager.memory_percent()
cpu_percent = manager.cpu_percent(interval=1)
mem_mb = mem_percent * 61.9 * 1024 * 0.01
cpu_core = cpu_percent * 0.01
with open("component_overhead.txt", 'w') as f:
... |
986,947 | e13ab6f7ad32bf9d069eed7cc46274eb327c2a93 | def updateArray(arr,n,idx,element):
arr.insert(idx, element)
#{
# Driver Code Starts
#Initial Template for Python 3
#contributed by RavinderSinghPB
if __name__ == '__main__':
tcs= int(input())
for _ in range(tcs):
n=int(input())
idx,element=[int(x) for x in input().split()]... |
986,948 | 5244c694033884528e956725551c9dd772687316 | from fastapi import FastAPI, HTTPException
from fastapi.responses import RedirectResponse, FileResponse
from os.path import isdir, isfile
from typing import Optional
app = FastAPI()
@app.get('/')
def return_file(filename: Optional[str] = ''):
if not filename:
return RedirectResponse('/?filename=index.ht... |
986,949 | d1289b5516923f12390a3ba8c14c055d4c406e35 | import unittest
from pubnub.endpoints.presence.get_state import GetState
try:
from mock import MagicMock
except ImportError:
from unittest.mock import MagicMock
from pubnub.pubnub import PubNub
from tests.helper import pnconf, sdk_name
from pubnub.managers import TelemetryManager
class TestGetState(unittes... |
986,950 | 208cc5472475cf334989712613886d1c9e926247 | #! /usr/bin/env python
print("Starting tempnode.py")
import rospy
from std_msgs.msg import String
from azmutils import dynamic_euclid_dist, str_to_obj, obj_to_str
import json
class tempnode():
"""
This class is adapted from theconstructsim.com ROS Basics in 5 Days course - Using Python Classes in ROS
It ... |
986,951 | 39c4065cc55672b67a4712d074bae645ba3387d7 | import csv
from operator import itemgetter
from sort import insertion_sort, merge_sort, heap_sort, quick_sort,bucket_sort,radix_sort
import time
def readFilesAndSort(filenameToSave,algorithm_choice):
filename = filenameToSave+'.csv'
unsorted_csv = open(filename,"r+")
reader = csv.reader(unsorted_csv)
data = []
... |
986,952 | 1ee0e4c22c84053248de76d947603166669367b7 | import re
def solution(s):
answer = s.lower()
p = re.compile("[\s][a-z]")
answer = p.sub(lambda m: m.group().upper(), answer)
answer = answer[:1].upper() + answer[1:]
return answer
|
986,953 | da741576c63a69e34117a120d1c66a67ea5fff18 | from computer import Computer
def test_case_pt_1():
opcodes = [int(code) for code in "3,0,4,0,99".split(",")]
Computer(opcodes).solve() # prints the value received as the input
def test_case_pt_2():
opcodes = [int(code) for code in "3,9,8,9,10,9,4,9,99,-1,8".split(",")]
Computer(opcodes).solve() #... |
986,954 | 9d56ccde9ef7a52afcb1af5205e229b7d5d17eea | import unittest
from transform import view_transform, scale, translate
from point import Point
from vector import Vector
import matrix
from matrix import Matrix
class TestTransform(unittest.TestCase):
def test_transform1(self):
pfrom = Point(0, 0, 0)
pto = Point(0, 0, -1)
vup = Vector(0, 1,... |
986,955 | d4009345b03eb733a7a61312e7dfde2ece1ff512 | for indice in range (32,36):
print("Tabla del ", indice)
for elemento in range(1,11)
resultado = indice*elemento
print("{2} x {0} = {1}".format(elemnto,resultado,indice))
print()
print()
print("otros valores")
print()
tablas= [21, 34, 54, 65,76]
for indicedice in tablas:
print("Tablas del", ind... |
986,956 | 98bd1b6f9006938d67e4de658f213de88af3b43e | """Establishes connection to `.ui` file and loads GUI"""
import os
import sys
import qt5reactor
from PyQt5 import uic
from PyQt5 import QtCore
from PyQt5.QtGui import QIcon, QFont
from PyQt5.QtWidgets import QMainWindow, QApplication, QTableWidgetItem
from twisted.internet import reactor, error
from scrapy import craw... |
986,957 | 08d7e126c74d542a4dad027505d6e68ab5492a1d | """Flask App Initialization"""
from flask import Flask
app = Flask(__name__)
from .main import *
|
986,958 | f2b2636943744bb2f8ccd93e9df82d2ea0ef375b | '''
Postprocess the strftime output to remove 0 padding.
''' |
986,959 | c027c55bc068505bde407dfd2b1c4066ba258251 | import tensorflow as tf
import importlib
import random
from preprocess.data_utils import utter_preprocess, is_reach_goal
class Target_Chat():
def __init__(self, agent):
self.agent = agent
self.start_utter = config_data._start_corpus
with tf.Session(config=self.agent.gpu_config) as sess:
... |
986,960 | 1a050bbefcc1dd2d7aed70c219d2a9f54a3f1c32 | #檢查檔案
import os #operating system 必須載入作業系統
products = [] #不管是否有找到都先使用空清單
if os.path.isfile('products.csv'): #相對路徑or 絕對路徑
#詢問作業系統此檔案是否在同資料夾中
print('是的,找到檔案')
#讀取檔案
with open('products.csv','r' , encoding='utf-8') as f:
for line in f:
if '商品,價格' in line:
continue #跳過,繼續下個迴圈
s = line.strip().split(',')
... |
986,961 | babdf1ae67bb42394c184aaca30c0d71fd120d45 | import unittest
from models import movie
Movie=movie.Movie
class MovieTest(unittest.TestCase):
def setUp(self):
self.new_movie=Movie(1234,'bad boys','awsome','https://ww.image.com',5.6,12345)
def test_instance(self):
self.assertTrue(isinstance(self.new_movie,Movie))
if __name__ ... |
986,962 | 8c33b1e1b937424aa690161666ea198b6866d94f | # proxy module
from __future__ import absolute_import
from apptools.preferences.ui.tree_item import *
|
986,963 | abb238333619e1547904e3969868c81bbdc914a7 | '''
Created on Jun 16, 2015
@author: baxter
'''
#!/usr/bin/env python
import roslib;
import rospy
import os,inspect
import time
import cv2
import numpy as np
from .homography import *
from .baxter import *
from geometry_msgs.msg import Point, PointStamped
from _dbus_bindings import String
from sys import argv
fro... |
986,964 | 864ca6c8e3907fdbc13057d8b8ab3e89eb1e37c1 | """
Pincer library
====================
An asynchronous python API wrapper meant to replace discord.py
Copyright Pincer 2021
Full MIT License can be found in `LICENSE` at the project root.
"""
from typing import NamedTuple, Literal, Optional
from pincer.client import Client, Bot
from pincer.commands impo... |
986,965 | a84e3bd830ce48b9da3c49f4e0013a07cbd20e49 | #!/bin/python
#coding=utf_8
# VERSION: 1.0.0
# Author: Benjamin Delaune Bioinformatic student team 11 CRCINA
# Date : 30/08/17
import sys,os,subprocess,gzip
import functions
#####################################################################################################################################
# Datab... |
986,966 | 18eb02dbf75b6adc5acac8873bca3377d22902b5 | import requests
from .utils import _convert
from .fields import FieldSet, RequestsField, RequestsList
class GrapheneRequests:
__slots__ = ('query', 'json')
def __init__(self, class_, query):
new_query = []
for set_ in query:
required = []
new_query.append(FieldSet(set... |
986,967 | 38e04a61e95ec8e7e22521c243d07fd53bba9494 | def main():
print('Handling files in this code')
file = open("file.txt")
for text in file:
print(text, end=" ")
if __name__=="__main__": main()
|
986,968 | ab436d99863a1a462d98b8d174e79808f1205805 | # -*- coding: UTF-8 -*-
#############################################
## (C)opyright by Dirk Holtwick, 2008 ##
## All rights reserved ##
#############################################
# import pyxer.helpers as h
# import pyxer.model as model
from webob import exc
# from formencode.htmlfill imp... |
986,969 | c49a0b610b533d4701d065f5dc281ede3c4eb0cf | # -*- coding: utf-8 -*-
from util import spider_util
from bs4 import BeautifulSoup
import json
import demjson
from pandas import DataFrame
from util import coordinate_util
def areaSnatch():
"""
抓取小学学区图位置信息
:return:
"""
# 小学学区
datas = []
primaryschool_url = 'http://map.28dat.net/inc/ftxx.js'
data = spider_util... |
986,970 | 20fdba5455acba89837283590aba51913b46b77c | #!/usr/bin/env
# -*- coding:utf-8 -*-
"""
Derive Pi by Monte Carlo method
version 1
I am gonna use nulti-threading.
- Sam Sun <sunjunjian@gmail.com>, 2012
"""
import random
import time
import threading
import io
# import timeit
class Counter:
def __init__(self):
self.total_number = 0
self.inside_number... |
986,971 | e83e7730ed9f4b12d05dec35ed9bcf2498a3ce61 | from collections import OrderedDict
from typing import Union, Mapping, Dict
class Headers(OrderedDict):
@classmethod
def from_bytes(cls, b: bytes):
if b'\r\n\r\n' in b:
b = b[:b.find(b'\r\n\r\n')]
headers: Dict[str, Union[str, int]] = Headers()
for line in b.split(b'\r\n')... |
986,972 | 850d02bbf7d3fffcb1dbb60fbb6dae0daec46bb3 | from rest_framework import routers
from .viewsets import ToDoViewSet
router = routers.DefaultRouter()
router.register('todo', ToDoViewSet, basename='todo')
|
986,973 | 73fc6d860bf293d4dfaeeadae0a0ba754832f966 | import os
APIARY_URL = os.environ['APIARY_URL']
KEY = os.environ['OPS_KEY']
SECRET = os.environ['OPS_SECRET']
|
986,974 | 3ffb072f7d70402025aa628a437c6cf5c9d85c0b | # based on the idea from
# https://github.com/andsens/bootstrap-vz/blob/5250f8233215f6f2e3a571be2f5cf3e09accd4b6/docs/transform_github_links.py
#
# Copyright 2013-2014 Anders Ingemann <anders@ingemann.de>
# Copyright 2016 Darragh Bailey <dbailey@hpe.com>
from docutils import nodes
import os.path
def transform_githu... |
986,975 | 47dfe408c7ad29758b4a3839e28fab22262b3cbf | # Sample Bar Graph- Generates A Bar Graph Of Sample Data
import matplotlib.pyplot as plt # Import Matplotlib
import numpy as np # Import Numpy
# Plotting Data
schl_names = ("Ravenna HS", "Theodore Roosevelt HS", "Hoover HS", "McKinley HS", "Stow-Munroe Falls HS")
population = [930, 1300, 1700, 900, 2000] # Population... |
986,976 | b4a823f1ae7a798b24a8c3d78b7b0cc0e7c612fa | # Generated by Django 2.0.5 on 2020-02-25 06:13
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('plus', '0060_auto_20200224_1449'),
]
operations = [
migrations.AlterField(
model_name='plusplans',
name='priority',
... |
986,977 | b888cb5cdf7db25ba7056eed2d2f640088b3312c | from quantdsl.semantics import Add, Choice, Fixing, Market, Min, Mult, Wait, inline
def PowerPlant(start, end, commodity, cold, step):
if (start < end):
Wait(start, Choice(
Add(
PowerPlant(start + step, end, commodity, Running(), step),
ProfitFromRunning(start, ... |
986,978 | 84e18900d8cd5f4cffbf23762d15d4a5ec5380ef | from flask import render_template
from . import scores
from . import spec
def configure(config, bp, score_processor):
@bp.route("/v1/", methods=["GET"])
def v1_index():
return render_template("swagger-ui.html", swagger_spec="/v1/spec/")
bp = scores.configure(config, bp, score_processor)
bp ... |
986,979 | 6583c727754f9b23992aa399baf774c5fd8c3d55 | #Discord
import discord
from discord.ext import commands
import pandas as pd
import random
#Token
from tokens import token
# Client
client = commands.Bot(command_prefix='%')
#Functions
#Commands
@client.command(name='version')
async def version(context):
emb=discord.Embed(title="Current Version", description="V... |
986,980 | 55a84f1d21f7d28e740083b94bc878c391e166df | #!/usr/bin/python
# There is a remote command execution vulnerability in Xiaomi Mi WiFi R3G before version stable 2.28.23.
# The backup file is in tar.gz format. After uploading, the application uses the tar zxf command to decompress,
# so you can control the contents of the files in the decompressed directory.
... |
986,981 | 2f8065ac849e3d7e96e7fb2616f5a0163f69fa63 | import matplotlib.pyplot as plt
import torch
from torch import nn
import torch.nn.functional as F
# define the class for the CNN-classifier
class CNN(nn.Module):
def __init__(self):
super(CNN, self).__init__()
self.conv1 = nn.Sequential( # input shape: (batch_size, 1, 28, 28)
... |
986,982 | 46ad8e2793b7f8e57eb839ad0d87f7123f2d6b59 | #!/usr/bin/env python
# coding: utf-8
# In[2]:
from __future__ import print_function, division
import matplotlib.pyplot as plt
import random
import numpy as np
import cv2
from PIL import Image
from PIL import ImageFont
from PIL import ImageDraw
import os
import urllib.request as urllib2
import torch
import torc... |
986,983 | 98ed44a75e81d4f7e60385c189a05b3e74a0020b | import os
import cloudinary
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
SQLALCHEMY_DATABASE_URI = 'sqlite:///' + BASE_DIR + "/app.db"
cloudinary.config(
cloud_name = "skols",
api_key = "877892686494448",
api_secret = "AkUW2f04FrIMpDK9Q4KPrNzxU7w"
) |
986,984 | f4ef0a82d3709661bc2d501f38bc645bb1510e94 | #!/usr/bin/python
'''
DESCRIPTION
-----------
Removing disease related pathways from pathways which are obtained via hipathia package.
USAGE
-----
[PROJECT_PATH]/$ python scripts/pathway_layer_data/1.2-pg-remove-disease-cancer.py -sp {SPECIES} -src {SOURCE}
RETURN
------
pathway_ids_and_names.csv : c... |
986,985 | c3f0f487fc22295608f09def929c4fda328633cb | from __future__ import unicode_literals
from django.apps import AppConfig
class Articles(AppConfig):
name = 'articles'
|
986,986 | 485ddf8c6b69ad55a1de289500696d1be60a97ef | # import seaborn as sns
# import matplotlib.pyplot as plt
# import numpy as np
# sns.set()
# f,ax=plt.subplots()
# C2= np.array([[176,27],[50,37]])
# sns.heatmap(C2,annot=True,ax=ax,fmt="d") #画热力图
#
# ax.set_title('confusion matrix') #标题
# ax.set_xlabel('predict') #x轴
# ax.set_ylabel('Postive') #y轴
# plt.show()
# plt.s... |
986,987 | 36b0db163a5ff4ea69bb530297c23fc64afd61ae | def printing():
os.system('clear')
# colour part, 0 is invisible
a0 = str(a[0])
a1 = str(a[1])
a2 = str(a[2])
a3 = str(a[3])
b0 = str(b[0])
b1 = str(b[1])
b2 = str(b[2])
b3 = str(b[3])
c0 = str(c[0])
c1 = str(c[1])
c2 = str(c[2])
c3 = str(c[3])
d0 = str(d[0])
d1 = str(d[1])
d2 = str(d[2])
d3 = str(d[3... |
986,988 | c4ad3b39066cf20d1e555d259ad6274c7a40e59c | import json
from BluenetLib.lib.packets.behaviour.BehaviourSubClasses import ActiveDays, BehaviourTimeContainer, BehaviourTime, \
BehaviourPresence
from BluenetLib.lib.packets.behaviour.BehaviourTypes import BehaviourType, BehaviourTimeType, DAY_START_TIME_SECONDS_SINCE_MIDNIGHT
from BluenetLib.lib.util.DataSteppe... |
986,989 | c9037ef24463d9ef868dfbda629c4ca6758c5f1d | from market.models import DatabaseModel
class User(DatabaseModel):
type = 'users'
def __init__(self, public_key, time_added, role_id=None, profile_id=None, loan_request_ids=None, campaign_ids=None, mortgage_ids=None, investment_ids=None):
super(User, self).__init__()
self._public_key = public... |
986,990 | aa2817acba8daf05ca353186e4faec4e4e9a52a1 | #!/usr/bin/env python
#-*- coding:utf-8 -*-
__author__ = 'wan'
import os,sys
import string
import time
import unittest
import random
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.support.ui import We... |
986,991 | c7d381ff0c30f1bf2b4a49f19a0b590a3f86395e | # Filename: moosegui.py
# Description: Graphical user interface of MOOSE simulator.
# Author: Subhasis Ray, Harsha Rani, Dilawar Singh
# Maintainer:
# Created: Mon Nov 12 09:38:09 2012 (+0530)
__author__ = 'Subhasis Ray , HarshaRani, Aviral Goel, NCBS Bangalore'
import sys
from PyQt5.QtWidgets import QApplication
fro... |
986,992 | 1eda40ef74f0ecf9bc5ed4a1fdde1f447a7563ef | from .arp_attack import ARPAttack |
986,993 | f31abd0d1de08be566fef071b9e1bf2f43264c7f | class Emp:
def emp1(self,name,age,salary):
self.n = name
self.a = age
self.s = salary
print "name:%r"%self.n + "Age:%r" %self.a + "salary:%r"%self.s
def allowance(self):
self.all = 1000
class Details:
def sala(self):
d = Emp()
d.em... |
986,994 | bc32fbd68527e32d53c4d4ae031ac389482a47ff | from configparser import ConfigParser
import psycopg2
import psycopg2.extras as psql_extras
import pandas as pd
from typing import Dict
def load_connection_info(
ini_filename: str
) -> Dict[str, str]:
parser = ConfigParser()
parser.read(ini_filename)
# Create a dictionary of the variables stored under... |
986,995 | aef6afceaaef81d13dbb3bf5dcc1b3114da7bf55 | import movealgorithm
from .. import board as b
from ..board import Board
from ..squid import Squid
import logging
import copy
class PlacementSubtraction(movealgorithm.MoveAlgorithm):
placementsTemplate = None
def __init__(self, board, squidLengths):
assert isinstance(board, Board), "Invalid parameter... |
986,996 | 7a7dffde5776f6b77b66f018f1d0dce731d0f326 | # -*- coding: utf-8 -*-
# See LICENSE file for full copyright and licensing details.
from odoo import models, fields, api
from odoo.exceptions import ValidationError,UserError
class Location(models.Model):
_inherit = "stock.location"
school_id = fields.Many2one('school.school', 'Campus', required=False)
class Pi... |
986,997 | 3a9df52fcc1dd9817c07054b9d864d542f125951 | # -*- coding: utf-8 -*-
import pickle
import pprint
import time
import h5py
import numpy as np
from pandas import DataFrame
import sys
sys.path.append('/Users/Ryan/code/python/hnsw-python')
from hnsw import HNSW
fr = open('glove-25-angular-balanced.ind','rb')
hnsw_n = pickle.load(fr)
f = h5py.File('glove-25-angula... |
986,998 | d9253306fea6336be888d364543f2930df2466cb | import random
data = ['shop', 'cup', 'third']
def func_add(tovar):
return tovar + ": "+ str(random.randint(1, len(tovar)))
data_tovars = map(func_add, data)
print(list(data_tovars))
print(data) |
986,999 | 09ad3be9127dc67f399260c5efacfae9faeb814e | import json
import pandas as pd
import nltk
from collections import Counter
from numpy.random import choice
START = "____START____"
END = "____END____"
def sample_from_choices(choices):
words, unnormalized_probs = tuple(zip(*choices.items()))
denom = sum(unnormalized_probs)
probs = [d / denom for d in un... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.