index int64 0 1,000k | blob_id stringlengths 40 40 | code stringlengths 7 10.4M |
|---|---|---|
988,100 | 9f7f6351d1c8e5ecac307d1f0becdb44974c3dec | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import shutil
import fnmatch
import os
import subprocess
# ---------------------------------------------------------------------------------------------------------------------------------------
# Create Folder
# -----------------------------------------------------------... |
988,101 | d05f493b9f0cd8a16e7ebd209fb7cb0b97c9678e | import pytest
import numpy as np
from pypif import pif
import random as rnd
from citrine_converters.mechanical.converter import process_files
"""
README
Format:
TEST NAME
-Description
PASS/FAIL
**note numbers correspond to order of tests. Tests Start on line 441
1. test_stress_strain_both_files
-The tests generates sim... |
988,102 | 08363b8c1e8da250b29e0d728723f6622a6ba47a | # Resource: http://wiki.scipy.org/Cookbook/Matplotlib
import excelLoad as eL
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
array = (eL.total_petroleum_stocks.T['United States'].values[3:]/10000 - .12 ) / .07
matrix = array.reshape(6,5)
# QUESTION 3:
# Try to create a Hinton diagram, depi... |
988,103 | 5c6c21278368458adbc95b26948788c9c7991320 | from django.urls import path
from apps.articles.views import main_page, SearchResultsView
app_name = 'articles'
urlpatterns = [
path('search/', main_page, name='main-page'),
path('results/', SearchResultsView.as_view(), name='search-results')
]
|
988,104 | ecfc4973bab9a115b7c5b5654d6fa7fb89376ef4 | import os
from html.parser import HTMLParser
import datetime
result = []
title = ""
class Parser(HTMLParser):
beginTr = False
beginTitle = False
row = -1
def handle_starttag(self, tag, attrs):
if tag == 'tr':
self.beginTr = True
self.row += 1
flag = False... |
988,105 | 948cf36787cd95091c6cb36123a74a63d28c0b03 | from .adafruit_st77xx import Adafruit_ST77XX |
988,106 | 00da12991d425552960e2e119f847270b19d3623 | #!/usr/bin/env python2
import sys, re
lines = sys.stdin.readlines()
for i in lines:
i = i.strip()
# reverse line
print(i[::-1])
|
988,107 | 9a84d4be830f1f49e454ced46d039cd50e938084 | # _____ ?
#
# ___ writeTofile data filename
# # Convert binary data to proper format and write it on Hard Disk
# w__ o.. ? __ __ file
# ?.w.. ?
# print("Stored blob data into: " ? "\n")
#
# ___ readBlobData empId
# ___
# sqliteConnection _ ?.c.. 'SQLite_Python.db'
# cursor _ ?.c.... |
988,108 | 126d9369c001990491b4a1f1a147b348c05d8ac9 | from collections import deque
class ZigzagIterator:
# def __init__(self, v1: List[int], v2: List[int]):
# self.i = 0
# self.v = []
# n1, n2 = len(v1), len(v2)
# size = max(n1, n2)
# for i in range(size):
# if i < n1:
# self.v.append(v1[i])
# ... |
988,109 | a84dec98d555041ee450dfadfd033252658c169c | import random
import time
import math
import os
#inp = raw_input()
print time.localtime(time.time())
def s():
return time.asctime(time.localtime(time.time()))
print s()
x = random.randint(0,100)
print x
print math.sqrt(x)
dict1 = dict()
dict1['red'] = '1'
dict1['blue']= '2'
textfile = ope... |
988,110 | 83d7f232a388bb831f29b57138c9169c40857a25 | import unittest
import inspect
from lizard import analyze_file, FileAnalyzer, get_extensions
def get_go_function_list(source_code):
return analyze_file.analyze_source_code(
"a.go", source_code).function_list
class Test_parser_for_Go(unittest.TestCase):
def test_empty(self):
functions = get_... |
988,111 | c4dccde9b8896b7c336fa1cefc755615eca185bb | import time
import tkinter as tk
from tkinter import *
root=Tk()
root.geometry("500x200+0+0")
root.title("Real-time Digital Clock")
clock_frame=Label(root,font=('times',100,'bold'),bg='black',fg='red')
clock_frame.pack(fill='both',expand=1)
def ticks(time1=""):
# Get the curreent local time from the sy... |
988,112 | c6d8b41f9f0265d57a152513fbca937e486b0d97 | #!/usr/bin/python
# -*- coding: utf-8 -*-
from django.contrib.auth import logout
from django.shortcuts import render
from django.contrib.auth import authenticate, login
from django.http import HttpResponseRedirect, HttpResponse, HttpRequest
from django.views.generic.edit import FormView
from django.contrib.auth.forms i... |
988,113 | 7c267d33729db02a5fd4fc62437c5bd82ae7266d | #!/usr/bin/env python3
#
# author: Abhishek Pandey
# date: 09-08-2020
# description: Use a trained network to predict the class for an input image.Prints the most likely classes.
#
# Use argparse Expected Call with <> indicating expected user ... |
988,114 | 6b23409108d0cdfbac74f97933d4886c1722e283 | """Provide a connection."""
|
988,115 | 21354cec921692b7e21898d4f622f4a9bdd7e842 | from textblob import TextBlob
import glob
femaleSentiment = []
maleSentiment = []
for comment in open(glob.glob("static/FemaleTwitterComments.txt")[0], 'rb').read().split('\n'):
femaleSentiment.append(TextBlob(comment).sentiment.polarity)
for comment in open(glob.glob("static/MaleTwitterComments.txt")[0], 'rb').read... |
988,116 | 34fdb485970caf34c6b00e3ab3856e030e8422e5 | #!/usr/bin/python
#coding:utf-8
import urllib, json
import sys
def sendsms(appkey, mobile, tpl_id, tpl_value):
sendurl = 'http://v.juhe.cn/sms/send' # 短信发送的URL,无需修改
params = 'key=%s&mobile=%s&tpl_id=%s&tpl_value=%s' % \
(appkey, mobile, tpl_id, urllib.quote(tpl_value)) #组合参数
wp... |
988,117 | 88ab94145bcbe7fea90a8c463480b677562eedf7 | from selenium import webdriver
driver = webdriver.Firefox()
driver.get("http://www.baidu.com")
#
size = driver.find_element_by_id('kw').size
print(size)
#
text = driver.find_element_by_id("cp").text
print(text)
#
attribute1 = driver.find_element_by_id("kw").get_attribute('type')
print(attribute1)
#
result = driv... |
988,118 | ec6bab83b77e05ee48d772cd2afacf5f0191f4aa | import logging
from typing import List
import requests
from bs4 import BeautifulSoup
from requests.exceptions import HTTPError
from src.load_config import LOG_LEVEL, LOG_FORMAT
logging.basicConfig(level=LOG_LEVEL, format=LOG_FORMAT)
logger = logging.getLogger(__name__)
def get_html_data_list(site: str... |
988,119 | 015a2b452f0de72819c83489c95a52142650df3f | from django import template
from signup.access import is_coordinator
register = template.Library()
@register.simple_tag(takes_context=True)
def is_coord(context):
return is_coordinator(context['user'])
|
988,120 | 40fb8cc1b4ef2d5b2a48ea999a1776e988c920a9 | import numpy as np
class Bandit:
def __init__(self, k=10, mean=0, variance=1, reward_variance=1):
self.k = k
self.mean = mean
self.variance = variance
self.reward_variance = reward_variance
self.rewards = np.random.normal(self.mean, self.variance, self.k)
def step(sel... |
988,121 | d410c7634d239d9543a7c39447ae7d82acc200c2 | # When using iterdescendants() on an etree, is it ok to modify the tree?
for element in doc.iterfind('.//%s'%tag):
element.getparent().remove(element)
|
988,122 | aab85827a5d3cc96f899bd0590a84e4ac5463a1a | from typing import Dict
from django.test import TestCase
from .accessor import *
from rest_framework.test import APIClient, APITestCase
from .utils import *
class TestBlog(APITestCase):
def setUp(self):
self.user1 = {
"username": "hoge",
"email": "hoge@hoge.hoge",
"pass... |
988,123 | f995a5348089f766f934c1b989a588d15bf56d01 | class Solver:
def __init__(self, list):
self.numberlist = self.load_numbers(list)
self.dragon_size = 50
self.days_gone = 0
self.berserk = 0
self.herd = 0
def solve(self):
for sheepcount in self.numberlist:
self.herd += (int(sheepcount) - self.dragon_s... |
988,124 | ac4f6cf98266fd22334d56913178efc8ce0c6f17 | #!/usr/bin/python3
'''
Script to test app log config file
Created on Oct 20, 2022
Arguments
-f (or --file) FILE : Path to the file that will be used to construct the loggers
@author: riaps
'''
import argparse
import logging.config
import time
import riaps.utils.spdlog_setup as spdlog_setup
def test_loggers(loggers... |
988,125 | 39c20aaa1ae55e9db9abf3ed75c7aa4fb0019196 |
from rest_framework import serializers
from albums.models import Album
from tracks.serializers import TrackListSerializer
class AlbumSerializer(serializers.ModelSerializer):
class Meta:
model = Album
class AlbumTracksSerializer(serializers.ModelSerializer):
tracks = TrackListSerializer(many=True)... |
988,126 | 4b0ed5979087fe50255675ad346fb31f3682849c | import turtle
import random
t = turtle.Turtle()
colors = ["red", "green", "blue", "orange", "purple", "pink", "yellow"]
randnum = random.randint(1,10)
randX = random.randint(-00, 200)
randY = random.randint(-200, 200)
randoffset = random.randint(0, 100)
randwidth = random.randint(1, 150)
randheight = random.randint(... |
988,127 | bf6ba0543a7cd111b57c07c6b0dcf5cd2d9d6979 | import numpy as np
import viz
def diffusion_step(Xmid, t, get_mu_sigma, denoise_sigma, mask, XT, rng,
trajectory_length, logr_grad):
"""
Run a single reverse diffusion step
----------
Parameters
----------
Xmid : array
Current value of X
t : int
Cur... |
988,128 | bc3f0f0f9c2a1df89b1f3a8b8d425d05fe659a9d | #!/usr/bin/env python
from __future__ import print_function
import pychromecast
import argparse
import subprocess
import os
import socket
import sys
__progname__ = "castctrl"
def turn_on_tv(cast):
cast.start_app("CC1AD845") # com.google.cast.media, the default mp4 player
cast.quit_app()
def play_video(url, ... |
988,129 | 3099e106185ab5b5062ff35e4dc20515ee27b1f3 | from watson.modules.chatmodule import ChatModule, command_function
class BangBangModule(ChatModule):
'''
This is a module to contain the "!!" command, which repeats the last command a user gave
'''
__module_name__ = "bangbang"
__module_description__ = "Allows users to repeat their last command"
... |
988,130 | 63b12ba67c872ffbebfa28dc3f50958da760ceb9 | from rest_framework import serializers
from .models import Expense
class ExpenseSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Expense
fields = ('id', 'type', 'amount', 'date_created', 'description') |
988,131 | 67667789106a10dd847176dab8d3ec029813a6d2 |
class Node(object):
def __init__(self, value):
self.value = value
self.edges = []
class Edge(object):
def __init__(self, value, node_from, node_to):
self.value = value
self.node_from = node_from
self.node_to = node_to
class Graph(object):
d... |
988,132 | 11cbd36244ddfe9f9c81f464a95b508709137fb1 | import sys
sys.stdin = open("input.txt")
N = int(input())
arr = [list(map(int, input().split())) for _ in range(N)]
arr.sort()
max_num = 0
for i in range(N):
if max_num < arr[i][1]:
max_num = arr[i][1]
max_idx = i
mid = max_idx # 3
cnt = arr[max_idx][1]
for i in range(mid):
if arr[i][1] <... |
988,133 | f7075100f3ce0cdc7b5acf0f841136294580ee57 | # Allen Institute Software License - This software license is the 2-clause BSD
# license plus a third clause that prohibits redistribution for commercial
# purposes without further permission.
#
# Copyright 2017-2018. Allen Institute. All rights reserved.
#
# Redistribution and use in source and binary forms, with or w... |
988,134 | 1323908d0af6c74b8fb4f4804a896e4bc401934c | from pathlib import Path
import numpy as np
import cv2
import os
import errno
import json
def load_subpix_png(path, scale_factor=256.0):
"""load one channel images holding decimal information and stored as 16-bit
pngs and normalize them by scale_factor.
Args:
path ([pathlib.Path, str]): path o... |
988,135 | cb207d257daeee828eb0d35618d7b58461f42658 | # -*- coding: utf-8 -*-
# @Date : 2018-06-12 17:06:23
# @Author : GEFE (gh_efe@163.com)
# @Version : 1.0.0
# @Describe : 根据特征使用贝叶斯训练模型
import numpy as np
import pandas as pd
from sklearn.naive_bayes import MultinomialNB,GaussianNB,BernoulliNB
from sklearn.linear_model import LinearRegression,LogisticRegression
f... |
988,136 | 5b766e70a777b1a58c16ab0e910addd26132e23c | # Generated by Django 3.1.6 on 2021-04-02 15:32
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('loginapp', '0005_auto_20210402_2053'),
]
operations = [
migrations.AlterModelTable(
name='member',
table='logi... |
988,137 | 10e3ebd64b74240cd6f2e83dbf252a9849397ab9 | # Name: Ben Koczwara
# Date: Sept.16,2013
# Purpose: to create a program that finds the prime numbers from 2 to 5000
print "Prime Numbers"
print "-------------"
print
print "This program will find all the prime numbers between 2 and 5000"
print
values = []
for x in range(2,5001):
values.append(x)
for y in value... |
988,138 | 3a07d47d8e2794e71f0768a87086821a452391f1 | import datetime
import random
import json
secret_no = random.randint(1, 30)
wrong_guess = []
def play_easy(name):
while True:
attempts = 0
score_list = scores()
guess = int(input("Guess the secret number (between 1 and 30): "))
attempts += 1
if guess == s... |
988,139 | 1f2e7c08d4915dcaa91e346ea6e26a7676edc375 | import streamlit as st
import joblib
import numpy as np
st.write("""
# GRE addmission prediction app
This app predict **GRE addmission chance**
""")
st.sidebar.header('Specify the input parameters')
def user_input_features():
gre=st.sidebar.slider("enter the gre score in range 0 to 1" , min_value=0.0,max_valu... |
988,140 | 54eb12356b5816b01d31e2147d0b427ae3642571 | import os, urllib2, sys
import json
from pprint import pprint
pwd = os.path.dirname(os.path.realpath(__file__))
os.chdir(pwd)
def convertJsonToHtml(jsonFile):
tkdArray = jsonFile
print("print json format: ")
for tkdItem in tkdArray:
title = tkdItem["title"]
# for keywords in tkdItem["keywo... |
988,141 | f8b5cd3ae444a5ae9eb690be64a1f7ee6fab1de9 | # Description
# 中文
# English
# Given two binary strings, return their sum (also a binary string).
# Have you met this question in a real interview?
# Example
# Example 1:
# Input:
# a = "0", b = "0"
# Output:
# "0"
# Example 2:
# Input:
# a = "11", b = "1"
# Output:
# "100"
class Solution:
"""
@param a: a... |
988,142 | c45d6a0b91c87b36981d1e4622c385900d843ce9 | def cal_aver(lists,length):
'''
This functions implements calculating average of the values in list
:param lists: the list of values
:param length: the length of the list
:return: the average value stored in the final variable
:raise: no exceptions
:precondition: none
:complexity:best c... |
988,143 | cffe85a2a6aff88bb21cdc1366b61d8d26d158ec | import requests
def find_definition(word):
url = f"https://api.dictionaryapi.dev/api/v2/entries/en_GB/{word}"
response = requests.get(url)
if response.status_code == 404: # if GB dictionary does not contain word try US dictionary
url = f"https://api.dictionaryapi.dev/api/v2/entries/en_US/{word}"
... |
988,144 | f76dce46a68dd8dd59a26b8767bdde06b83d8b7f | class LexisMsg(object):
MSG_INITIAL_FAILED="Failed to initial"
MSG_INITIAL_FINISHED="Initial stage finished"
MSG_PROCESS_FINISHED="English process stage finished"
MSG_PROCESS_FAILED="Failed to get English hyperlink process done"
MSG_TRANSFER_FINISHED="Transfer process stage finished"
MSG_TRANSFER_FAILED="Fa... |
988,145 | c7fc9c827817cfa51164b491508253aec3f869e7 | # The Automobile class holds general data
# about an automobile in inventory.
class Automobile:
# The --init--method accepts arguments for the
# make, model, mileage, and price. It initializes
# the data attributes with these values.
def __init__(self, make, model, mileage, price):
self.__make =... |
988,146 | 6330ed9464426c9832376cd051194899f75f5db2 | import cherrypy
import pickle
import database as db
from pour_serial_class_2 import pour_serial
from mako.template import Template
from mako.lookup import TemplateLookup
import os, os.path
import sys
current_dir = os.path.dirname(os.path.abspath(__file__))
lookup = TemplateLookup(directories=['html'])
datafilename = ... |
988,147 | 3aa79edae6d86ade623d429a8bbb7c44942391cd | import sys
sys.stdin = open("input.txt", "rt")
n = int(input())
p = []
for i in range(n):
p.append(list(map(int, input().split())))
for i in range(1, len(p)):#마지막까지
p[i][0] = p[i][0]+min(p[i-1][1],p[i-1][2])#현재R+이전G,B중 최소값
p[i][1] = p[i][1]+min(p[i-1][0],p[i-1][2])#현재G+이전R,B중 최소값
p[i][2] = p[i][2]+min... |
988,148 | 8c7a778e04b39080aa0f0ae810303360ec46fd9c | # -*- coding: utf-8 -*-
from tornado.options import define
define('debug', default=False, help='enable debug mode')
define('port', default=5000, help='run on this port', type=int)
|
988,149 | bc94d7f26bc00853cec7433a675cd147be2f4e19 | from __future__ import division
import os
import sys
import gdal, gdalconst
from gdalconst import *
from shapely.geometry import LineString, Polygon
#crs conversion
#from pyproj import Proj, transform
class envi_file(object):
def __init__(self, file_name):
'''opens a envi file so that operations can ... |
988,150 | 03f9f0157eed4325722cb6eacc739129d02c99df | class TipoHabilidade:
FISICAS_E_MOTORAS = "Fisicas e Motoras"
INTELECTUAIS_E_TECNICAS = "Intelectuais e Tecnicas"
COMPORTAMENTAIS = "Comportamentais"
def __init__(self, nome):
self._nome = nome
@property
def nome(self) -> str:
return self._nome
def __hash__(self):
... |
988,151 | a031a1f9547e349e63e4617c00744fcca34bceae | import math
praise = "You are doing great"
praise = praise.upper()
number_of_characters = len(praise)
result = praise + "!" * (number_of_characters //2)
print (result)
#create a function with def, give it a name and define the parameters that are expected
def yell(text) :
text = text.upper()
number_of_character... |
988,152 | 9431c2a6cee9a50f199c9e762ddeab8b8104c4fe | from functools import reduce
lista = [1, 3, -1, 15, 9]
listaDobles = map(lambda x: x*2, lista)
listaPares = filter(lambda x: x % 2 == 0, lista)
sumatorio = reduce(lambda x, y: x + y, lista)
sumatorioDobles = reduce(lambda x,y: x + y*2, lista)
suma100 = reduce(lambda x,y: x+y, range(101))
print (list(listaPares))... |
988,153 | 641c35892df568d2126f0d234ad052e8bf170de6 | from sklearn.datasets import load_breast_cancer
from sklearn.model_selection import cross_val_score
from sklearn.feature_selection import SelectKBest, f_classif
from sklearn.ensemble import GradientBoostingClassifier
from sklearn.pipeline import Pipeline
from hyperactive import Hyperactive
data = load_breast_cancer()... |
988,154 | b4fe94bb1eca6a7d30273fd9bbafcfc54c0cd794 | #! /usr/bin/env python3
import unittest
# also known as chopsearch, binary chop, logarithmnic search, half-interval search.
# this is good for sorted arrays, or arrays that have seen a rotation.
# search by repeated diving the search in half
# worst case is O(log n)
# constant space
def binarysearch_bad(arr, needle, l... |
988,155 | 57d584888068da19e5b7095be7687cd06c6c5720 | import datetime
import json
from google.appengine.ext import ndb
import webapp2
class Header(ndb.Model):
"""Contains a single HTTP header for a resource."""
name = ndb.StringProperty()
value = ndb.StringProperty()
class Resource(ndb.Model):
"""Contents of a single URL."""
path = ndb.StringPrope... |
988,156 | cf9ca4f2093909037dcc26d0ad10e36431b5e510 | # -*- coding: utf-8 -*-
"""Multi-level dictionary
.. module:: lib.array.multidict
:platform: Unix
:synopsis: Multi-level dictionary
.. moduleauthor:: Petr Czaderna <pc@hydratk.org>
"""
from collections import defaultdict
class MultiDict(defaultdict):
"""Class MultiDict
Inherited from defaultdict
... |
988,157 | fd5cd4d3c3907a256b1de6a5f1ef7c6af14d652e | #!/usr/bin/env python
import haxxpkgs
import sys
if __name__ == "__main__":
drv = getattr(haxxpkgs, sys.argv[1])
print(str(drv()))
|
988,158 | a7abd7ab0d3d481d1cd3022127c88749ca942af9 | k=int(input())
a=0
for i in range(1,k):
b=k//i
if k%i==0 and b%2==1:
print(i)
a+=1
break
if a==0:
print(k)
|
988,159 | 0b986e7ce6d5f1bf0548e7f581f260f92007a256 | import nltk
import pymorphy2
from collections import Counter
import math
import numpy
def compute_tfidf(corpus):
def compute_tf(text):
tf_text = Counter(text)
for i in tf_text:
tf_text[i] = tf_text[i] / float(len(text))
return tf_text
def compute_idf(word, corpus):
... |
988,160 | c9089d71d7665abdca419775926c57e218ed1a92 | import pymysql as p
c = p.connect(host = 'localhost',
user = 'root',
password = 'Gaganmalvi@123',
database = 'college')
a = c.cursor()
delval = input('Enter Roll Number of student whose record you want to purge. :')
a.execute('delete from student where rno = '+delval)
c... |
988,161 | a2c45bf3a8dd60fcf03dbb792d90f50c6803d78f | import matplotlib.pyplot as plt
from scipy.fftpack import fft
from scipy.io import wavfile # get the api
import numpy as np
fs, data = wavfile.read('track01_ijsvogel.wav')
length = data.shape[0] / fs
times = 10
fft_fs = fs / 10
print fft_fs
print fs
a = data.T[0]
for i in range(length * times):
print fft_fs*(i... |
988,162 | 15c21db671993dd6ae915e3a0264b57892ab1110 | import cv2
import numpy as np
image = cv2.imread(r"../picture_data/change.png")
image_gray = cv2.cvtColor(image,cv2.COLOR_BGR2GRAY)
ret, thresh = cv2.threshold(image_gray,0,255,cv2.THRESH_BINARY+cv2.THRESH_OTSU)
counters, hierarchy = cv2.findContours(thresh, cv2.RETR_TREE, cv2.CHAIN_APPROX_NONE)
cnt = counters[0]
m... |
988,163 | f968c49c2ead57c593ffa9a087b121545f6cb7bc | from django.urls import reverse, resolve
from core.dj_import import HttpRequest
from django.test.client import Client
from core.tests.base import ( SetUpBrandsCategoriesModelsMixin,
getSingleEbayCategoryMixin,
getUrlQueryStringOff,
... |
988,164 | 28150d606d0d21f154525153cd9f60fe7aae046a | import json, os
from typing import List, Any, Dict
from sqlalchemy import Column, String, Integer, DateTime
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.sql import func
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
import pandas as pd
Base = declarative_base... |
988,165 | c6f5e90019b453bedc6cf0c3e28ebb2844073b69 | # Modules
from matplotlib.animation import FuncAnimation
import matplotlib.pyplot as plt
import numpy as np
# Parameters
coin_flips = 10000
heads_bias = 0.3
# Discretize possible biases of coin to heads
heads_biases = np.arange(0, 1, 0.01)
# Uniform probability density function prior
prior = np.ones(len(heads_biases... |
988,166 | d3cb0e384163a363ae3e323e11dbe91840a63287 | """update_coordinates.py
Updates a package's spatial coordinates (just
MultiPoint implemented) and geographic names with those taken from a csv file
with the format:
[city;country;latitude °N;longitude °E]
Usage:
update_coordinates.py <coord_file> <pkg_url>
Arguments:
<coord_file> input file
<pkg_url> ... |
988,167 | 3396307e3df4d3ffafdbb29294fb465dc0799d59 | import sys
import csv
from collections import defaultdict
from operator import itemgetter
from Bio import SeqIO
from Bio.Seq import Seq
from Bio.Alphabet import generic_dna
SeqTable=[]
csv.field_size_limit(1000000000)
def Genomictabulator(fasta):
print >> sys.stderr, "Cargando genoma en la memoria RAM ...",
f =... |
988,168 | 1ff0967ebe7a404811d7050417b95778a0a7494c | """
Studio editing view for OpenAssessment XBlock.
"""
from __future__ import absolute_import
import copy
import logging
from uuid import uuid4
import pkg_resources
import six
from six.moves import zip
from django.conf import settings
from django.template.loader import get_template
from django.utils.translation impo... |
988,169 | 5a0a350475c7fedd536416ea7a88c73d5cd29af3 | #!/usr/bin/env python
"""
You must have networkx, matplotlib>=87.7 for this program to work.
"""
# Author: Rishi Thakkar (rishirt.us@gmail.com)
try:
import matplotlib.pyplot as plt
plot_lib=True
except:
plot_lib=False
import networkx as nx
import random
import sys
import os
import shutil
class bcolors:
... |
988,170 | 550a528214c7bd7e45fa85cb7e76b2ff307c5b34 | import json
def handle(event, context):
categories = ["Books", "Python", "AWS", "Java"]
return {
"statusCode": 200,
"body": json.dumps({"statusCode": 200, "data": categories}),
"isBase64Encoded": False,
}
|
988,171 | 3752e7d77004e7a96d5f7706f258a6ddcd0d9233 | import pandas as pd
import numpy as np
from matplotlib import pyplot as plt
import copy
####QUESTION 1####
## a
data = pd.read_csv('real_estate.csv')
raw_data = data.copy()
lenth = data.shape[0]
index_in_file = []
index_in_code = []
for i in range(lenth):
if data.iloc[i].isnull().any():
index_in_file.append... |
988,172 | 56fd53599e063e757c52c7ebd1f3070ffaaff31d | # -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
#Strings
class_name = "p5_Delinquents: "
#Error: class_name + 5 You cannot concatenate a String and number
student1 = "Carlos"
top_delinquents = student1 + ", Nicholas, Gionna, Gonzalo"
class_students = class_name + top_... |
988,173 | 20902e8faa98576feaf4997be561e8ae9aeda0ba | # encoding:utf-8
from django.contrib.auth.models import User
from django.conf.urls import url
from tastypie.resources import ModelResource
from tastypie.serializers import Serializer
from tastypie.utils import trailing_slash
from oauth2_provider.views.base import TokenView
class AuthResource(ModelResource):
'''
... |
988,174 | b402a953d6dfb69640a7c1ae562ceae4040ce9f1 | from django.urls import include, path, reverse
from rest_framework import status
from rest_framework.test import APITestCase, URLPatternsTestCase
from user.models import User
from products.models import Product
class ProductsTests(APITestCase, URLPatternsTestCase):
urlpatterns = [path(r'^api/products/', include(... |
988,175 | 428278935f2422e2748fcb02966b2a5e599fa624 | import os
import sys
sys.path.append('modules')
import add_problem
import review
import json_to_csv
import csv_to_json
active = True
os.system('color 1e')
while active:
print('请输入要进行的操作:')
msg = ('(a=添加题目, r=复习错题, q=退出, c=从表格导入题目, ' +
'j=从数据库导出至表格) ')
c = input(msg)
if c == 'a':
... |
988,176 | 7b754b0b5c4497a6f8c1f23951b45f208b492e42 | '''
Created on Jun 22, 2010
@author: wye
'''
from af import ActivityBase
class behav():
'''
Describes behavior of acts
'''
def __init__(self):
'''
Constructor
'''
self._actdict = None
def setActDict(self, actdict):
self._actdict = act... |
988,177 | 47a2f86e7ca36486f2d8b1269edc3f515f3ac4fd | # Copyright 2020 Stanford University, Los Alamos National Laboratory
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... |
988,178 | c4251c46f19388a3d6c1055310407b7b545f410a | # encoding: utf-8
"""
@author:Administrator
@file: page_taskcompatible.py
@time: 2018/11/15
"""
import allure
from Base.base_page import BasePage
from Unit.tool import parse
class Page_Task_Compatible(BasePage):
'''标准兼容性测试'''
def __init__(self, AutoRead=False):
self.page = {}
if AutoRead:
... |
988,179 | 8730ac2e93214dad8c604629d8e22f376098aad6 | # Exercicio 13
#
# Crie um programa que peça o nome do cliente, idade, endereço, email e telefone.
#
# Depois crie um menu interativo com as seguintes opções: Dados, Endereço, Contato.
#
# Se o usuário selecionar "Dados" deve aparecer o nome do cliente e a idade
#
# Se o usuário selecionar "Endereço" deve aparecer ... |
988,180 | fcb9dc924e94ded6f9619cac9777a1744aa9c04c | # -*- coding:utf-8 -*-
'''
第一个只出现一次的字符
===========================
在字符串中找出第一个只出现一次的字符。如输入"abaccdeff",则输出"b"。
'''
def firstNotRepeatingChar(s):
if not isinstance(s, str) or len(s) == 0:
return
charTable = {}
for i in range(len(s)):
if s[i] not in charTable:
charTable[s[i]] =... |
988,181 | 36eaca0e84733412887f4332c8e5083d0ca13312 | # -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
def add_beautiful_subplot(fig, subplot, xlim, ylim):
axes = fig.add_subplot(
subplot, xlim=xlim, ylim=ylim
)
for side in ['bottom', 'right', 'top', 'left']:
axes.spines[side].set_visible(False)
plt.xlabel('S', fontsize=18)
... |
988,182 | 67faf5485d451ae309f33e47d4c81b0ec678e1b1 | from dmn import DMN_QA
if __name__=='__main__':
QA_SYS = DMN_QA()
print('[+] QA_SYS object created')
QA_SYS.train_model() |
988,183 | b3bf4dffbcb6d988b1f74a2e5af7b78ae8c4aec8 | import numpy as np
import h5py
np.random.seed(1000)
from scipy.io import loadmat
from sklearn.preprocessing import StandardScaler
from sklearn.model_selection import StratifiedShuffleSplit
n_splits=4
train_size=0.8
test_size=0.2
eeg2 = r""
class EEGSchizoDatasetBalanced():
"""EEG Alco Train dat... |
988,184 | 44240a1244c99ac9fdffe69900c7aa995a2a642f | import requests
from bs4 import BeautifulSoup
from pymongo import MongoClient
import constants
"""
This is a common utils class file which can be used across py packages
"""
def gettickerdata(tickername):
"""
function calls bloomberg API and scraps the current price
"""
r = requests.get(constants.bl... |
988,185 | 859e6e486c7e8f3996782cce821ab38d6707e447 | #!/usr/bin/env python3
import fileinput
import math
def find_sum(numbers, num_summands, target):
if num_summands == 0 and target == 0:
return True, []
if num_summands == 0 or target < 0 or len(numbers) == 0:
return False, None
for index, number in enumerate(numbers):
found_solutio... |
988,186 | d1d46bde9195cc0425234a907fcdd090416c87aa | import os
class Config(object):
SECRET_KEY = os.environ.get('SECRET_KEY') or\
b'\xf2\x95\xa2\xfe\xfcQ\xf44j\xca\xf2t\xa0\x9a<\xf8'
|
988,187 | a23bb575ba70d38348b10e080673439d891047ef | from survival.components.position_component import PositionComponent
from survival.components.resource_component import ResourceComponent
from survival.entity_layer import EntityLayer
from survival.esper import World
from survival.graph_search import graph_search
from survival.settings import AGENT_VISION_RANGE
from su... |
988,188 | 3af87127c16383fd46b74f952604595f6c9fadab | import pandas as pd
import numpy as np
import requests
import logging
import datetime
import argparse
import gevent
from random import randint
import os
import yaml
class ConnectorAuthenticationError(Exception):
"""An error indicating that an external API (such as Google) returns
a response indicating that th... |
988,189 | 2f2566a0ef9bcca392b56c0d26fac302a639f035 | from django.urls import path
from .views import index, pet_all, pet_detail, pet_like, pets_create, pets_delete, pets_edit
app_name = 'common'
urlpatterns = [
path('', index, name='index'),
path('pets/', pet_all, name='pet_all'),
path('pets/details/<int:pk>/', pet_detail, name='pet_detail'),
path('pets/... |
988,190 | ae6b1b1f7fcb0e6998a4571f8cc28b26de04a367 | import string
class TEA:
def __init__(self, key):
key = hex(key)[2:]
self.k0 = int(key[0:8],16)
self.k1 = int(key[8:16],16)
self.k2 = int(key[16:24],16)
self.k3 = int(key[24:],16)
self.test = []
def padArr(self, arr):
padAmt = (8-len(arr)%8)%8
... |
988,191 | 5dd1cddae8f03b3f720e2ebc2c4bc4ae985955a6 | import glob
import os
import pandas as pd
import psycopg2
from sql_queries import *
def process_song_file(cursor, filepath):
"""
Processes the data in a single song file.
:param cursor: Cursor used to execute statements in Postgres.
:param filepath: Path to the song file to be processed.
"""
... |
988,192 | 0cecbd471679f50d43b4d58067f0614d0edfc70a | from . import feature_extraction
from . import prediction
from . import sequence_modeling
from . import transformation
# from recognition.minimal_text_recognition.modules import feature_extraction
# from recognition.minimal_text_recognition.modules import prediction
# from recognition.minimal_text_recognition.modules ... |
988,193 | 02de8f412a0c2b754745b1b776eee3f5e65fe749 | '''
Created on 02.09.2013
@author: Solonarv
Classes to represent data in a binary format.
Name is BDT = Binary Data Tags
'''
import gzip
from util import Enum
data_types = Enum(("END", "BYTE", "SHORT", "INT", "LONG", "STRING", "LIST", "COMPOUND",))
class BDTBase:
"""
ABC of all types of binary data tag
... |
988,194 | c374ba396c9cc3f4baea010a235f5c4b09511f36 | from tkinter import *
from tkinter import messagebox
def closewindow():
messagebox.showinfo(title="警告",message="不要关闭,好好回答")
# print("1")
return
def closeallwindow():
window.destroy()
def love():
love = Toplevel(window)
love.geometry("300x100+520+200")
love.title("好巧,我也是!")
lable =... |
988,195 | 29ff6c32f177a5470a8547ea07371c2443dbd18e | from read_parms_input_lhs import *
from simulation_odemodel_sci import *
from plot_sci import *
from record_equilibrium import *
# Partitions for LHS, can be changed
nparts = 1000
# number of samples to generate
num_samples = 100
# Range (in days)
start = 0
end = 1000
# Read Parameters
beta_B,beta_D,beta_BD,b_C,b_I,p... |
988,196 | b9c04a44116fe00fbd882ea91d05f4dc4aea4221 | test = {
'name': 'Question 6',
'points': 1,
'suites': [
{
'cases': [
{
'code': r"""
>>> # If this causes an error, write AssertionError
>>> check_strategy(always_roll(5)) == None
True
""",
'hidden': False,
'locked': False
... |
988,197 | e1e4563bd1f922c07fd3877307676b154f6fc57b | #!/usr/bin/env python3
import re
from pathlib import Path
from textwrap import wrap, indent
path = Path('/home/matthias/.xmonad/xmonad.hs')
# re01 = re.compile('(\("M-)(.+)(--)') # identifies line with shortcut definition
re01 = re.compile(r'\("M-') # identifies line with shortcut definition
re02 = re.compile(r'"\s... |
988,198 | 0da1acc8d1500c6b4d7a8df03c59a0e47fb560d2 | from django.contrib import admin
from .models import City,Services,Hotel,Comments,Photos_outside,Photos_inside,Services_hotel
# Register your models here.
admin.site.register([City,Services,Hotel,Comments,Photos_outside,Photos_inside,Services_hotel]) |
988,199 | 7d466fc4840b3a17bfd7bd1a01ee733f9548220f | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'GUI.ui'
#
# Created by: PyQt4 UI code generator 4.11.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.