index int64 0 1,000k | blob_id stringlengths 40 40 | code stringlengths 7 10.4M |
|---|---|---|
999,700 | 11e0a24fd4dc2ca5d356c366abe37b78364108eb | import boto3
from botocore.exceptions import NoCredentialsError
from settings.constants import *
print('loool', ACCESS_KEY, len(ACCESS_KEY), ACCESS_KEY.lower(), SECRET_KEY)
def upload_to_aws(local_file, bucket, s3_file):
s3 = boto3.client('s3', aws_access_key_id=ACCESS_KEY,
aws_secret_access... |
999,701 | e0a8efaa6fe2e6ec14a214478528eb53e64f17bd | #-*- coding:utf-8 -*-
#test 1
d = {'Yoeng':90,'justin':80,'oliver':70}
print (d['Yoeng'])
#test 2
d['oliver'] = 100
print (d['oliver'])
#test 3
a = 'Tom' in d
print (a)
#test 4
b = d.get('tom')
c = d.get('tom',-1)
print(b,c)
#test 5
d.pop('justin')
print (d)
#test 6
#key = [1,2,3]
#d[key] = 'a list'
#test 7
s = ... |
999,702 | 346be60bfc8611d24bfe9a6cce6bd8dc519226cb | # -*- coding: utf-8 -*-
#Realizar un función que reciba como parámetro una cantidad de segundos, y devuelva una tupla con la cantidad de segundos expresada en hh,mm,ss.
def conversor_horario(segundos):
horas=segundos//3600
minutos=(segundos%3600)//60
segundos=(segundos%3600)%60
return (horas, minutos, segundos)
... |
999,703 | bcd5c1ec349571ea3f925cff0974a8a5782e6e5d | #TODO Refactor so each command is a seperate function in a list. That way, the script parser can just do commands["COMMAND"]((args,))
import threading, webbrowser
from time import sleep
from functools import partial
import lp_events, lp_colors, keyboard, sound, mouse
COLOR_PRIMED = lp_colors.RED
COLOR_FUNC_KEYS_PRIME... |
999,704 | 5f495c98b83a3e07ac8bd00c8ec933df5012c353 | import random
# O(N^2) list creation
def make_points(points, n):
for i in range(0, n):
x = random.uniform(0, 1000)
y = random.uniform(0, 1000)
if (x, y) not in points:
points.append((x, y))
|
999,705 | f4dc9f8aecfd9a5f14e872b30489bdcff8811db5 | #coding:utf-8
"""
@file: BiomedSpider
@author: lyn
@contact: tonylu716@gmail.com
@python: 3.3
@editor: PyCharm
@create: 2016-10-13 21:36
@description:
sample_url: http://www.biomedcentral.com/bmcfampract/
"""
import sys,os
up_level_N = 1
SCRIPT_DIR = os.path.dirname(os.path.realpath(os.p... |
999,706 | 1b50969f364f19e8ec7f4e3ae545180b14affc5a | from turtle import *
meet_turtel=Turtle()
def squre():
meet_turtel.forward(100)
meet_turtel.right(90)
meet_turtel.forward(100)
meet_turtel.right(90)
meet_turtel.forward(100)
meet_turtel.right(90)
meet_turtel.forward(100)
elephant_weight=3000
ant_weight=0.3
if elephant_weight < ant_weight... |
999,707 | 52698dd2391a25979cd125775a5e077b8d9a4333 | """
The flask application package.
"""
from flask import Flask
import MySQLdb
app = Flask(__name__)
db = MySQLdb.connect(host="localhost", port=3306, user="root", passwd="230593Mayo", db="bthedge")
import BtHedge.user
import BtHedge.btccontroller
|
999,708 | 96d1c45256496a105eecee83b1a7edf314e5eb4c | from PIL import Image, ImageOps, ImageChops, ImageDraw, ImageFont
import os
# folders = ["output_CHONK1", "output_comprimidos1", "output_comprimidos2"]
folders = ["clean"]
PATH_OUTPUT = os.getcwd() + "/output/"
SIZE = (56, 56)
monster_data = open("monster_data.txt", "r", encoding="utf-8").read().split("\n")
FONT =... |
999,709 | 69a08ce998e9f8cb05d35cf45b522e11df01b6af | # Copyright 2019 British Broadcasting Corporation
#
# 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 a... |
999,710 | fecf1bea91b6698a013af5cdf837a17898286b16 | import torch
import cv2
import os
from torch.utils.data import Dataset
import numpy as np
import random
import csv
from crop_keypoint import keypoint
from crop import cropFrames
from kmeans import keyframes
class VideoDataset(Dataset):
def __init__(self, videodir, jsondir, channels,frame_num, mode, tra... |
999,711 | 81a2c28eb54fe06f045e5f217d3e15d03a51850b | from __future__ import print_function
from copy import copy
from functools import partial
import numpy as np
from joblib import Parallel, delayed
from numpy import exp, argsort, ceil, zeros, mod
from numpy.random import randint, rand, randn, geometric
from .RbfInter import predictRBFinter
from .utils import boundary... |
999,712 | 73fb5de2e9c260b1cf864978529a8d2a198902cb | # -*- coding:utf-8 -*-
import operator
from api.api import API
from pages.ios.common.superPage import SuperPage
from pages.ios.ffan.dianyinggoupiao_page_configs import dianyinggoupiaoconfigs as DYGPC
from pages.logger import logger
class dianyinggoupiaopage(SuperPage):
'''
作者 刘潇
电影购票
'''
def ... |
999,713 | 42560c2d946975b354c128057d199a428d9c61df | import torch
import torch.nn.functional as F
from torch import nn
class UNetConvBlock(nn.Module):
def __init__(self, in_size, out_size, padding, batch_norm):
super(UNetConvBlock, self).__init__()
block = []
block.append(layer_conv(in_size, out_size, kernel_size=3,
... |
999,714 | e1e4d75f1743a72e302948aa957805d4567c81fd | # Generated by Django 2.2.1 on 2019-05-10 11:25
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('AML', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='facebookinfo',
name='page_id',
... |
999,715 | 489920d99ec8282cf54fc05d04b015a2860222e3 | import math
# Apresentação
print('Programa para calcular a área de um triângulo')
print()
# Entradas
lado_a = float(input('Informe a medida do lado A: '))
lado_b = float(input('Informe a medida do lado B: '))
angulo = float(input('Informe o ângulo formado entre o lado A e o lado B: '))
# Processamento
ar... |
999,716 | 95534c67b4863c2255949706db495f5b76959a3b | {% extends "base.html" %}
{% block content %}
You have been Logged out!
{% endblock %} |
999,717 | be7f348eee2190c08b266ff93142de2669a932c9 | import csv
import math
import mysql.connector
from mysql.connector import Error
connection = mysql.connector.connect(
host="localhost",
user="debian-sys-maint",
passwd="HwearQMC4nkPeYmP",
database="fundeb"
)
def inserirValorAluno(id_estado, id_segmento, valor, ano, tipo, educacao):
try:
cursor = connection... |
999,718 | cde369efa65cb82e6a8d1d938005937424c6005f | from splinter import Browser
from bs4 import BeautifulSoup as bs
import pandas as pd
import time
def init_browser():
# @NOTE: Replace the path with your actual path to the chromedriver
#path for MAC
executable_path = {"executable_path": "/usr/local/bin/chromedriver"}
# path for windows - need to co... |
999,719 | 025e4f402aa60054dd5f0d5be93175b7080986e2 | import os
import pytest
import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
@pytest.mark.parametrize('exe', [
'/usr/bin/pg_dump',
'/usr/bin/pg_restore',
'/usr/bin/psql'
])
def test_postgresql_am... |
999,720 | 85e77729387d381328e66456bc5425d4d6e73c06 | import json, fnmatch, re, cantools
def matcher(x):
return re.compile(fnmatch.translate(x))
with open("config.json") as fd:
config = json.load(fd)
messageWhitelist = []
for key in config["messages"]:
messageWhitelist.append(re.compile(fnmatch.translate(key)))
def signalFilter(name):
for regex in messageWhitelist... |
999,721 | 90b285b53506d03f728370b935521888a7c8446e | from python_test_case import PythonTestCase, run_tests
from unittest.mock import patch, call
import sys
from io import StringIO
from pylab import *
class Tests(PythonTestCase):
def setUp(self):
try:
del sys.modules["attempt"]
except KeyError:
pass
def test_allowed(s... |
999,722 | a98651ca1ecaab7faaafcb32406044976a023e69 | from fabric2 import task
from cloudify import ctx
@task
def remove_node(connection, *argc, **kargs):
hostname = ctx.source.instance.id
hostname = hostname.replace('_', '-')
hostname = hostname.lower()
ctx.logger.info('Remove node instance: {hostname}'
.format(hostname=hostname))
... |
999,723 | 55c9c2021e6ffff34394603066c1fa512a893f50 | import numpy as np
import pickle
import h5py
import os
from keras.optimizers import SGD, Adagrad
from keras.models import load_model, Sequential
from keras.layers import Dense, Activation, Dropout
from keras.callbacks import TensorBoard
os.environ['TF_CPP_MIN_LOG_LEVEL']='2'
batch_size = 200
epochs = 10
unit = 500
dr... |
999,724 | cd9fdfdfe9636287bc2110466657d357d532d6f9 | import time
import numpy as np
import torch
from torch import nn
from torch import optim
from config import device, label_names, print_every, hidden_size, encoder_n_layers, dropout, learning_rate, \
epochs
from data_gen import SaDataset
from models import EncoderRNN
from utils import AverageMeter, ExpoAverageMete... |
999,725 | f62a9346406f8815b492ef7496832bfed43c5d1f | print("hello python,你好python!!!!")
print("你好")
print("hello") |
999,726 | a16f4f5b53fcbd99461d85a1693ad95c44de584a | class Solution:
def fractionToDecimal(self, numerator: int, denominator: int) -> str:
|
999,727 | fc4d95332123e91940feb1b1c136a9488e44fe78 | # -*- coding: utf-8 -*-
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
import datetime
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Product'
db.create_table(u'Products_product', (
(u'id', self.gf('django.db.mode... |
999,728 | a592879bcaf051cf1b5f4c7ad153c16560dd2752 | import Caffe_AlexNet as C
import Make_activation as m
import h5_analysis_jitterer as h
import os
import shutil
import numpy as np
import set_up_caffe_net
from Test_AlexNet_on_directory import what_am_I_from_image
# -------------------------------------------------------------------------------------------------------... |
999,729 | 754f19fba1eab121458c2232678efb83c91db277 | from __future__ import unicode_literals
from django.contrib import messages
from django.db import models
import bcrypt
from bcrypt import checkpw
import re
EMAIL_REGEX = re.compile (r'^[a-zA-Z0-9.+_-]+@[a-zA-Z0-9._-]+\.[a-zA-Z]+$')
class UserManager(models.Manager):
def isValidRegistration(self, userInfo, request):
... |
999,730 | 4250021db200b46a93ca47bd17ef4b2f172406e0 |
# coding: utf-8
# In[14]:
import numpy as np
import pandas as pd
from sklearn.cross_validation import train_test_split
from sklearn.tree import DecisionTreeClassifier
from sklearn.metrics import accuracy_score
from sklearn import tree
from sklearn.preprocessing import LabelEncoder
train = pd.read_csv("train.csv")
t... |
999,731 | a5cdf66ee78a4217cd71343ca1509497b54e8723 | from django.shortcuts import render,redirect
from .models import Todo
from .forms import TodoForm
from django.contrib import messages
# Create your views here.
def index(request):
if request.method == 'POST':
form = TodoForm(request.POST or None)
if form.is_valid():
form.save()
return redirect('index')
el... |
999,732 | a5980694e911f0ebf2f7e81e512078a2902d94ee | # William
# Generate line graphs for comparison of the average cost of moves comparing player experience and days since release.
from helper_fns import *
import numpy as np
import matplotlib.pyplot as plt
import math, pymongo
from bson import objectid
# Some tunable constants
minimum_played = 3
bucket_count = 15
s1... |
999,733 | 2041a1d97ae57e11c6fe5bb035a2712cf9525c0b | import sys
import os
import shutil
import PyQt5
from PyQt5.QtGui import *
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
from PyQt5 import uic
from physicoModule import config, PhysicoManage
from physico_main import PhysicoMain
current_dir = os.getcwd()
physicoUI = os.path.join(current_dir, 'uiFiles', 'phy... |
999,734 | 4b810e7ca570c5d0a136f2740e214bc17126aed7 | import numpy as np
import pandas as pd
import time
# Base de dados iris
dados = pd.read_csv('iris.data', sep=",", header=None)
dados =dados.iloc[:,:].values
for vez in range(0,4):
print("\n"+str(vez+1)+" ªvez")
np.random.shuffle(dados)
################################### ENTRADA #############... |
999,735 | f455ca9c163680f2f91c8eb3bcb069fd2557ff5a | '''
You are given two strings word1 and word2. Merge the strings by adding letters in alternating order, starting with word1. If a string is longer than the other, append the additional letters onto the end of the merged string.
Return the merged string.
Example 1:
Input: word1 = "abc", word2 = "pqr"
Output: "apb... |
999,736 | e87f00efe72e6953c83731ff1ca7966086fcf135 | import warnings
from django.conf import settings
from django.contrib.auth.models import AbstractUser
from django.contrib.auth.models import SiteProfileNotAvailable
from django.contrib.auth.models import UserManager as BaseUserManager
from django.core.exceptions import ImproperlyConfigured
from django.core.mail import ... |
999,737 | 4f33a9ffeea939424a283694b3656ad4af8b5958 | from django.db import models
from django.urls import reverse
from django.conf import settings
from django.contrib.auth.models import User
# Create your models here.
class Type(models.Model):
user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE, default=1)
role = models.CharField(max_len... |
999,738 | db937a15a6133b3f0aa17695d7d64ba6c7314f1e | no=int(input("enter no:"))
for x in range(2,no):
if no%x==0:
print(no,"is not prime number")
break
else:
print(no,"is prime number") |
999,739 | 9d69db29bb3a0085514e680182d08ea4de3577bd | from django.conf.urls import include, url
from . import views
from django.urls import path
urlpatterns = [
path('home', views.home, name='home'),
# path('student', views.studenthome),
# path('faculty', views.facultyhome),
# path('admin', views.adminhome),
path('loginValidate', views.loginvalidate, name='loginVal... |
999,740 | 1b42d4424827fde9b3ceabfe30ba959459f8a8fd | import argparse
import random
import jsonlines
import os
def main(args):
for arg in vars(args):
print(arg, getattr(args, arg))
random.seed(args.random_seed)
os.makedirs(args.output_dir, exist_ok=True)
lines_len = 0
with jsonlines.open(args.train_file) as f:
src_docs = []
... |
999,741 | 3abfff18f1abfeef775133dddaaba0784ad1d496 | from django.db import models
class Codec(models.Model):
name = models.CharField(max_length=256, null=False, blank=False)
def __str__(self):
return u'Codec :: ' + \
self.name
class Meta:
verbose_name = 'Codec'
verbose_name_plural = 'Codecs'
class Specification(models... |
999,742 | db22da6b09272dd1c3bfe5fcb79a7566c2a1e72c | import numpy as np
import matplotlib.pyplot as plt
import random, time, math
# Part c
def flip_coins(flips,p):
myFlips = np.random.choice(2,flips,p=[(1-p),p])
return sum(myFlips)
fig1 = plt.figure(1)
for flips, i in zip([10,100,1000,4000], range(1,5)):
fig1.add_subplot(2,2,i)
heads = flip_coins(flips,.... |
999,743 | 883abf800a1d62a38fcec9d6dee3208d06392761 | # coding: utf-8
"""
Automated Tool for Optimized Modelling (ATOM)
Author: Mavs
Description: Unit tests for models.py
"""
# Standard packages
import pytest
import numpy as np
from sklearn.ensemble import RandomForestRegressor
# Keras
from tensorflow.keras.datasets import mnist
from tensorflow.keras.models import Seq... |
999,744 | 55371041e1e1724a2077e926a123ebb3706bf4cc | class Solution(object):
def dfs(self, source, target, startindex, result, resultcollection):
# inplement by in-place to save the space complexity to O(1)
if target < 0:
return
elif target == 0:
# assume the target equal to zero reprecenting find all numbers of the sum... |
999,745 | d23275ad8936fb32c3950c804cfd0b6e998d1290 | import re
import subprocess, shlex
def execute_cmd(cmd_str):
call_params = shlex.split(cmd_str)
subprocess.call(call_params, stderr=subprocess.STDOUT)
def gen_cookie_map(cstr):
cmap = {}
for pair in cstr.split(';'):
(key, value) = pair.split('=', 1)
cmap[key.strip()] = value.strip()
return cmap
# w... |
999,746 | 24a585d3dd4b8d36e8ef8928a01ad2a124332857 | __code__='Gau^c$ZmB?GpZXsY(!+m!:_=#Z3V\'gRfXajU*PU#Bi07KZmc8-.8_]jL)[W+YT&R>TW1783n97#."9--k`"PH]UfP!a^cbT8S0<=aZ<a(f%FT>H(Sn2PO\\?YZ[$C_1n4$t0q6F$B;5@>s&N,Y5fiZ[S2i),eQ\'*H]lbFsrSR@aJ#IJfQ_D0,kg-l@.uI/>7ArPRW[jO?Xm!3ri`WH\'[dfk3%$>d?&IBhiWS=:(91aGrXJT%HG\'YHEB3)<]QL^s?S5ASo-Z/%WCp2[<^BM6b^O:8Is7Y4GoUE#O=W+FKpcFo/i6%-E... |
999,747 | b489578b017710ed899ebfad438fb3b607cf8d4b | t=list(map(int,input().split()))
su=reversed(t)
print(*su)
|
999,748 | a6052813f10d61489142ab73338efc140f7c15a1 | from scrapy.spiders import CrawlSpider, Rule
from scrapy.selector import Selector
from scrapy.conf import settings
from scrapy import http
from scrapy.shell import inspect_response # for debugging
import re
import json
import time
import logging
try:
from urllib import quote # Python 2.X
except ImportError:
f... |
999,749 | 4ce601108255ef9ac896ed5e294ade9f768b5b48 | # Generated by Django 2.1.1 on 2018-12-07 16:07
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='TimelineItem',
fields=[
... |
999,750 | d19eb7bc381a8fa5db90b3a4914f892f72b5043e | import click
allpass = []
def other_info_callback(ctx, param, value):
pass
#function lower-cases the provided string
#strips the string off all special characters and spaces
def clean_input(a):
clean = a.lower()
return ''.join(i for i in clean if i.isalnum())
#function uses slicing to return a reverse of... |
999,751 | 21ecaadd6d2a98c09b942af77bcde75b57683530 | #! /usr/bin/env python
import rospy
from sensor_msgs.msg import LaserScan
from geometry_msgs.msg import Twist
from std_msgs.msg import String
import time
from sensor_msgs.msg import Image
from cv_bridge import CvBridge, CvBridgeError
import numpy as np
import cv2
left=20
front=20
command="start"
def go_left(value):... |
999,752 | 265235c666c79685a7c52c8183ceb63c486baf1c | import pandas as pd
import numpy as np
def report_diff(x):
if x[0] == x[1]:
return x[0]
else:
return '{} ---> {}'.format(*x)
def has_change(row):
# if '\033[1m + {} ---> {}' in row.to_string():
if '--->' in row.to_string():
return "Y"
else:
return "N"
staxi1 = pd.read_csv("STAXIExports/STAXI_Test_Data.... |
999,753 | eca18b44f23cda0997a3526562fd0a0238b09b2e |
class Service:
def get_key_from_dict(self, key, data_dict, value_else):
return data_dict[key] if data_dict[key] else value_else
|
999,754 | 19ae5cbd9d16665fa5714ec7844a7d6439023d9d | from django.db import models
from django.contrib.auth.models import AbstractUser
# Create your models here.
class Article(models.Model):
title=models.CharField("标题",max_length=50)
zhuozhe=models.CharField("作者",max_length=50)
created_date=models.DateField("创建日期",auto_now_add=True)
modify_date=models.DateField("修改... |
999,755 | 6ec317ccf8e54704ffd9d75f2b891f49741dadaf | import math
r = float(input("Please enter a radius r: "))
area = math.pi * (r * r)
vol = (4/3) * math.pi * (r * r * r)
print("The area of a circle with radius r is {} units squared.".format(area))
print("The volume of a sphere with radius r is {} units cubed.".format(vol)) |
999,756 | 96ba837ab0e682eb5978941f569a7cce19396502 | from django.core.management.base import BaseCommand, CommandError
from stock.models import StockManager
class Command(BaseCommand):
help = 'Updates database (use when stocks have been bought or sold)'
# def add_arguments(self, parser):
# parser.add_argument('poll_ids', nargs='+', type=int)
def ha... |
999,757 | 99e8cf91334b5650d7f55894d610d1672b77e310 | # Generated by Django 3.0.3 on 2020-04-10 05:59
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import insane_app.models
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_US... |
999,758 | 77418339080e1cd482adbe67c40ec0209369082f | # -*- coding: UTF-8 -*-
# Code generated by lark suite oapi sdk gen
from typing import *
from ....api import Request, Response, set_timeout, set_tenant_key, set_user_access_token, set_path_params, \
set_query_params, set_response_stream, set_is_response_stream, FormData, FormDataFile
from ....config import Config... |
999,759 | d19b44bf32cc3121c99f9b2fb4a2f44b98e3c56e | # Выведите все элементы списка с четными индексами
# (то есть A[0], A[2], A[4], ...).
inputList = list(map(int, input().split(" ")))
List = list()
for i in range(0, len(inputList)):
if i % 2 == 0:
List.append(inputList[i])
for i in range(0, len(List)):
print(List[i], end=' ')
|
999,760 | 755c893a4acc31987de9ddf3f207d6038e7b3f18 | #!/usr/bin/env python
import random
import sys
import optparse
from trie import Trie
from watchdog import Watchdog
DICTIONARY_FILE="/usr/share/dict/american-english-small"
VOWELS="aeiouAEIOU"
def find_match(word):
try:
with Watchdog(5):
matches = [pos_word for pos_word in var_iterative(word)
... |
999,761 | f06b855391a56d1bab0e1d76f89d2f97caf0ebf5 | # _*_ coding: utf-8 _*_
#!c:/Python36
#Filename: ReportPage.py
from test_case.page_obj.LoginPage import LoginPage
from test_case.page_obj.SearchPage import SearchPage
# from test_case.page_obj.ReportPage import ReportPage
from test_case.page_obj.MenuBar import MenuBar
from selenium import webdriver
from selenium.webdr... |
999,762 | 3fa38c34800bdd3c28c078140bad33fee861306b | #! /bin/usr/env python3
#
# Author: Dal Whelpley
# Project: The following statement calls a function named half, which returns
# a value that is halfthat of the argument. (Assume the number
# variable references a float value.)Writecode for the function.
# result = hal... |
999,763 | 4def274583f736600c131f95c5ec0ac67a463aca | import discord
from discord.ext import commands
import time
from synthesize import synthesize
import multiprocessing
if __name__ == '__main__':
TOKEN = # Stream Key Goes Here
client = commands.Bot(command_prefix='!')
@client.event
async def on_ready():
print('Bot online.')
@client.com... |
999,764 | 701adc24e8181461e65515164f82c8c396fddb37 | lista = list()
while True:
continuar = str(input("Quer continuar? S ou N ")).upper()
if continuar == "S":
lista.append(int(input("Digite um número: ")))
else:
if continuar == "N":
break
print(f"Foram digitados: {len(lista)} números")
lista.sort(reverse = True)
print(lista)
if 5 ... |
999,765 | f91498d98e5da2d41760f6e8739d1c38da3ef719 | SIMPLE_SETTINGS = {
'OVERRIDE_BY_ENV': True
}
MY_VAR = u'Some Value'
|
999,766 | dbfcf7bc6639c1ce8497d65cd601bd2aa908b8c5 | import base128variant
import zigzag
from core import WireType, ValueType
class String(ValueType):
@classmethod
def get_wire_type(cls):
return WireType.LENGHT_DELIMITED
@classmethod
def new_default_value(cls):
return ""
@classmethod
def dumps_value(cls, value):
return '"{0}"'.format(value)
@classmethod... |
999,767 | b1c8a2cebb4b03ebadb2c60b3c1438d8bf36fb02 | import os
from datetime import date
import configparser
import requests
from bs4 import BeautifulSoup as bs
from slackclient import SlackClient
#slack_channel = "CEKB88A1Y"
slack_channel = "GDQ7JPD8U"
BASE_URL = "https://dilbert.com/strip/"
NEWEST_COMIC = date.today()
def get_today():
"""
Returns today's dat... |
999,768 | 9796ff581988fb6c8fb54231ea413b4cea23d05d | '''
produce letter-3-gram representations
'''
with open('../../dataset/chunk/train.txt') as tr:
train_sets = tr.read().split('\n')
with open('../../dataset/chunk/test.txt') as te:
test_sets = te.read().split('\n')
l3g = {}
for data in [train_sets, test_sets]:
for word_pos_chunk in data:
if word_... |
999,769 | fbb30c3109d3a7e58e70227b5270a7fe5bd366f6 | import torch
from torch import nn
import torchvision.datasets as dset
import numpy as np
import logging
import argparse
import time
import os
from model import EDNetV2 as EDNet
from trainer import Trainer
from data import get_ds
from utils import _logger, _set_file
from my_utils import ModelTools
from torch.utils.dat... |
999,770 | 6ff4df29b8aafe240bd60f0c3ff861bda81ca0be | # https://leetcode.com/problems/water-bottles/submissions/
class Solution:
def numWaterBottles(self, numBottles: int, numExchange: int) -> int:
total = numBottles
while numBottles >= numExchange:
(drunk, empty) = divmod(numBottles, numExchange)
total += drunk
num... |
999,771 | f13427904a4672cfd442e92b0a1b1c56919fa8e0 | __author__ = 'zhaoyimeng'
X = 88
def func():
global X
X = 88
|
999,772 | 8d2d7eb052591d94bac8556179aa4deb5d065690 | #------------------------------------------------------------------------------
# filename : duplicate.py
# author : Ki-Hwan Kim (kh.kim@kiaps.org)
# affilation: KIAPS (Korea Institute of Atmospheric Prediction Systems)
# update : 2014.3.25 start
# 2016.8.25 fix the relative import path
#
#
... |
999,773 | 8934dc32c6cde06f0569d0590f761cb01ffb553f | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import copy
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
fr... |
999,774 | 95c2c5a425703a061b55841ac12d0d0ac164d320 | from collections import namedtuple
# set up named tuples
NodeInfo = namedtuple('NodeInfo', ['id', 'name'])
Account = namedtuple('Account', ['id', 'name'])
AccountInfo = namedtuple('AccountInfo',
['id', 'name', 'total', 'currency'])
|
999,775 | 6e74d4019d23ad0f3835b77c9cc2d3c5ff0d6b69 | # ___________________________________________________________________________
#
# Pyomo: Python Optimization Modeling Objects
# Copyright 2017 National Technology and Engineering Solutions of Sandia, LLC
# Under the terms of Contract DE-NA0003525 with National Technology and
# Engineering Solutions of Sandia, LLC... |
999,776 | c0c3440c25d4f347b6cd76cf7cb81917914dac7f | import numpy as np
import math
import matplotlib.pyplot as plt
class ScratchLogisticRegression():
"""
ロジスティック回帰のスクラッチ実装
Parameters
----------
num_iter : int
イテレーション回数
lr : float
学習率
lmd : float
正則化パラメータ
no_bias : bool
バイアス項を入れな... |
999,777 | 59c97317ac1f630bcb670f87b14e2936a84d6276 | # -*- coding: utf-8 -*-
def buscar_un_paciente(id, diccionario):
try:
valor_de_prueba_de_errores = diccionario[id]['Nombre']
print("***** INFORMACIÓN DEL PACIENTE *****")
print("Nombre: " + str(diccionario[id]['Nombre']))
print("Id: " + str(diccionar... |
999,778 | d1a2553ede173d5eed654bd270aa5c43f42e8044 | #!/usr/bin/env python3 -u
# load packages
import numpy as np
from joblib import Parallel
from joblib import delayed
import pandas as pd
import os
from warnings import filterwarnings
from sklearn.exceptions import ConvergenceWarning
from sklearn.base import clone
from copy import deepcopy
# import models
from models i... |
999,779 | 359c1341ec2a9276f3cc508b3bee819d35ac744e | # Hex is a base 16 number system - used as a simpler representation of binary - e.g. 8 bits binary can be represented by 2 hex digits.
# Hex is useful for cipher texts which often have unprintable bytes - so we convert it to hex so that it is easily shared
# Hex itself is an ascii shareable string. base64 is another co... |
999,780 | 1e484d6048c8b15cc2601be4845191176b29be04 | def computepay(h,r):
if h >40:
x = ((1.5*r*(h-40)) + (40*r))
return x
else:
x = r * h
return x
hrs = "45"
rate = "10.50"
h = float(hrs)
r = float(rate)
p = computepay(45,10.5)
print ("Pay",p)
|
999,781 | 3261671176bd688b061d537358fdbc5ed4b3b6cc | # Copyright 2016 Mirantis, 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 or ... |
999,782 | 45ee5b3aaff16b1bbf36c2aa069411cdba7e4601 | import normal
normal.kd() |
999,783 | 7fc1072d8d88a0e42b3c29420610c837a75878cb | import numpy as np
# def convolve2d(X,W):
# n1, n2 = X.shape
# m1, m2 = W.shape
# con2d = np.zeros((n1+m1-1,n2+m2-1))
# print(con2d.shape)
# for i1 in range(n1):
# for i2 in range(m1):
# for j1 in range(n2):
# for j2 in range(m2):
# if i1>=i2 and j1>=j2 and i1-i2<n1 and j1-j2<n2:
# ... |
999,784 | e3d1a0c51f21c18656d3acd75db5bc897003720b | # -*- coding: utf-8 -*-
import numpy as np
import cv2
img1 = cv2.imread('C:/Users/JPang3/Desktop/beijing/opencv/opencv_projects/python-opencv/img3.jpg')
# ----------------------#
cv2.imshow('tmp',img1) #
cv2.waitKey(0) #
# ----------------------#
e1 = cv2.getTickCount()
for i in xrange(5,49,2):
# 中值模糊
... |
999,785 | 6931af2ee2f44ccc4497b733ee2956236ea06d78 | # Generated by Django 3.2 on 2021-05-01 07:41
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('controlApp', '0004_delete_team'),
]
operations = [
migrations.DeleteModel(
name='Room',
),
]
|
999,786 | 681eefcacdbb8d3e7aff0fae9389e4b2e1515190 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed May 26 17:58:41 2021
@author: michail
"""
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
from forest import random_forest
import json
dt = pd.read_csv('sdss_redshift.csv')
x... |
999,787 | 37ac75e8f62f1d6d67fa359eaeb28193299f159a | #!/usr/bin/env python3
##
# Copyright (c) Nokia 2018. All rights reserved.
#
# Author:
# Email: nokia-sbell.com
#
from path_helper import join
from vfs import VFs
def run(fs: VFs, target, cmd, cwd, env):
parents = False
dir_list = list()
for arg in cmd[1:]:
if arg[:2] == '--':
flag ... |
999,788 | f9c8df48bb51aaffffc3cec9f8437be881a48318 | import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.mime.base import MIMEBase
from email import encoders
import json
import os
import sys
class Email():
port = None
smtp = None
from_email = None
pass_email = None
path = None
def __init_... |
999,789 | a4eb4f0ae23b89d92557278611e0962d547fd083 | import matplotlib.pyplot as plt
from util.OCR_Pre import OCR_Pre
import Data
ocr = OCR_Pre()
ocr.isFigure = True
ocr.isShowLocalMin = True
ocr.Read(Data.path0)
ocr.GetCutIndexs()
ocr.GetRotations()
ocr.SaveRotations(Data.folderTest+'cut')
#ocr.CutPaddings()
#ocr.GetLetterSizes()
#ocr.GetCandidateRows(Data.folderTes... |
999,790 | 7072a7de772f5b0a0f2f025d3245888252fe8c20 |
def buildInhritedGraph(classesList, classesQueryDic):
rootList = []
for c in classesList:
for inherited in c.inheritedList:
if not inherited in classesQueryDic:
print "inherited classes not found"
else:
c.addParentClass(classesQueryDic[inherited])
classesQueryDic[inherited].addChildClass(c)
for... |
999,791 | 78c7a8eae601db49f4649382c8e7b4a318f39d88 | from django.urls import path
from .views import (
UserCreateAPIView,
SalfaInfoView,
SalfaUpdateView,
SalfaDeleteView,
SalfaCreateView,
AddToCartView,
CartCheckoutAPIView,
SalfaDeleteFromCartView,
ProfileAPIView
)
from rest_framework_simplejwt.views import TokenObtainPairView
urlpatterns = [
path('login... |
999,792 | becbe3adaf3df734ae3c68344d8f3bb7d9d1b3b2 | #!/usr/bin/python3
## Stephen Bavington 8/16/18 Hellastorm Inc.
## This program creates a 10ary of files ranging in size from 4094 bytes to 1 meg and stors them in a
# 10Ary .
import os
import math
root = './files/'
files = 100
dir_depth = int(math.log((files + 1), 10))
os.system('rm -r ./files/')
print('Dir Depth = ... |
999,793 | 08c9031237abdbf82e7d5317f5409d22c2f5c6fa | i_list = []
for tc in range(1,int(input())+1):
i_list.append(int(input()))
max_inp = max(i_list)//10
dp = [0]*(max_inp+1)
dp[1],dp[2] = 1, 3
for i in range(3,max_inp+1):
dp[i] = dp[i-1]+2*dp[i-2]
for idx, v in enumerate(i_list):
print(f'#{idx+1} {dp[v//10]}') |
999,794 | 932bbadedee3097c2d6e9a43bf2707bedf50cb46 | import string
alpha = string.ascii_lowercase
n = int(input())
L = []
if n!=8:
for i in range(n):
s = "-".join(alpha[i:n])
L.append((s[::-1]+s[1:]).center(4*n-3, "-"))
print('\n'.join(L[:0:-1]+L))
else:
print("""--------------h--------------
------------h-g-h------------
----------h-g-f-g-h----------
----... |
999,795 | ac4fccda4a181198633affcd970a806970c7fb7f | # -*- coding: utf-8 -*-
#import numpy
from datapackage import Package
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib.ticker import MaxNLocator
class Constants:
TOKENS = {
'usda': '', #us dept. of agriculture, economic research service
'eia': '', #us energy info administra... |
999,796 | 8b62489ce2e98d63b021900895619f53324ecd9c | #!/usr/bin/python
# -*- coding: utf-8 -*-
###############################################################################
'''
Bugs/TODOs:
- Make maps more intelligently generated (and spawn point)
- Multiple rooms
- Ring of Fire does not work
- Monster HP
- Attack power/skills
- Items
'''
################... |
999,797 | 72544dd7879644f2008fe3a9a531e87fc0e557e3 | from services.volt.models import AccessDevice, VOLTDevice
from xosresource import XOSResource
class XOSAccessDevice(XOSResource):
provides = "tosca.nodes.AccessDevice"
xos_model = AccessDevice
copyin_props = ["uplink", "vlan"]
name_field = None
def get_xos_args(self, throw_exception=True):
... |
999,798 | 5f722f12f62d6677653259763b9ff1235ea23d0d | #!/usr/bin/env python3
import io
import service_urls
from setuptools import find_packages, setup
with io.open('README.md', "rt", encoding='utf-8') as fp:
long_description = fp.read()
setup(
name='django-service-urls',
version=service_urls.__version__,
description='setting helper for django to repres... |
999,799 | 53a065da729ecd9833d98a062d33cfbb8caad5eb | from __future__ import division
from dateutil.parser import parse
from nltk.tokenize import WordPunctTokenizer
from nltk.stem import PorterStemmer
from nltk.corpus import stopwords
import pandas as pd
import numpy as np
import time
import datetime
## SETTING PARAMETERS
use_stop_words = False
min_word_len = 3
snapshot_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.