index int64 0 1,000k | blob_id stringlengths 40 40 | code stringlengths 7 10.4M |
|---|---|---|
12,100 | 4de1b4c364173f018b3ff5b938db64fa0b61c3ba | import os
import tensorflow as tf
from tensorflow.contrib.framework.python.ops import audio_ops as contrib_audio
from tensorflow.python.ops import io_ops
from tensorflow.python.platform import gfile
sample_rate = 16000
class WavLoader:
def __init__(self,name=None,desired_samples=None):
with tf.name_scope... |
12,101 | 6a046028c6a5f744bcc2d2988bf425b20746aa37 | #!/usr/bin/python3
import json
from apps.found_handler_v2 import RedisHandler
from lib.routes import route
from lib.authenticated_async import authenticated_async
from apps.models.user import User_Challenge
from apps.models.config import Config
# 1.闯关入口
@route('/challenge')
class ChallengeHandler(Red... |
12,102 | 9cadcd9e658beba93cc2780aaff51836d017b903 | GITHUB_TOKEN = "YourTokenHere"
|
12,103 | 84b4313b59cb60649f27d1a01a9237f7bb3cf253 | #Find biggest of 3 numbers entered.
x = int(input("Enter 1st number: "))
y = int(input("Enter 2nd number: "))
z = int(input("Enter 3rd number: "))
if (x > y) and (x > z):
largest = x
elif (y > x) and (y > z):
largest = y
else:
largest = z
print("The largest number is",largest) |
12,104 | 761b98876ac676cff12e55a2856edf430b0c3409 | from django.shortcuts import render
from .models import Subway
# Create your views here.
def index(request):
return render(request, 'boards/index.html')
def subway_order(request):
return render(request, 'boards/subway.html')
def subway_result(request):
name = request.POST.get("name")
date = request.... |
12,105 | 6b25cdb5a942501512a923a886c430b1f0f8408b | #__author__= 'Jerry Li'
count = 0
sum = 0
for i in range (1, 1000):
if(i % 5 == 0 or i % 3 == 0):
sum = sum + i
print(sum)
#final answer: 233168
|
12,106 | fa34b5c92be471dc7e794eb9c2bb4a89c249f31b | # Generated by Django 3.1.4 on 2020-12-09 11:06
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0004_auto_20201209_1905'),
]
operations = [
migrations.AlterField(
model_name='userinfo',
name='phone',
... |
12,107 | 227db333511123b722b2fee96a80f03a194bf43c | #!/usr/bin/python
'''
This script generates a codon optimised protein based upon a fasta protein
sequence and a table of relative codon usage.
'''
from sets import Set
import sys,argparse
from collections import defaultdict
import re
import numpy as np
import csv
import random
from Bio import SeqIO
#----------------... |
12,108 | 9c1cdf23b54a07be3c6967718e0cee50a532b689 | #!/usr/bin/env python3
import os
import yaml
HOME = os.path.expanduser("~")
class Dotfile:
def __init__(self, source, target_dir, dotify=False, create_parent=False):
self.source = source
target_file = os.path.basename(self.source)
if dotify:
target_file = ".{}".format(target_... |
12,109 | 07ca6ca4286b97357cec4a80177b92f15f75ceb9 | """Package of support modules for SriteBot."""
|
12,110 | ea515486ba00a9e5ced7ec43f078f9585faeafd6 | from types.user_mapping import UserMapping
USER_GROUPS_MAPPING_NAME = "user_category_mapping"
#----------------------------------------------------------------------------------------------
class GroupCategoryMapping():
def __init__(self, instance):
self.instance = instance
#---------------------... |
12,111 | bc2e8a6d761eee5c78fcd183dc0eb8f7e8aae7c9 | import pandas as pd
import sqlite3
import matplotlib.pyplot as plt
df_adidas = pd.read_csv('adidas_data.csv')
data_adidas = pd.DataFrame(df_adidas, columns=['product_name', 'product_id', 'listing_price', 'sale_price', 'discount'])
# print(data_adidas)
df_nike = pd.read_csv('nike_data.csv')
data_nike = pd.DataFrame(df... |
12,112 | 8a7220315397e8716b1a7a36a81213cfd6d2ed53 |
from tensorflow.keras import Model, Input
from model import layers
class DecoderModel(object):
def __init__(self, input_shape):
self.build(input_shape)
@property
def model(self):
return self._model
def build(self, input_shape):
'''
input: concat of z_a and z_p -> ... |
12,113 | fd591457ce443a167a6fcad0ae99974cc685829e | import pymysql
db = pymysql.connect("localhost", "root", "Admin01", "Empleado")
#db = pymysql.connect(host='localhost', port=3306, user='admin', passwd='Admin01', db='employees')
cursor = db.cursor()
# Prueba de Instalacion de MYSQL
#cursor.execute("select version()")
#data = cursor.fetchone()
#print("version de MyS... |
12,114 | 1cbf44ed9075d83427d97ec50b1661aeefdb4c1a | # Generated by Django 2.2.2 on 2019-06-19 17:27
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('dashboard', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='stock',
name='title',
f... |
12,115 | df21edc96a6b4570ea06736177b946c486d1b333 | #key는 unique해야 하며, 불변 이다 , value 는 가변(변경 가능)
dict = {'Name': 'Zara', 'Age': 7, 'Class': 'First'}
print ("dict['Name']: ", dict['Name'])
print ("dict['Age']: ", dict['Age'])
dict = {'Name': 'Zara', 'Age': 7, 'Class': 'First'}
print ("dict['Alice']: ", dict['Alice']) #존재하지 않는 키로 요소에 접근할 경우?
dict['Age'] = 8; #요소의 val... |
12,116 | 1c54813df34ab8768c31d72ea37d4234d0573ca7 | # encoding=utf8
import random
def bubble_sort(nums):
"""
冒泡排序
一种稳定的排序方法,最好的情况下的时间复杂度为O(n), 最坏的情况下时间复杂度为O(n²), 平均情况下的时间复杂度为O(n²). 空间复杂度为O(1)
:param nums:
:return:
"""
i = 1
while i < len(nums):
j = i - 1
while j < len(nums) - 1:
if nums[j] > nums[j+1]:
... |
12,117 | 417933aa5a3f5cad2a86d8a9099a02b4a9c250b8 | """
Code loading and analyzing SVHN images and data
"""
import os
import numpy as np
from PIL import Image
print('All modules imported.')
# Wait until you see that all files have been downloaded.
print('All files downloaded.')
def load_svhn_images(folder_path):
"""
Load in all images from a folder
:para... |
12,118 | e7ce4122a9aeaa7bce89b547fc74998276b15194 | from hls4ml.converters.keras_to_hls import keras_handler, parse_default_keras_layer
merge_layers = ['Add', 'Subtract', 'Multiply', 'Average', 'Maximum', 'Minimum', 'Concatenate', 'Dot']
@keras_handler(*merge_layers)
def parse_merge_layer(keras_layer, input_names, input_shapes, data_reader):
assert keras_layer['c... |
12,119 | d15c5914979c3fd65165b73606883e7f3c050a98 | name= "data.csv"
print("name.split:")
|
12,120 | c644091e62283d8ed6861abf25029a89d84bfabb | """
Displays index.html. Leaves the routing to react.
"""
from flask import render_template
from . import app
@app.route('/')
@app.route('/gameDayLineups')
@app.route('/gameDateGames')
@app.route('/gameDayAnalysis')
def show_index():
return render_template('index.html')
|
12,121 | 2e4a484adcbd6989658addc70c811bd134eb2137 | #!/usr/bin/env python
import sublime
import sublime_plugin
import plistlib
import subprocess
import webbrowser
"""
macOS customize:
/usr/bin/open default
path/to/custom/open custom
export PATH=path/to/custom:$PATH ~/.bashrc
"""
MAC = "osx" in sublime.platform()
c... |
12,122 | c10993063dffa31d28e979ce5997effd14483e19 | """файл с классом для форматирования текста постов"""
import re
from telegraph import Telegraph
from models import Post
from emoji import emojize
class Formatter:
"""класс для форматирования текста постов"""
def __init__(self,post):
self.post = post
self.text = emojize(self.post.text.replace("Ко... |
12,123 | 08389e2cdf8912778c9cd8d796838ee15691c9d2 | __author__ = 'wsr'
__date__ = '2018/10/25 0025 下午 4:08'
from django.conf.urls import url
from .views import *
urlpatterns = [
url(r'^$', index,name='index'), #首页链接
url(r'^login/$', LoginView.as_view(),name='login'), #登录页面链接
url(r'^register/$', RegisterView.as_view(), name='register'), #注册页面链接
] |
12,124 | 0084b5137df5a7e6e6f04e0ca2ae84d6185cadfb | from abc import abstractmethod
from .base import OperatorConverter
class ATenPackSequenceSchema(OperatorConverter):
@abstractmethod
def parse(self, node, attrs, args, graph_converter):
'''aten::_pack_sequence(Tensor output, Tensor batch_sizes, Tensor? sorted_indices, Tensor? unsorted_indices) -> (Ten... |
12,125 | 9e420833d8016a97809726225a3e5e002066f2c3 | import os
from engine.core import module
from engine.hardware import use_gpu, first_device, all_devices, device_description
from engine.logging import print_info, print_errors, print_debug
import torch
from engine.parameters import special_parameters
from engine.path import output_path
_checkpoint_path = 'models/{... |
12,126 | a1160401f1c4c2e4f8e2651681a32c837acd457d | # ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
## -------- General Local Endpoint Errors -------- ##
from typing import Union
from azure.ai.ml._ml_exceptions import MlException, Error... |
12,127 | a38f6e4bd75237ccee0bcdfcfdd9d67f19d509b7 | from section import *
from symbols import *
from dispatcher import dispatcher
arg_table = {
}
class simple_section(section) :
"""
Simple point-to-point section
"""
def __init__(self, name, **args) :
construct(self, arg_table, args)
section.__init__(self, name, **args)
def positi... |
12,128 | 07b6b4c745ae50cc7ec1ff5087b95d209db2c8c6 | from datetime import datetime, timedelta
from unittest import TestCase
from django import http
from django.conf import settings
from webpay.pin import utils
class PinRecentlyEnteredTestCase(TestCase):
def setUp(self):
self.request = http.HttpRequest()
self.request.session = {}
def test_pin... |
12,129 | f51ac104675541f5a596fd766ccb625f3e03b8e5 | # coding:utf-8
from rest_framework import serializers
from .models import Goods, GoodsCategory
# class GoodsSerializer(serializers.Serializer):
# click_num = serializers.IntegerField(default=0)
# name = serializers.CharField(required=True, allow_blank=True, max_length=100)
#
# def create(self, validated_... |
12,130 | 495d59aa1596e68f9a418ea36fe478fac2c7dbaa | from app_justcook.models.tecnica import TecnicaModel
from flask_restful import Resource
class Tecnica(Resource):
def get(self):
tecnicas = TecnicaModel.find_all()
return [tecnica.json() for tecnica in tecnicas], 200
class TecnicaId(Resource):
def get(self, tecnica_id):
tecnica = Tecn... |
12,131 | 7487ec57487df548f68ef2857828306fad7d9373 | import math
a = 5
b = 8
c = 1
delta = b * b - 4 * a * c
if delta < 0:
print ("A equação não possui raizes reais")
elif delta == 0:
raiz = (-1 * b + math.sqrt(delta)) / (2 * a)
print ("A raiz da equação é: ",raiz)
else:
raiz1 = (-1 * b + math.sqrt(delta)) / (2 * a)
raiz2 = (-1 * ... |
12,132 | 545881018530be36d4b6128fa1a12822b94ee356 | #!/usr/bin/env python
# coding: utf-8
# In[3]:
print("hello world")
# In[4]:
dir()
# In[5]:
dir(_i)
# In[9]:
import string
# In[10]:
"Hello World".split()
# In[13]:
#Try-catch statement
try:
print(7/0)
except ZeroDivisionError:
print("Division by zero")
# In[14]:
# String with multip... |
12,133 | 9a07a9afc06a44a63c0b37182aa9832fe7b28c7f | from helpers.utilities import *
|
12,134 | 26c1e655b79a3c677e32915058a0ad24ef65cfb0 | from pippi import dsp
from pippi import tune
def play(ctl):
midi = ctl.get('midi')
midi.setOffset(111)
pw = midi.get(1, low=0.01, high=1)
scale = [1, 2, 3, 6, 9]
scale = tune.fromdegrees(scale, octave = midi.geti(4, low=0, high=4))
freq = dsp.randchoose(scale)
length = dsp.stf(midi.get(2... |
12,135 | 8b035af8a56c86e5eb03a5febd8d597de2d097b2 | # Scrapy settings for tutorial project
#
# For simplicity, this file contains only the most important settings by
# default. All the other settings are documented here:
#
# http://doc.scrapy.org/topics/settings.html
#
BOT_NAME = 'tutorial'
SPIDER_MODULES = ['tutorial.spiders']
NEWSPIDER_MODULE = 'tutorial.spiders... |
12,136 | 7c0eee6bfe3d91423732b429d33ceb83072387c0 | import os
import os.path
import re
import copy
re_os_sep = re.compile(r"[/\\]+")
class JSIndex(object):
formats = [
('.js', "application/javascript"),
]
def __init__(self):
self.index = []
def addpath(self, path):
if os.path.isfile(path):
self.addfile... |
12,137 | 3a5253a66aa4f68d25b5bb152f34bf7096e28df0 | import cv2
import numpy as np
from matplotlib import pyplot as plt
import itertools as it
invert = True
find_contours = True
img = cv2.imread('img/batman.png',0)
ret,thresh1 = cv2.threshold(img,127,255,cv2.THRESH_BINARY)
#ret,thresh2 = cv2.threshold(img,127,255,cv2.THRESH_BINARY_INV)
#ret,thresh3 = cv2.threshold(img,... |
12,138 | bd8edb2a832853ab3532249e75787f6e33a69660 | import networkx as nx
from aoc.util import perf
test_data = """start-A
start-b
A-c
A-b
b-d
A-end
b-end"""
from aocd import data
@perf
def solve(data, double_visit=False):
G = nx.Graph()
for line in data.splitlines():
G.add_edge(*line.split('-'))
return sum(1 for _ in find_paths(G, ['start'], do... |
12,139 | dcf5ee306e7e33cbae5a618e19804c8b97e0bd9f | # -*- coding:utf-8 -*-
"""
@author: leonardo
@created time: 2020-07-01
@last modified time:2020-07-01
""" |
12,140 | 1f771d735b22cf5f7b93157b01f42484df643b62 | # adaption of https://gist.github.com/alexalemi/2151722
import numpy as np
class Welford(object):
""" Implements Welford's algorithm for computing a running mean
and standard deviation as described at:
http://www.johndcook.com/standard_deviation.html
can take single values or iterables
Proper... |
12,141 | 6543af8d371bb91026f650d3e69e740bc9db1374 | import sys
def longestConsti(arr):
#lenth=len(arr)
s=set(arr)
ans=-sys.maxsize-1
for num in arr:
if num-1 in s:
continue
else:
count=1
while num+1 in s:
count+=1
num+=1
ans=max(ans,count)
return ans
ar... |
12,142 | 160c2b065ca0a3955ad1a7bd6bc5b4c92efd97f6 | import mysql
from mysql import connector
db = connector.connect(host="localhost", user="root", password="", db="skatefest")
cur = db.cursor() |
12,143 | f745c40aae18a538cba6f0cca387a754fdf0f276 | from flask import Flask, request
from gaia.api.views import api
import os,logging
import logging.handlers
import gaia.demo.views
def create_app(config=None):
"""
Creates the app.
"""
# Initialize the app
app = Flask("gaia")
# config
app.config.from_envvar("GAIA_SETTINGS")
configure_b... |
12,144 | 4bf74a92a43c24398d74c632102a0f25696d7f79 | from django.contrib import admin
from django.conf.urls import url, include
from apps.users_app import views
urlpatterns = [
url('admin/', admin.site.urls),
url(r'^$', views.index, name='index'),
url(r'^users_app/', include('apps.users_app.urls')),
url(r'^logout/$', views.user_logout, name='logout'),
... |
12,145 | 1ca2638bf4dcc23d74c40011eda618612b55e800 | import time
from selenium import webdriver
# A package to have a chromedriver always up-to-date.
from webdriver_manager.chrome import ChromeDriverManager
from proxies import chrome_proxy
USERNAME = "your_username"
PASSWORD = "your_password"
HOST = "pr.oxylabs.io"
PORT = 7777
# Specify country code if you wan... |
12,146 | 7dbfb19b89e4096346dd5f9f4eff8cfb1596ce29 | class Solution:
def removeDuplicateLetters(self, s):
char_list = sorted(set(s))
for char in char_list:
position = s.index(char)
next_string = s[position:]
if set(next_string) == set(s):
return char + self.removeDuplicateLetters(next_string.replace(... |
12,147 | 6672427dfa37d83401d534b6ede52ae52d44a520 |
# method sort_swap : swaps elements at x and y index of list A
def sort_swap(A,x,y):
temp = A[x]
A[x] = A[y]
A[y] = temp
# compare_func : returns comparing function depending upon ascending parameter
def compare_func(ascending):
return (lambda curr, x : (curr < x)) if ascending is True else (lambda curr, x ... |
12,148 | 9b1693d9a6ed7b451f0cabdfefd8af1e6e31f413 | import socket # 导入 socket 模块
import json
import test
from tencentcloud.common import credential
from tencentcloud.common.profile.client_profile import ClientProfile
from tencentcloud.common.profile.http_profile import HttpProfile
from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKExc... |
12,149 | f591812fdfd8ee844441548ef440bbfcb2fc72de |
class naming(object):
def __init__(self):
self.dataset = ""
def features(self, dataset, screening_rule, directory):
self.dataset = dataset
self.screening_rule = screening_rule
self.directory = directory
def phenotype(self, phenotype):
self.phenotype = phenotype
... |
12,150 | 0199d8019130d906e3e4be64c43a9c3705fba1b3 | import time
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.select import Select
browser=webdriver.Chrome('/usr/local/bin/chromedriver')
browser.get('http://localhost:3000/')
a=0
i=20
while i<25+a:
search=browser.find_element_by_id('register_id')
... |
12,151 | 61abf153780cb4c3c7f35b2141a36243d1036bbb | # -*- coding: utf-8 -*-
"""
Created on Tue Oct 22 16:21:44 2019
@author: s1995204
"""
# different way to import packages
import numpy as np
x = np.arange(11)
# from numpy import arange
# x = arange(11)
np.arange(11) # print numbers from 0 to 10
np.arange(1,11,1)
np.arange(0.1,1.1,0.1)
# import the required packag... |
12,152 | 69893ebca275f08b2cb7c1dd7bebd03785f85d98 | from tkinter import ttk, messagebox, Button, Tk, StringVar, Label, Entry, Listbox, END
from BusinessLogic import BLProject, BLRecordType, BLTimeRecordView, BLTimeRecord, TimeRecordValidation, BLDayView, Cache, Globals
from BusinessEntities import TimeRecord, TimeRecordStatusEnum, DayView
import time
from GUI.RecordType... |
12,153 | a18aecbed90bab5f57160c8cb2ba8a4c508b1332 | from mycroft import MycroftSkill, intent_file_handler
class CreateInternalNetworkForGuests(MycroftSkill):
def __init__(self):
MycroftSkill.__init__(self)
@intent_file_handler('guests.for.network.internal.create.intent')
def handle_guests_for_network_internal_create(self, message):
self.sp... |
12,154 | e56487609aacf36e3fde31ccbcfdea8f216c61c5 | import numbers
import numpy as np
import torch.nn as nn
import brancher.distributions as distributions
import brancher.functions as BF
import brancher.geometric_ranges as geometric_ranges
from brancher.variables import var2link, Variable, DeterministicVariable, RandomVariable, PartialLink
from brancher.utilities impo... |
12,155 | 87e43f3384abfa9763559d03e002ce07c385a9f9 | import numpy as np
from numba import cuda, float64, void
from numba.cuda.testing import unittest, CUDATestCase
from numba.core import config
# NOTE: CUDA kernel does not return any value
if config.ENABLE_CUDASIM:
tpb = 4
else:
tpb = 16
SM_SIZE = tpb, tpb
class TestCudaLaplace(CUDATestCase):
def test_lap... |
12,156 | 44f4ed092a04a9904792581716a82bce58190f61 | from rest_framework import serializers
from adplayer.models import Playlist,Player,Video,Impression
from rest_framework import serializers
from django.contrib.auth.models import User
from django.contrib.auth import authenticate
class CreateUserSerializer(serializers.ModelSerializer):
class Meta:
model = ... |
12,157 | a0c19e99cb03a5edbd680895eba3a015775c3868 | # -*- coding: utf-8 -*-
import os
import random
import string
from sqlalchemy.dialects import registry
registry.register("awsathena.jdbc", "pyathenajdbc.sqlalchemy_athena", "AthenaDialect")
BASE_PATH = os.path.dirname(os.path.abspath(__file__))
S3_PREFIX = "test_pyathena_jdbc"
WORK_GROUP = "test-pyathena-jdbc"
SCHEM... |
12,158 | 41a9026474620d1f9d33ea76233cf7effac361e1 | a=[]
b=int(input("value of N"))
count=0
for count in range(0,b):
i=int(input("Enter the number:"))
a.append(i)
del i
count+=1
a.remove(min(a))
print(min(a))
|
12,159 | 2361f53dd12066be8e1a06267def865f15bde2ba | #!/usr/bin/env python
'''
def quick_sort(arr):
arr_len = len(arr)
great = []
less = []
if arr_len <= 1:
return arr
else:
pivot = arr[0]
for element in arr[1:]:
if element > pivot:
great.append(element)
else:
less.append(... |
12,160 | 73a243d40cbdcc7111eca3bcf85e7313b911891b | import operator
import json
from text_preprocessing import preprocess
from collections import Counter
from nltk.corpus import stopwords
from nltk import bigrams,ngrams
from collections import defaultdict
import string
import sys
punctuation = list(string.punctuation)
stop = stopwords.words('english') + punctuation ... |
12,161 | 74417d1085587d9eb7c01fd411966e2fc312c1e0 | '''
leadership_tasks_admin - leadership task administrative handling
===========================================
'''
# standard
from datetime import date
from re import match
# pypi
from flask import g, url_for, request
from flask_security import current_user
from slugify import slugify
from dominate.tags import input... |
12,162 | d0ca63029566550a2c9e3888fba9c405ea1b37ea | import tensorflow.compat.v1 as tf
with tf.compat.v1.Session() as sess:
tf.set_random_seed(777)
filename_queue = tf.train.string_input_producer(['/Users/dong-wongim/Documents/playgroud/tensorflow/data-03-diabetes.csv'], shuffle=False, name='filename_quere')
# text 파일 읽어오는 형식 지정
reader = tf.TextLineRea... |
12,163 | a283f4357c878988dec07b5905652ead6c0dff9c | import codecs
from antlr4 import *
from antlr4.InputStream import InputStream
from prompto.parser.OParser import OParser
from prompto.parser.ONamingLexer import ONamingLexer
from prompto.parser.OPromptoBuilder import OPromptoBuilder
class OCleverParser(OParser):
def __init__(self, path=None, stream=None, text=No... |
12,164 | b2ae26f5989b1867d0df4e9b592866d689ce41bc | #Daniel Lee
##CSCI 1101 Section 1
def match(text, matchText):
##searches for a string inside of a texts and checks to see if
##the string is within that larger text
if matchText == text:
return True
for i in range(len(text) - len(matchText) + 1):
if text[i:i+len(matchText)] == matchTex... |
12,165 | 9712a0aec7eea8c6bd6e3dba665a7168b874a2fa | # ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistribu... |
12,166 | a13a75f56d830b8dfeec06a007be5c416fe96145 | import pygame
import person
import constants
import random
import fireball
class Donkey(person.Person):
""" Class which defines the Donkey object """
# Class variable which is a sprite group conatining all
# the donkeys in the game
all_donkeys = pygame.sprite.Group()
def __init__(self,left,bottom,left_bound... |
12,167 | 49df9a396a6730416a739981cd6b71598c1d38b3 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
********************************************
Created on Thu May 10 12:46:34 2018
by
Chamara Rajapakshe
(cpn.here@umbc.edu)
********************************************
Comparing new DYCOMS2 MSCART field file with the old one
"""
import numpy as np
import cpnLES_MSCART... |
12,168 | 92cbb3fa7008784728e29cba362162d912829569 | # PMSP Torch
# Ian Dennis Miller, Brian Lam, Blair Armstrong
__version__ = '0.2'
__project__ = 'pmsp-torch'
__author__ = 'Ian Dennis Miller, Brian Lam, Blair Armstrong'
__email__ = 'CAP Lab'
__url__ = 'https://projects.sisrlab.com/cap-lab/pmsp-torch'
__repo__ = 'https://projects.sisrlab.com/cap-lab/pmsp-torch'
__copyr... |
12,169 | e75e6e34bba9303a88901a3130debae072472683 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Nov 2 17:33:40 2017
@author: Mike
Axial marginal ray data for double gauss lens, wl=587.6nm
[x y z], [tanX, tanY], dist
"""
rayf1r2 = [[[0.000000, 0.000000, 0.000000], [0.000000, 0.000000], 5.866433],
[[25.000000, 0.000000, 5.866433], [-... |
12,170 | 6d13b0d9cf38ab15bb27081fa954f78ef25c3f24 | from django.http import HttpResponse, HttpResponseNotFound, JsonResponse
from rest_framework import status
from rest_framework.response import Response
from rest_framework.decorators import api_view
from rest_framework.parsers import JSONParser
from django.shortcuts import render, redirect
from django.core import seria... |
12,171 | f17b9c57a8c4f322805ef12240cbea560080e0d9 | import hashlib
class md5HashSum():
def valueToHash(self,value):
return hashlib.md5(value).hexdigest() |
12,172 | a57ef4ce37543e5021fc37a5a84c14a849f9193e |
class SplunkLogisticRegression(SplunkClassifierBase):
def __init__(self, host, port, username, password, training='batch', regularization=False):
super(SplunkLogisticRegression, self).__init__(host, port, username, password)
self.training = training
self.mapping = {1:'1', 0:'0'} #change
def initialization(... |
12,173 | ac668e3cb4a8de706c6a595028b94187570cbf0f | import json
from datetime import datetime
def add2protocol(password, ip):
dtts=datetime.now().timestamp()
protocol=loadProtocol()
id=len(protocol)
protocolentry={'ID':id,'DTTS':dtts,'PW':password,'IP':ip}
protocol.append(protocolentry)
saveProtocol(protocol)
def saveProtocol(protocol):
jsondict = json.d... |
12,174 | 05784dfb284c59c2ea2967e8f5aaff12c5100477 | class MinNumberOfCoins:
def run(self, denominations_array, change_to_give):
coins_used = []
for i in range(len(denominations_array) - 1, -1, -1): # we want to start from the highest denomination possible
while change_to_give >= denominations_array[i] and change_to_give > 0: # we go fr... |
12,175 | 132c612dc296181e6bde6e3c82317b8babdd5528 | # -*- coding: utf-8 -*-
# Copyright (c) 2019 BuildGroup Data Services Inc.
from davinci_crawling.proxy.proxy import ProxyManager
from davinci_crawling.throttle.throttle import Throttle
from django.apps import AppConfig
class DaVinciCrawlingConfig(AppConfig):
name = "davinci_crawling"
verbose_name = "Django Da... |
12,176 | d7e2a9c33bc7b4f1705fbbd5194992afd68f6127 | from django.conf.urls import url
from .views import Login, TimeInTimeOutHandler
from .views import Register
from .views import Logout
from .views import API
urlpatterns = [
url(r'^$', Login.as_view(), name='index'),
url(r'^register', Register.as_view(), name='register'),
url(r'^register-member', Register.... |
12,177 | b3976d56bf0e363d3ed8a4933554a3b0a1412f15 | from django.db import models
# Create your models here.
class StoreOTPVerificationLinks(models.Model):
OTP=models.TextField()
mobileNo=models.CharField(max_length=10)
uid=models.TextField() |
12,178 | 7d1e4083597f823270b2c7d4cc52dda1288dcda5 | # Python 3 program to
# find maximum triplet sum
# Function to calculate
# maximum triplet sum
def maxTripletSum(arr, m) :
# Initialize the answer
ans = 0
for i in range(1, (m - 1)) :
max1 = 0
max2 = 0
# find maximum value(less than arr[i])
# from i + 1 ... |
12,179 | 8d919c8d6da907941222470b29c74acc739eef28 | import pytest
from sciwing.modules.embedders.flair_embedder import FlairEmbedder
from sciwing.data.line import Line
from sciwing.tokenizers.word_tokenizer import WordTokenizer
@pytest.fixture(params=["news", "en"])
def flair_embedder(request):
embedding_type = request.param
embedder = FlairEmbedder(embedding_... |
12,180 | 116390819d6805a43e884a6e69fc971ac263a09e | #!/usr/bin/env python3
"""
The benchmark modules provides a convenient interface to standardized benchmarks in the literature.
It provides train/validation/test Tasksets and TaskTransforms for pre-defined datasets.
This utility is useful for researchers to compare new algorithms against existing benchmarks.
For a mor... |
12,181 | d76455024fb6d90ef2286a70ef052a0f0ec57458 | from larcc import *
from exercise1 import *
from TopDown import *
from corridoio import *
serieAppartamenti = T(1)(20.7)(STRUCT([biAppartamento,T([1])([41.4])]*4))
edificioAppartamenti = STRUCT([serieAppartamenti,T([3])(3)]*4)
palazzina = STRUCT([topDown,T([3])([3])(edificioAppartamenti),corridoioPalazzo])
controlpo... |
12,182 | 153555977715370cb1678ff106e621770fd918d9 | #!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# 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 o... |
12,183 | 1fc71061a205ca22935eed019562ac24b5450cc3 | #!/bin/python
str1="abc"
dict1={'key':1,'value':5}
if str1 <> dict1 :
print("string is not equal dictionary")
if str1 != dict1 :
print("string is not equal dict")
get_consult = 9//2
print("9//2=",get_consult)
get_consult1 = 9.0//2.0
print("9.0//2.0=",get_consult1)
print("2**3=",2**3)
|
12,184 | 663ae87147324bbdabfe5cb6cee66b324b6521fc | # Escreva um algoritmo que encontre o maior dentre 3 números.
# Para facilitar a resolução do exercício utilize funções.
def max(x,y,z):
num = [x,y,z]
num.sort()
return num[len(num)-1]
print(max(7,3,4))
|
12,185 | f0dc6fdb8815406d65736663d164119f1d0ec737 | import sys
import os
from argparse import Namespace
import collections
import copy
import random
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
import torch.backends.cudnn as cudnn
from torchvision.datasets import MNIST, CIFAR10
from torch.utils.data import DataLoader
import torchvi... |
12,186 | 952123d5380e1dab0bad2995f9d7d2391c9ce4c5 | import numpy as np
import sys
import csv
from ffnet import *
global inputs
global outputs
def main():
if len(sys.argv) != 2:
print("python test.py [quote]")
else:
net = loadnet("test_net")
output = net.call( [float(sys.argv[1])] )
print output[0]
if __name__ == "__main__":
sys.exit(main())
|
12,187 | db61ed07f595e6f452936de9e597a57cf313c84c | import logging
logger = logging.getLogger(__name__)
params = dict()
try:
import numpy
except ImportError:
raise ImportError(
"'swi-ml has a single NumPy dependency, visit their installation "
"guide: https://numpy.org/install/"
)
try:
import cupy
_raise_cupy_error = False
except ... |
12,188 | 5f2a15bc934c036dfbe207d3d029e4db16906925 | import os
import subprocess
import platform
from copy import deepcopy
from itertools import(chain,
tee,
imap,
ifilter)
from collections import Counter
from operator import itemgetter
from templates import (osx_circos_command,
... |
12,189 | 10fad0d60f9e661cefc0ce67a00735bf92b84f9e | '''
lis[][0]:Petrol
lis[][1]:Distance
'''
#Your task isto complete this function
#Your function should return the starting point
def tour(lis, n):
start =0
total = len(lis)
end = 1 % total
petrol_left = lis[start][0] - lis[start][1]
while start != end or petrol_left < 0 :
while petro... |
12,190 | 1aa8d0c472492e0413f3466ecb65dfbcc84ff1d9 | import cv2
import math
def fillHoles(mask):
'''
This hole filling algorithm is decribed in this post
https://www.learnopencv.com/filling-holes-in-an-image-using-opencv-python-c/
'''
maskFloodfill = mask.copy()
h, w = maskFloodfill.shape[:2]
maskTemp = np.zeros((h+2, w+2), np.uint8)
... |
12,191 | 395fe22294644688c2cc8ed452ae9670dcd55e91 | import plotly.graph_objs as go
import numpy as np
from analysis.misc import rgba
from analysis.global_vars import user_review_model
from analysis.global_vars import UI_STYLES
from analysis.misc import map_to_new_low_and_high, get_relative_strengths
from enum import Enum
class FeatureDisplayMode(Enum):
predicti... |
12,192 | 7db88d6acc2fbae38f487d064007ec028aa7a4c2 | from typing import Optional
from pydantic import BaseModel
class BETInput(BaseModel):
"""Default BET Fitting response"""
pressure: list
loading: list
pressureMode: str
pressureUnit: str
materialBasis: str
materialUnit: str
loadingBasis: str
loadingUnit: str
material: str
... |
12,193 | c6a8a3dbac9a51a7063310d5bdf901f46d12abdb | # Generated by Django 2.2.3 on 2019-07-27 21:14
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('Manufactures', '0002_auto_20190727_1754'),
]
operations = [
migrations.AlterField(
model_name='manufacture',
name='s... |
12,194 | f048c1e95ad54be8736c6156e6ded4395d5b1613 | import pandas as pd
from pymongo import MongoClient
client = MongoClient('mongodb://dobfriend:1234****asdf@cluster0-shard-00-00.rpfv6.mongodb.net:27017,cluster0-shard-00-01.rpfv6.mongodb.net:27017,cluster0-shard-00-02.rpfv6.mongodb.net:27017/dobfriend?ssl=true&replicaSet=atlas-p2skss-shard-0&authSource=admin&retryWrite... |
12,195 | 147bf7fcecce8a59ef43a84f93c5028b51e4a98e | # -*- coding: utf-8 -*-
import clr
clr.AddReference("System.Windows.Forms")
clr.AddReference("System.Drawing")
clr.AddReference("System.ComponentModel")
from System.Windows.Forms import Form, Application, Button, MessageBox, FormStartPosition, DockStyle, Label, Padding, \
TextBox, FormBorderStyle, GroupBox, CheckBo... |
12,196 | 70e0faa65c1e96b9291b7f8cb4030cfb24c9b9e3 | #!/usr/bin/env python3
import datetime
x = datetime.datetime.now()
print(x)
|
12,197 | 8ee2bff1994b947eec9bd35cc2eca8e086e5be2c | import torchvision.models as models
import torch
import torch.nn as nn
from lib.model.roi_align.modules.roi_align import RoIAlignAvg
class UBR_VGG(nn.Module):
def __init__(self):
super(UBR_VGG, self).__init__()
self.model_path = 'data/pretrained_model/vgg16_caffe.pth'
def _init_modules(self):... |
12,198 | 93d1cd79e359e049fa217148a4981eb837355e95 | # -*- coding: utf-8 -*-
# from xlrd import *
# from xlwt import *
import xlrd
from xlutils.copy import copy
import os.path
# # w = Workbook()
# # ws = w.add_sheet('xlwt was here')
# book = xlrd.open_workbook('mini.xls')
# # book = xlrd.open_workbook("mini.xls")
# sh = book.sheet_by_index(0)
# sh.write(0,0,'A1')
#
# boo... |
12,199 | 40b050dd967e9e04abc390bd0fafea9e1fb7d0fb | #To take or not to take
possible_solution=1
balloons=[]
d=""
current_answer=1
for x in range(int(input("Enter an integer: "))):
current_answer=1
for y in range(int(input("Enter number of balloons: "))):
balloons.append(input("Enter balloon "+ str(y+1) + ": "))
balloons_length=len("{0:b}".format((le... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.