index int64 0 1,000k | blob_id stringlengths 40 40 | code stringlengths 7 10.4M |
|---|---|---|
10,300 | c632f2f8b3fe7ab5f366a3f94b8dfa66c0ebf8cf | # Generated by Django 2.2.3 on 2019-08-10 16:13
from django.db import migrations
import image_cropping.fields
class Migration(migrations.Migration):
dependencies = [
('core', '0007_bannerimage_cropping'),
]
operations = [
migrations.AddField(
model_name='eventimage',
... |
10,301 | 4a0b0979038366a07d5b69344c96506fdfc58b55 | import numpy as np
def check_dim(X, dim):
dimX = np.ndim(X)
if(dimX != dim):
raise ValueError("{0}d array is expected, but {1}d is given".format(dim, dimX))
|
10,302 | 50e2d3baaf509d3b26bf4334b15e63266d497d4c | ###########################################
# Imports
###########################################
import os, sys
import math
from collections import namedtuple, defaultdict
from itertools import product, groupby, permutations, combinations
rootRelativePath = '..'
rootAbsolutePath = os.path.abspath(rootRelativePath)
s... |
10,303 | 1c5bb1f97aebd71a12a5a0b7ff6eece6bcb49f2c | # Assignment 1 to print Hello World
print("Hello world")
|
10,304 | 070ad2a9aee634fc404f4767984d1a54a055a1c4 | from django.contrib import admin
from .models import Listing,Listing_Image,Review
admin.site.register(Listing)
admin.site.register(Listing_Image)
admin.site.register(Review)
# class Listing_ImageInline(admin.TabularInline):
# model = Listing_Image
# extra = 3
#
# class ListingAdmin(admin.ModelAdmin):
# ... |
10,305 | 614e57c5c3456fb627b032c00bbb7c2959225b8d | """Custom node groups"""
import bpy
from .node_arranger import tidy_tree
# docs-special-members: __init__
# no-inherited-members
class NodeGroup:
"""Generic Node Group"""
TYPE = 'Compositor'
def __init__(self, name: str, node_tree: bpy.types.NodeTree):
"""
A generic NodeGroup class
:param name: Name of no... |
10,306 | 850840b0e53a1f5a0d2b3b587db3ccca2f549a31 | # range ile belirli araliktaki degerleri istedigimiz sekilde kullanabiliriz
# python da ilk deger inclusive ikinci deger ise exclusive dir
#yani ilk deger dahil ikinci deger ise dahil degildir
for i in range(20):
print("{}) {}".format(i,('*'*i)))
|
10,307 | 6523d2a3245119bd9cfec5d87fd3f71eb058736d | # coding=utf-8
'''
给定一个二叉树,判断其是否是一个有效的二叉搜索树。
假设一个二叉搜索树具有如下特征:
节点的左子树只包含小于当前节点的数。
节点的右子树只包含大于当前节点的数。
所有左子树和右子树自身必须也是二叉搜索树。
示例 1:
输入:
2
/ \
1 3
输出: true
示例 2:
输入:
5
/ \
1 4
/ \
3 6
输出: false
... |
10,308 | b970b43ec2ed15f3352334da25960774ab99c60a | import numpy, h5py, matplotlib
import matplotlib.pyplot as plt
import os
import scipy.signal as sp
import numpy as np
import bead_util as bu
import os, re, time, glob
startfile = 0
endfile = 200
path = r"C:\data\20170925\bead4_15um_QWP_NS\steps\DC"
file_list = glob.glob(path+"\*.h5")
def list_file_time_order(filel... |
10,309 | 3064aeed019a24409a9bf734bc8cc9b4dcab118b | cinsiyet=input("Cinsiyetiniz: (E/K)")
if cinsiyet==("E"):
print("Erkek")
elif cinsiyet==("K"):
print("Kadın")
else :
print("Hatalı seçim.") |
10,310 | 41086f5b9e74eeeadfe6d3ef42c65ff02a04f92c | """
Created on Oct 20, 2013
@author: Ofra
"""
from action import Action
from actionLayer import ActionLayer
from util import Pair
from proposition import Proposition
from propositionLayer import PropositionLayer
class PlanGraphLevel(object):
"""
A class for representing a level in the plan graph.
For each level... |
10,311 | c511f17d734c3104c8e4cbc02ddb5757ddd58818 | import numpy as np
import matplotlib.pyplot as plt
# Make a scatter plot by drawing 100 items from a mixture distribution
# 0.3N((1,0)^T, (1 & 0.2 \\ 0.2 & 1)) + 0.7N((-1,0)^T,(1 & -0.2 \\ -0.2 & 1)).
# mean vector and covariance matrix
mu1 = np.array([1, 0])
Sigma1 = np.array([[1, 0.2], [0.2, 1]])
mu2 = np.... |
10,312 | f99afc8bcf0d26241644ca8510091779c82c1c5a | # coding:utf-8
import requests
import re
import urllib3
from bs4 import BeautifulSoup
urllib3.disable_warnings()
# 登陆拉勾网
s = requests.session()
url1 = "https://passport.lagou.com/login/login.html"
r1 = s.get(url1,verify=False)
print(r1.status_code)
# print(r1.content.decode("utf-8"))
res = r1.content.decode("utf-8")... |
10,313 | 99da42061e36a4e7d8d8bfe10663986181f5d5e1 |
class HiddenAnswer(object):
def __init__(self, correct_answer):
self.correct_answer = correct_answer
self.hidden_answer = '_' * len(self.correct_answer)
def reveal(self, guessed_letter):
hidden = ''
for position, letter in enumerate(self.correct_answer):
if letter =... |
10,314 | a366a87bc3ab931a4326c4e61c1af7d3ad1e2072 | #!/opt/app/cacheDB/python/bin/python3
"""
A script for getting data objects from Vertica
References: Vertica Python - https://github.com/uber/vertica-python
"""
import vertica_python
import logging
# Set the logging level to DEBUG
logging.basicConfig(level=logging.INFO)
conn_info = {'host': 'stg-wavert01.bodc.att.com... |
10,315 | 39e7eae39e10a72fafa6afab6e4ceeb8dce223a2 | import re
import hashlib
import os
import base64
import random
def login():
while True:
username = input("Username: ")
if len(username) == 0:
print("Username can not be empty")
elif len(username) > 20:
print("Username is too long")
elif re.se... |
10,316 | beea8a00565174cc993dd9f134627aec1edc2bb4 | import sys
sys.setrecursionlimit(10000)
n, m = map(int, sys.stdin.readline().split())
a = [[] for _ in range(n+1)]
check = [False]*(n+1)
for _ in range(m):
u, v = map(int, sys.stdin.readline().split())
a[u].append(v)
a[v].append(u)
def dfs(now):
check[now] = True
for i in a[now]:
if check[... |
10,317 | 5ca187ae37972da2da99714cedcdcfb3671857fc | import fasttext
import numpy as np
class Classifier:
def __init__(self):
self.model_path = './model_cooking.bin'
def train(self):
model = fasttext.load_model(self.model_path)
self._save(model)
def predict(self, title, body):
model = fasttext.load_model(self.model_path)
... |
10,318 | 5f321d436bc4861bcf0f6df7e3a3e0edc839fb76 | import pytest
from voyage.exceptions import QueryException
from voyage.models import Comment, Membership, Voyage
from voyage.schema.queries import VoyageQuery
def test_getting_all_voyages(db_voyage):
voyages = VoyageQuery.resolve_voyages('root', 'info').all()
assert voyages == [db_voyage]
def test_getting_... |
10,319 | ddcaef981ec2d22e877718d03562abbdee86ada6 |
from xai.brain.wordbase.nouns._retrofit import _RETROFIT
#calss header
class _RETROFITTING(_RETROFIT, ):
def __init__(self,):
_RETROFIT.__init__(self)
self.name = "RETROFITTING"
self.specie = 'nouns'
self.basic = "retrofit"
self.jsondata = {}
|
10,320 | bfefdf164b159135d6698981278e90e418c94e08 | #!/bin/env python
import math
name = input("Name: ")
description = input("Description: ")
typename = input("Typename: ")
category = input("Category: ")
erosion_type = input("Erosion type: ")
res_ = {}
res_per_progress = {}
while True:
res = input("Resource: ")
amount = input("Amount: ")
if not... |
10,321 | 31621cf9a156fead21a71c136456361ea27b28b6 | class Turtle:
def __init__(self, x):
self.num = x
class Fish:
def __init__(self, x):
self.num = x
class Pool:
def __init__(self, x, y):
self.turtle = Turtle(x).num
self.fish = Fish(y).num
def print_num(self):
print('水池中乌龟%d只,小鱼%d条' % (self.turtle, self.fish))
pool = Pool(10, 100)
poo... |
10,322 | 79acaf993c08a2002ffcb060825225c45e2548a3 | # Generated by Django 3.2.3 on 2021-05-21 08:17
from django.db import migrations, models
import django.db.models.deletion
import tinymce.models
class Migration(migrations.Migration):
dependencies = [
('education', '0010_student'),
]
operations = [
migrations.CreateModel(
nam... |
10,323 | 7183346b0ba501b080f4596e260d4dda082d1d3f | """
CAD model for camera mounting posts.
"""
from py2scad import *
from part import Part
class Camera_Post(Part):
def make(self):
dxf_profile = self.params['dxf_profile']
length = self.params['length']
width = self.params['width']
part = Linear_DXF_Extrude(dxf_profile,height=length... |
10,324 | 800bb4114af7a2c3161505c27f8d32928e7019bf | from reportlab.lib import utils
from reportlab.pdfgen import canvas
from reportlab.lib.units import cm
from reportlab.lib.pagesizes import landscape, A4
from django.contrib.staticfiles.storage import staticfiles_storage
PAGE_SIZE = landscape(A4)
def render_pdf(session, fileobj):
c = canvas.Canvas(fileobj, pagesi... |
10,325 | 9bdd5fdbc78aaa1433fe29fb515fcfe3582e6bee | import random
def checking(i):
try:
float(i)
return True
except ValueError:
return False
play = True
proceed = False
while True:
rand = random.randint(1,9)
guessCount = 0
userGuess = raw_input("Guess a number: ")
if userGuess == "exit":
quit()
else:
... |
10,326 | 67196941bf8c17b30bb418b5614317d29aab67d1 | # Generated by Django 3.0.4 on 2020-03-08 17:24
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("api", "0001_create_model_question"),
]
operations = [
migrations.AlterField(
model_name="question",
name="answer_cor... |
10,327 | bedbce828e15d9d9cce130af40efb510f266dfd5 | from django.urls import re_path, path
from . import views
# https://stackoverflow.com/a/59604748
urlpatterns = [
path('', views.index),
re_path(r'^.*/$', views.index)
]
|
10,328 | 65d46feb6ac23ec715552fa718484606f925b84b | import pycountry
from pycountry_convert.convert_country_alpha2_to_continent_code import country_alpha2_to_continent_code
europe = []
for c in pycountry.countries:
try:
continent = country_alpha2_to_continent_code(c.alpha_2)
except KeyError:
continue
if continent != "EU":
continue... |
10,329 | c35569cff725d433a4e35229fd9fd2ea3aadb512 | import unittest
import HW6
class TestHW6(unittest.TestCase):
def test_111(self):
self.assertEqual(HW6.solve([1,1,1,1,1,1]), 1)
def test_123(self):
self.assertEqual(HW6.solve([1,2,3]), 3)
def test_2(self):
self.assertEqual(HW6.solve([3,4,5,6]), 6)
def test_3(self):
sel... |
10,330 | a51dfa8ab8c344a7f1552a1759d3c1bc57b0dbe0 | #External imports
from flask import Flask
from flask_restful import Resource, Api, reqparse
import json
#Import classes
from task_service.task import Task, TaskList
# Create an instance of Flask
app = Flask(__name__)
api = Api(app)
api.add_resource(Task,'/tasks/<int:identifier>')
api.add_resource(TaskList, '/tasks'... |
10,331 | 1b444c742fca9e13e1f0141ab675e4b7f1a68020 | class Employee:
company = "Bharat Gas"
salary = 5600
salaryBonas = 500
# totalSalary = 6100
@property
def totalSalary(self):
return self.salary + self.salaryBonas
@totalSalary.setter
def totalSalary(self, val):
self.salaryBonas = val - self.salary
e = Employee()
prin... |
10,332 | 5e4608934d258a6c00770b88b9224e5a8ab8fedc | from pymysql import connect, cursors
from pymysql.err import OperationalError
import os
import configparser
_base_dir = os.path.split(os.path.dirname(os.path.abspath(__file__)))[0]
_db_config_file = 'db_config.ini'
_cf = configparser.ConfigParser()
_cf.read(os.path.join(_base_dir, _db_config_file))
host = _cf.get("... |
10,333 | 4745470ef771415383d1bbe6b9ab04e1f750d57d | # Generated by Django 3.1.2 on 2020-12-01 13:36
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('galleryview', '0004_remo... |
10,334 | 68618de734696fd9a2c335031e96cf4171016186 | from .abstractgameunit import AbstractGameUnit
class OrcRider(AbstractGameUnit):
def __init__(self, name = ''):
super().__init__(name = name)
self.max_hp = 30
self.health_meter = self.max_hp
self.unit_type = 'enemy'
self.hut_number = 0
def info(self):
print("I'... |
10,335 | 8ea01c453590fbde8210bafa6601f597c80de5e8 | def greet(name, age):
message = "Your name is " + name + " and you are " + age + " years old."
return message
name = input("Enter your name: ")
age = input("Enter your age: ")
print(greet(name, age))
def add(a, b):
return a + b
def subtract(a, b):
return a - b
num_one = int(input("Enter a number: "... |
10,336 | 97c6365f0109ba99c9526258c5a595e2c5cf524e | import pyodbc
import pyzure
def to_azure(result, all_batch_id, azure_instance):
all_batch_id = ["'" + e + "'" for e in all_batch_id]
azure_table = result["table_name"]
print(azure_table)
if all_batch_id:
try:
query = 'DELETE FROM ' + azure_table + ' WHERE batch_id IN ' + "(" + ",".... |
10,337 | fea43a3b50f59f4209fb8dbf1a1afd53050fd986 | #Write a Python program to sum all the items in a list.
def sum_list(inp_list):
sum = 0
for item in inp_list:
sum += item
return sum
def main():
inp_list = [1,2,3,4,5,6,7,8,9,10]
print('The sum of all the elements of the list is:',sum_list(inp_list))
main()
|
10,338 | 1c22b822a30f860aeb818634e0dbffb995b4e3cc | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Apr 6 12:55:42 2018
@author: Yacong
"""
import glob,os
import numpy as np
import matplotlib.pyplot as plt
import math
type_lookup_file = 'id-type.tab'
dump_file_head = 'dump.fc_0.'
path_to_splitted_dump = './25GPa_threshold_0_ref/'
bin_width = 0.1
# ... |
10,339 | 6d26e21caf8b21124a243eadfa585571b7476620 | import os
from flask import Flask
from flask_migrate import Migrate
from app.config import DevelopmentConfig, app_config
from app.models import db
from app.controllers import stadium_groups_controller
from app.controllers import stadiums_controller
from app.controllers import stadium_controller
from app.models.stadiu... |
10,340 | 8b7c860597a9345dd7f274a3f9ce4a26db5ea125 | '''
Created on March 15, 2013
@author: nils
'''
from django.contrib import admin
from annotation_server.models import *
admin.site.register(Taxon)
admin.site.register(GenomeBuild)
|
10,341 | f1b18c9a0a75a074f0f318525d13fdabd54431b4 | from sqlalchemy import (
Column,
DateTime,
ForeignKey,
Integer,
String,
)
from sqlalchemy.orm import relationship
from sqlalchemy.ext.associationproxy import association_proxy
from clusterflunk.models.base import Base
class Group(Base):
__tablename__ = 'groups'
name = Column(String(100))... |
10,342 | 724319362c76645e150ee1c37ed8e6dccb1732ef | # -*- coding: utf-8 -*-
import math
def _raise_dim_error(dim1, dim2):
raise ValueError("Vector Operands have %d != %d Dims!" % (dim1, dim2))
def _raise_type_error(desc, wanted, got):
raise TypeError("%s requires a %s, got a %s: %s"
% (desc, wanted, type(got).__name__, str(got)))
def un... |
10,343 | cf3cea841cd34533d939b0264fb071b70df3070f | #!/usr/bin/python
def get_clustering():
f = open('clusterings.txt')
cl = {}
cli = {}
for s in f:
s = s.strip()
topicid, clusterid, docs = s.split(' ', 2)
docs = docs.split()
key = "%s:%s" % (topicid, clusterid)
cl[key] = docs
for doc in docs:
if not cli.has_key(doc):
cli[doc] = key
else:... |
10,344 | 9b9d012e10333cce663aad0f1c5a5795d8529bcc | #!/usr/bin/env python3.5
'''
openlut: A package for managing and applying 1D and 3D LUTs.
Color Management: openlut deals with the raw RGB values, does its work, then puts out images with correct raw RGB values - a no-op.
Dependencies:
-numpy: Like, everything.
-wand: Saving/loading images.
-PyOpenGL - For image ... |
10,345 | f53a3c05ad8d04f2706c844bb63028d97bbe7b37 | # Here we will read xml file using python.
# Importing libraries/modules
import os
import codecs
import csv
import bz2
import time
import json
import logging
import argparse
class Requirements():
def __init__(self, args):
dump_path = args.dump_path
if dump_path is None:
dump_path = os... |
10,346 | 13cfed24aa13e33bd0562ea0d5022d72aca0e5c6 | # This Python file uses the following encoding: utf-8
"""autogenerated by genpy from map_file/Lane.msg. Do not edit."""
import sys
python3 = True if sys.hexversion > 0x03000000 else False
import genpy
import struct
class Lane(genpy.Message):
_md5sum = "14eee265f5c4b4e93a294e03e3451866"
_type = "map_file/Lane"
_... |
10,347 | dcae57870138f70581d9d555558173263a8d4a59 | __author__ = 'mithrawnuruodo'
from Stepper import SoncebosStepper
from DataModels import RawData, Data, PrintingTaskData |
10,348 | 95309fa1a5a5288d32d870a9c6d1a034906f5c6d | # Generated by Django 2.0 on 2021-05-10 06:07
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('login', '0008_auto_20210510_1131'),
]
operations = [
migrations.RemoveField(
model_name='user',
name='otp',
),... |
10,349 | 84d7c272e009fdf25f69ffdc8f15c42853d32e3e | # -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
import logging
import re
class WikiPipeline(object):
def process_item(self, item, spider):
list_of_age = []
... |
10,350 | bfba4caa5f13f30ba0d310c0e55d8ebd7bba728d | # -*- coding: utf-8 -*-
"""
fabrik.ext.npm
-------------------------
"""
from fabric.decorators import task
from fabric.state import env
def install():
env.run("npm install")
|
10,351 | 64f62b598b53c57fdc870e753bb2fb1594b0c3c9 | from django.shortcuts import render, reverse, HttpResponseRedirect
from django_mptt_hierarchy.models import File
from django_mptt_hierarchy.forms import FileAddForm
from django.views import View
def homepage_view(request):
return render(request, "homepage.html", {"files": File.objects.all()})
def file_add_view(... |
10,352 | 0d7c3f33c1d1a53905911ef255de12197de62ccd | # cython: language_level=3
from __future__ import absolute_import
from .PyrexTypes import CType, CTypedefType, CStructOrUnionType
import cython
try:
import pythran
pythran_is_pre_0_9 = tuple(map(int, pythran.__version__.split('.')[0:2])) < (0, 9)
pythran_is_pre_0_9_6 = tuple(map(int, pythran.__version__... |
10,353 | 9250e0b366c00826c2ffd9b36c3d6e0c97b57798 | import pexpect
import re
import _thread
import threading
import json
import math
import time
from queue import Queue
from threading import Timer
from time import sleep
from videoplayer import VideoPlayer
from gpiocontroller import GPIOController
from datastore import DataStore
from playlist import Playlist
from link im... |
10,354 | 9d9108b8e34005b0a218c63e0bff09bad8b0ac20 | import re
def hey(said):
# if(any(x.isupper() for x in said[1:]) and '?' not in said):
if said.isupper():
return 'Whoa, chill out!'
elif len(said) > 0 and said[len(said)-1] == '?':
return 'Sure.'
elif re.search('[a-zA-Z0-9]', said) is None:
return 'Fine. Be that way!'
elif(len(said)>0):
return 'Whatever.'... |
10,355 | f9773711fb486582a61c605812563f5d907e02e3 | from utils import *
import matplotlib.pyplot as plt
# *************************************
# Question 2
# *************************************
# Utilisation de la fonciton rand_gauss
n=200
m=[1, 2]
sigma=[0.1, 0.2]
data = rand_gauss(n, m, sigma)
plt.hist(data[:,0])
plt.hist(data[:,1])
plot_2d(data)
# Utilisatio... |
10,356 | 8bd097acf85b51e4e7c9cd5228c40a9ccd084f3d | import os
import csv
import torch
from itertools import groupby
from typing import List, Dict
from torch.utils.data import DataLoader, RandomSampler, SequentialSampler
from collections import Counter
from sklearn.utils import shuffle
def flatten(l):
return [i for sublist in l for i in sublist]
def save_predicti... |
10,357 | ffe9e00143e1a9a0ef6ccb8e4e7bc8baaebd1c69 | #!/usr/bin/env python3
# -*- coding: utf-8 -*- #
import os
import argparse
import subprocess
import circling_r
from circling_py.OBc import *
levels = ["A","B","C","D","E*","E**","F"]
def getOpt():
parser = argparse.ArgumentParser(description="Audit species barcodes from OBc pipeline", add_help=True)
parse... |
10,358 | 38064f01b5d80fb3f95a8e35f35eb23201e45e49 | from django.shortcuts import render
# Create your views here.
from django.http import HttpResponse
def index(request):
return HttpResponse("WELCOME RUCHI")
def index1(request):
return HttpResponse("helloooo")
|
10,359 | 4e535457c809608ee0856f95584f95e54884559a | PlotGrid(2, 2, p1, p2 ,p3, p4)
# PlotGrid object containing:
# Plot[0]:Plot object containing:
# [0]: cartesian line: x for x over (-5.0, 5.0)
# [1]: cartesian line: x**2 for x over (-5.0, 5.0)
# [2]: cartesian line: x**3 for x over (-5.0, 5.0)
# Plot[1]:Plot object containing:
# [0]: cartesian line: x**2 for x ... |
10,360 | 2b1f350da926bce0755f3823f2d4a2a099962c0a | """Pilot Reports (PIREP)
This module attempts to process and store atomic data from PIREPs. These are
encoded products that look like so:
UBUS01 KMSC 221700
EAU UA /OV EAU360030/TM 1715/FL350/TP B737/TB CONT LGT-MOD CHOP =
EHY UA /OV MBW253036 /TM 1729 /FL105 /TP C206 /SK FEW250 /TA M06
/TB NEG /RM SMTH=
Un... |
10,361 | a2e9b3f87dee7f32c0a2c79b203831942c3aa195 | def solution(arr,sum):
arr.sort()
div = arr[len(arr)-1]-arr[0]
if div>sum:
return 1
return 0
nums = int(input())
for x in range(nums):
arr = list(map(int,input().split()))
num = int(input())
count=0
for i in range(0,len(arr)):
for j in range(i+1,len(arr)):
temp = solution([arr[x] for x in range(i,j+1)],... |
10,362 | a69b76d2906842d2264a6b7801e31aa5b8c28d4a | #!/usr/bin/env python3
# we're using python 3.x style print but want it to work in python 2.x,
from __future__ import print_function
import os
import argparse
import sys
from collections import defaultdict
try: # since gzip will only be needed if there are gzipped files,
import gzip # accept failure to import it... |
10,363 | fa5e337111e53cb5a5c6b0fde0214c8e67d167d4 | # list of tuples with book names and links
BOOKS = [("hp1_sorcerers_stone", "http://www.glozman.com/TextPages/Harry%20Potter%201%20-%20Sorcerer's%20Stone.txt", "txt"),
("hp2_chamber_of_secrets", "http://www.glozman.com/TextPages/Harry%20Potter%202%20-%20Chamber%20of%20Secrets.txt", "txt"),
("hp3_pri... |
10,364 | 0cfe04596a2eb4f44f4425dbd9ebc5be78b4adcd | """Reduce 操作"""
# TO BE UPDATED
from functools import partial
from typing import Any, Callable, Generator, Iterable, Iterator
from more_itertools import chunked, first, take
from multiprocess import Process, Queue, cpu_count
from pb import ProgressBar
from .map import map
def reduce(
func: Callable[[Any, Any]... |
10,365 | 98568df731d9b9df37d7c0a8a60289abb8c8f309 | class TeamsAsyncOperationStatus:
def __init__(self):
"""Describes the current status of a teamsAsyncOperation."""
pass
invalid = 0
""" Invalid value."""
notStarted = 1
"""The operation has not started."""
inProgress = 2
""" The operation is running."""
succeeded = 3
... |
10,366 | 70bbbbaa44beb68125628ed22dd6e2c5e710b163 | """add event log event type idx.
Revision ID: f4b6a4885876
Revises: 29a8e9d74220
Create Date: 2021-09-08 10:28:28.730620
"""
from dagster._core.storage.migration.utils import create_event_log_event_idx
# revision identifiers, used by Alembic.
revision = "f4b6a4885876"
down_revision = "29a8e9d74220"
branch_labels = N... |
10,367 | 1cfb8463c2b7e0b006bbad654851a73c5204abb7 | #!/usr/bin/python
#coding=utf-8
'''
@author: sheng
@license:
'''
SPELL=u'yíngxiāng'
CN=u'迎香'
NAME=u'yingxiang21'
CHANNEL='largeintestine'
CHANNEL_FULLNAME='LargeIntestineChannelofHand-Yangming'
SEQ='LI20'
if __name__ == '__main__':
pass
|
10,368 | 1f432314f5ee55956fd28d6d5468eb95e22c4179 | """DICOM cardiac MRI image training pipeline.
Usage:
dicompipeline [--log <level>] (--data-dir <data_dir>)
dicompipeline (-h | --help)
dicompipeline --version
Options:
--log <level> Specify the log level to use, one of "info",
"warning", or "debug".
... |
10,369 | 6a3c970560647dfeec6c4d4b3affc8294b4d015c | #Utilizando um arquivo de dados com varias colunas (por exemplo, o arquivo dados_alunos.txt),
#faca um histograma com os dados de cada uma das colunas.
#Dica: utilize o matplotlib para fazer os histogramas.
import matplotlib.pyplot as plt
fout = open('dados_alunos.txt', 'r')
linhas = fout.readlines()
lista_idade=[... |
10,370 | e518ae7bd7ff3b7defdf5bacabfddb0b3b87d031 | from generation import MarkovChains
import re
file = open("sonnets.txt")
text = re.sub(r'\n.+\n', '', file.read())
markov = MarkovChains(";:.!?")
markov.add_text(text)
print(markov.generate_text(4))
|
10,371 | ae37b54b6472a7989a5fccc1024b332277864ccf | import matplotlib.pyplot as plt
import numpy as np
import itertools
"""
Some helper function to plot data
"""
def plot_data(x, y, epochs):
"""
This function plots the model loss over the iterations.
"""
fig = plt.figure()
ax = fig.gca()
ax.set_ylim(0, int(np.max(y)+0.5))
ax.set_xlim(0,... |
10,372 | 74bb1164b3633467a25e20ed683ec724c0c9f097 | import numpy as np
import matplotlib.pyplot as plt
class Plotter:
def __init__(self):
pass
def plotBarGraph(self, percent_correlation_r):
ind = np.arange(7)
width = 0.7
width = 0.7
test = tuple(percent_correlation_r[0.0])
p0 = plt.bar(ind, percent_correlation... |
10,373 | e820f647810a6d60e6f47e5be74bdf99e99bda55 | from django.contrib import admin
# Register your models here.
from .models import Student
class SignUpAdmin(admin.ModelAdmin):
class Meta:
model = Student
admin.site.register(Student, SignUpAdmin)
|
10,374 | 2a62f0b81a01278f14024366ae15b5ea50a13514 | import sys
from uploadFile import get_pred_files_names
get_pred_files_names(sys.argv[1])
|
10,375 | c93d1795a0afc792efb79df697776174e0b22d01 | from Products.ProjectDatabase.reports.ProjectsAtRiskReportFactory \
import ProjectsAtRiskReportFactory
from basereport import BaseReport
from Products.CMFCore.utils import getToolByName
class ProjectsAtRiskReport(BaseReport):
def getReport(self):
factory = ProjectsAtRiskReportFactory(self.context, proj... |
10,376 | c6cf924eeaab7d87240564e1f386acd6f4b2fbac | '''
Simple Balanced Parentheses using stack
'''
class Stack:
def __init__(self):
self.items = []
def isEmpty(self):
return self.items == []
def push(self, item):
self.items.append(item)
def pop(self):
return self.items.pop()
def peek(self):
return self.items[len(self.items)-1]
def size(self):
re... |
10,377 | 8aa370e39e796356a423f2a91cbb9e58617e854d | """
Copyright 2015 Rackspace
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 applicable law or agreed to in writing, software
dist... |
10,378 | 507c50b79710a1ad10754925c7e31d1924334001 | import datetime
from sqlalchemy import Column, Integer, String, Text, DateTime
from sqlalchemy.types import DECIMAL
from app.db.base_class import Base
class Product(Base):
id = Column(Integer, primary_key=True, index=True)
name = Column(String, index=True)
description = Column(Text, nullable=True)
s... |
10,379 | 8e5aeecd09ac2781faa17d7c079b928fba0594eb | import json
import pytest
from typing import (
TYPE_CHECKING,
cast,
)
from eth_typing import (
ChecksumAddress,
)
from eth_utils import (
is_checksum_address,
is_list_like,
is_same_address,
is_string,
)
from hexbytes import (
HexBytes,
)
from web3 import (
constants,
)
from web3.da... |
10,380 | 7d24955d06eabb452218b9187089f5bf9b0b9860 | try:
import os
import sys
import difflib
import hashlib
from PyQt5 import QtCore, QtWidgets
from PyQt5.QtGui import QColor
except Exception as e:
print('Error:', e)
os.system("pause")
sys.exit()
IGNORE_FILES_EXTS = 'jpg', 'jpeg', 'png', 'ttf', 'mo', 'so', 'bin', 'cgi',... |
10,381 | f74ee2b88d89b83d93a0d45b5d30826f093e5c5a | import itertools
import os
import random
import pytest
from polyswarmd.utils.bloom import BloomFilter
@pytest.fixture
def log_entries():
def _mk_address():
return os.urandom(20)
def _mk_topic():
return os.urandom(32)
return [(_mk_address(), [_mk_topic()
fo... |
10,382 | ec6bfb386f8c36a03d08e4c5117468bf318328e6 | # Definition for binary tree with next pointer.
# class TreeLinkNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
# self.next = None
class Solution:
# @param root, a tree link node
# @return nothing
def connect(self, root):
if r... |
10,383 | 9ef41c2ea05ebcfa5f20bb062e0248ed05f973d5 | # File to scrape recipes from allrecipes.com
from requests import get
from requests.exceptions import RequestException
from contextlib import closing
from bs4 import BeautifulSoup
# Attempts to get the content at the specified url
def simple_get(url):
try:
with closing(get(url, stream = True)) as resp:
if ... |
10,384 | 2e825df4c686ca657196cbf4d6e97081b61e3c39 | import requests
p = 12027524255478748885956220793734512128733387803682075433653899983955179850988797899869146900809131611153346817050832096022160146366346391812470987105415233
q = 1213107243921127189732367153161244042847242763370141092563454931230196437304208561932419736532241686654101705736136521417171171379797429933... |
10,385 | 8f91c57ad1047ad76a08f620f4f04014fb2671ef | import sys
import os
uttlst = file('lst/thu_ev.lst').readlines()
for i in uttlst:
each = i[:-1].split(' ')
os.makedirs('data/'+each[0])
fout = file('data/'+each[0]+'/wav.scp','w')
fout.write(i)
|
10,386 | efdc92912cabf3f0f253fdf35e201fe0587100ff | #importing library
import pandas as pd
from keras import models
from keras import layers
from keras.datasets import boston_housing
from keras.models import Model
from sklearn.model_selection import cross_val_score
from keras.layers import Input, SimpleRNN, Dense,LSTM,GRU
from keras import optimizers
from hyper... |
10,387 | 72bff87f8b35451e1b25dd5085dfff409389892c | # coding: UTF-8
from list import LinkedList
'''
class SimpleStack: Stack with simple implementation(built-in arraylist).
class ListStack: Pushdown Stack(linked-list implmentation).
'''
class SimpleStack(object):
'''
Stack with simple implementation(built-in arraylist).
-------------
Stack(): init q... |
10,388 | 86c3ef73384556e9f63992b6bf2a1755149968bf | n=int(input())
b=[]
s=0
for i in range(n):
l=list(map(int,input().split()))
b.append(l)
for i in range(len(b)):
s+=b[i][i]
print(s)
|
10,389 | 71fc177d2880b159495e2759315df3bd0d9d7d6a | import jinja2
import markdown
from schema import (
INDEX_FILES, INDEX_TITLE, INDEX_LINK,
RESEARCH_FILES, RESEARCH_TITLE, RESEARCH_LINK,
TEACHING_FILES, TEACHING_TITLE, TEACHING_LINK,
PROGRAMMING_FILES, PROGRAMMING_TITLE, PROGRAMMING_LINK,
)
def convert_file(fname):
"""
Convert markdown file `... |
10,390 | da55f20712cc1578a9535bcc2fe2e1334fd9f6b8 | import json
from datetime import datetime
from pprint import pprint
from typing import List, Dict
import numpy as np
import pandas as pd
from spotify_api import SpotifyClient
def _get_track(playlist_item):
if "track" in playlist_item:
return playlist_item["track"]["name"]
else:
return playlis... |
10,391 | 7be5056bd3b6f0838b032a0757b7ccd02285043c | # coding: utf-8
import glob
from time import time
from preprocess_text import corpus
from sklearn.feature_extraction.text import TfidfVectorizer, CountVectorizer
from sklearn.decomposition import NMF, LatentDirichletAllocation
from nltk import word_tokenize
from nltk.stem import WordNetLemmatizer
import re
... |
10,392 | af9db97c3b3f2a8d21e4b76025497f20bba11a6f | #author: Riley Doyle
#date: 7/16/20
#file: calc_CO2_loss_alk
#status:working
import numpy as np
import matplotlib.pyplot as plt
from calc_Ks import *
from calc_alphas import *
def calc_CO2_loss_alk (pK1, pK2, Kh, pH, d, PCO2, alkin, alkend, delalk, kLain, kLaend, delkLa):
L = np.array(['-', '--', '-.', ':', '--'... |
10,393 | ebd97a9827cc878d1bc33144a955df5a3608c774 | import numpy as np
from matplotlib import pyplot as plt
import cv2
def erode(a, b):
# 结构元反射后再卷积,相当于直接求相关
# opencv中该函数其实是求的相关
dst = cv2.filter2D(a, -1, b, borderType=cv2.BORDER_CONSTANT)
sum_b = np.sum(b)
dst = np.where(dst == sum_b, 1, 0)
return dst.astype(np.uint8)
def dilate(a, b):
# 结... |
10,394 | 6876e5d4c6f97dd89fa62af36f68c04dc324a006 | from django import forms
from django_grapesjs import settings
from django_grapesjs.utils import get_render_html_value
from django_grapesjs.utils.get_source import get_grapejs_assets
__all__ = (
'GrapesJsWidget',
)
class GrapesJsWidget(forms.Textarea):
"""
Textarea form widget with support grapesjs.
T... |
10,395 | 1aa8c01e29a76fb784363e668a42228f67f326ff | from sys import argv
script, filename = argv
txt = open(filename)
print "Here's your file %r:" % filename
print txt.read()
#We call a function on txt named read.
#What you get back from open is a file,
#and it also has commands you can give it.
#You give a file a command by using the . (dot or period),
#the name of... |
10,396 | 05ff6f4af7c7503d0c4aab453a157d667ddf62bd | #Simone and David
import numpy as np
import random
import matplotlib.pyplot as plt
from Config import Config
import json
DEBUG = False
if DEBUG:
def simulate_episode(population): #stupid function that only return the sum of all the elements of all the matrixes
fit = []
for m in range(le... |
10,397 | d91a64b5c101a2208b0a073d044f7056ee55e7cc | #!/usr/bin/python3
#-*-coding:utf-8-*-
import os
import time
import string
import re
cf = {
'author':'Remilia Scarlet',
'header-img': "img/post-bg-2015.jpg"
}
def menuSelect(s,l):
print(s)
for i in range(0, len(l)):
print('\t%d) %s' % (i+1,l[i]))
i = input("layout:")
if i == '':
... |
10,398 | e358d21d574632acfb3f3f27bf3553387aeb9920 | from django.contrib.auth import authenticate
from rest_framework import serializers, status
from rest_framework.response import Response
from rest_framework_jwt.serializers import (
JSONWebTokenSerializer,
jwt_payload_handler,
jwt_encode_handler,
)
class JWTLoginSerializer(JSONWebTokenSerializer):
def... |
10,399 | c6bd402b9d09b13a73d21aa1b207012efc557f21 | import numpy as np
fileName = '/Users/shuruiz/Work/researchProjects/INTRUDE/data/PR_count.csv'
list_repo = []
list_repo_1 = []
list_repo_2 = []
list_repo_3 = []
with open(fileName) as f:
lineList = f.readlines()
for line in lineList:
repo, pr_num = line.split()
if(repo == "repo"): continue
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.