index int64 0 1,000k | blob_id stringlengths 40 40 | code stringlengths 7 10.4M |
|---|---|---|
997,200 | 1c1979f073a67eed276775b6a7905601bf7802c7 | #11-12 doesn't have many files
#importing is still very messy
#try and get graduation rates for each school
import pandas as pd
import numpy as np
files = {}
def year_creator(data):
for i in range(98,101):
data.update({str(i-1):''})
data.update({'00':''})
for i in range(1,11):
data.updat... |
997,201 | 99a2a90ce95f40187f28596398127929647416ea | import pandas as pd
from pandas import DataFrame
import datetime
import pandas.io.data
import matplotlib.pyplot as plt
"""
sp500 = pd.io.data.get_data_yahoo('%5EGSPC',
start = datetime.datetime(2000, 10, 1),
end = datetime.datetime(2014, 6, 11))
sp... |
997,202 | 2218207110dd460ff22a7df0329c62981f3a6243 | for i in range(1,10):
if i % 2 ==0: continue # "if" expression ":" suite
for j in range(1,i+1):print(j, '*', i, '=', i * j, sep='', end='\t') #这个for循环相当于第一个if语句隐藏的 "else" ":" suite
if j==i:print(end="\n... |
997,203 | 66a0c9c79280ba756537a6361323af6840d96668 | import argparse
def parse_args():
text = 'You can read a file with an argument -f or 2 numbers with arguments -m and -n'
parser = argparse.ArgumentParser(description=text)
parser.add_argument("-f", "--file", help="file with the cell board")
parser.add_argument("-m", "--rows", help="number of rows", ty... |
997,204 | 9d2a331ff55520fe2952fcf7ae4cf0657b86b7b8 | # David O'Brien, 2018-02-19
# Sum all the even numbers from 1 to 100
sum = 0
i = 0
while i <= 100:
sum = sum + i
i = i + 2
print ("The sum of the even numbers from 1 to 100 is:", sum) |
997,205 | b9f3a394fd7db503da604001fc5be7a5eef119a6 | from . import loss as losslayer
from . import utils
from . import model
import myutils
import torch
import torch.nn as nn
from tqdm import tqdm
import math
import numpy as np
def train_hqsnet(model, optimizer, dataloaders, num_epochs, device, w_coeff, tv_coeff, mask, filename, strategy, log_interval=1):
loss_list ... |
997,206 | 9a999514d7a0a90eb94b57eca43167b9e705b7ad | import io
from django.core.files.base import ContentFile
from django.test import Client, TestCase
from django.urls import reverse
from PIL import Image
from users.models import User
from recipes.models import Recipe
class TestUser(TestCase):
def setUp(self):
self.auth_client = Client()
self.nona... |
997,207 | 0d23becc9aaabdb6714f9d91f2f42e11c016cc70 | # -*- coding: utf-8 -*-
"""
Created on Sun Mar 21 10:56:41 2021
@author: Brian
"""
'''
本題目標是希望將chars中重複出現(次數大於2)的字母以字母+次數的形式進行壓縮(ex:["a","a","a"] - > ["a","3"])
而只連續出現一次的字母不動。解題思路如下:
(a) 定義一個找出與起始點不同的第一個字母的函數(findFirstFalseElement),利用該函數找到下一個起始位置
(b) 直接將該位置減去起始位置即為起始字母連續且重複出現的次數,將該次數轉成字元後取代重複出現的字母,
並將多餘位置移除,最後更新起始... |
997,208 | 4928b0dbe6f73fca125a5ba8d3efd087de1aa651 | user=input("year ")
# ------------check leap year--------------------
if user%4==0 and user%100==0 and user%400==0:
print "leap year ",user
elif user%4==0 and user%100!=0:
print '{0} {1}'.format(user, 'leap year hai ')
else:
print '{0} {1}'.format(user, 'leap year nahi hai')
# -------------------3 previous leap yea... |
997,209 | 369bf984a1b3496c998a73601378d4eafc378b55 | import random
import csv
def training_generate():
numberOfFeatures = 4
numberOfClasses = 3
sample =""
i = 0;
while (i<50):
j =0
while(j<4):
n = random.random()
n = float("{0:.2f}".format(n))
sample += str(n)
sample += ","
j+... |
997,210 | ad6ab4c0cbd7d21c9a8482f920f104793442b71a | import os, time, csv
import subprocess
import pyautogui
from datetime import datetime
dir = '' #Add a valid path pointing to zoom, this will be used by os.startfile to open zoom
# This takes too long that is why just hard code the path in dir
# start = "C:\\Users\\"
# for dirpath, dirnames, filenames in os.walk(star... |
997,211 | a156cf22323d1e7a3a86d86893bb4d3c6fd61499 | __author__ = 'zoulida'
import pandas as pd
import numpy as np
from sklearn import datasets,decomposition,manifold
def loadData():
#data_path = '../small_HFT1.csv'
data_path = '/volume/HFT_XY_unselected.csv'
csv_data = pd.read_csv(data_path) # 读取训练数据
#print(csv_data.shape) # (189, 9)
N = 5
#c... |
997,212 | f94fadedac67a4acbd9fa7644fab30f496be03c8 | from urllib.parse import quote
from pandas_profiling.report.presentation.core import HTML, Table, Sequence, Warnings
def get_dataset_overview(summary):
dataset_info = Table(
[
{
"name": "Total Number of Records",
"value": summary["table"]["n"],
... |
997,213 | 23feaf0565c4148ca3f7c7b2dc407ebabe77b97e | from django.db import models
class Job(models.Model):
title = models.CharField(max_length=255)
company = models.CharField(max_length=255)
city = models.CharField(max_length=255)
state = models.CharField(max_length=255)
start_date = models.DateField('Date started')
end_date = models.DateField('... |
997,214 | 9ae7063c5f9537d6ed2e5459380cec873b6e4f43 | import asyncio
import json
from collections import OrderedDict
from django.http import Http404
from rest_framework.response import Response
from rest_framework import viewsets
from rest_framework.permissions import IsAuthenticated
from rest_framework import status
from aiohttp import ClientSession
from core.models im... |
997,215 | 7f99395b8263906023c2c8fdaee50e181395cbca | # Solution 1, Top-Down
class Solution:
def minimumTotal(self, triangle: List[List[int]]) -> int:
pre = [0]
for row in triangle:
curr = row[::]
for i in range(len(row)):
if i == 0:
curr[i] = row[i] + pre[i]
elif i ==... |
997,216 | 81e0e6e7b22193ac7a347b9ca93beb6590e6bc59 | import sys
def solve(_s,_sz):
_c = 0
_ic = 0
for ch in _s:
if (ch == '1'):
_ic = _ic + 1
if (ch == '1'):
_c = _c + _ic
return _c
T = int(raw_input())
while T > 0:
_sz = int(raw_input())
_s = raw_input()
ans = solve(_s,_sz)
p... |
997,217 | 823afe660ad54964496198491f12c08a9b80885e | class PreprocessedCommandException(Exception):
def __init__(self, message):
super(PreprocessedCommandException, self).__init__(message)
class VHBandNotIncludedException(Exception):
def __init__(self, message):
super(VHBandNotIncludedException, self).__init__(message)
class VVBandNotIncludedE... |
997,218 | 60166d33f4ed577385e7dff7b057cc92a9866287 | # zyxwvutsrqponmlkjihgfedcba
# 54321098765432109876543210
# 01234567890123456789012345
# abcdefghijklmnopqrstuvwxyz
letters = "abcdefghijklmnopqrstuvwxyz"
backwards = letters[25:0:-1]
print(backwards)
backwards = letters[25::-1]
print(backwards)
backwards = letters[::-1]
print(back... |
997,219 | 8c8dec64786bc74265d7d60a36dac85997cac60c | #
# main_widget.py <Peter.Bienstman@UGent.be>
#
from mnemosyne.libmnemosyne.ui_component import UiComponent
class MainWidget(UiComponent):
"""Describes the interface that the main widget needs to implement
in order to be used by the main controller.
"""
component_type = "main_widget"... |
997,220 | bf8058d6e8f1e1813341cde76abb8e640b06b3d2 | # -*- coding: utf-8 -*-
import sys
sys.path.append('../')
import os
import re
import scrapy
from urlparse import urljoin
import common
class Spider(scrapy.Spider):
name = "bills"
handle_httpstatus_list = [302]
allowed_domains = ["kcc.gov.tw"]
start_urls = ["http://www.kcc.gov.tw",]
download_delay... |
997,221 | 4874c8fe9f2eed5ae5afbf1b9258a52740627e58 | list_url = 'https://hacker-news.firebaseio.com/v0/.json?print=pretty'
item_url = 'https://hacker-news.firebaseio.com/v0/item/.json?print=pretty'
categories = ['askstories', 'showstories', 'newstories', 'jobstories'] # categories
default_category = "newstories"
result_directory_name = "results"
log_file_name = "hn_pa... |
997,222 | f906e7fb731a8f7988f49fb4017ae6d88ec2a74b | from scuba_app.secrets import SECRET, POSTGRES_URI
class Config():
SECRET_KEY = SECRET
SQLALCHEMY_TRACK_MODIFICATIONS = False
REDIS_HOST = 'localhost'
REDIS_PORT = '6379'
#MAIL_SERVER = ''
#MAIL_USERNAME = ''
#MAIL_PASSWORD = ''
#MAIL_PORT =
#MAIL_USE_SSL =
class DevConfig(Config)... |
997,223 | 9c3310a0cbd8ea0ce5cfc10db2eac6ff8c0647a8 | """
4Sum II
Given four lists A, B, C, D of integer values, compute how many tuples (i, j, k, l) there are such that A[i] + B[j] + C[k] + D[l] is zero.
To make problem a bit easier, all A, B, C, D have same length of N where 0 ≤ N ≤ 500. All integers are in the range of -228 to 228 - 1 and the result is guaranteed to b... |
997,224 | 91661c15cb5a1b405ccc45cf4f57995d459f4404 | # coding=utf-8
# created by WangZhe on 2014/12/23
log_path = 'G:/Program/python/contest/taobao/log/log'
train_log_path = 'G:/Program/python/contest/taobao/log/train_log'
label_file_path = 'G:/Program/python/contest/taobao/feature/uid_term3_score1.txt'
temp_path = 'G:/Program/python/contest/taobao/temp/'
feature_path =... |
997,225 | a616f3f63971d2f8118e24172b00454c8568dd0a | import sys
import numpy as np
class Kinematics:
def __init__(self, *, initial_position: np.ndarray, initial_velocity: np.ndarray):
self._position = initial_position # meters
self._velocity = initial_velocity # meters per second
@property
def position(self) -> np.ndarray:
return... |
997,226 | 7bfca4f73235405f373453260f5795466a7d2e94 | # Generated by Django 3.2.4 on 2021-07-17 05:12
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('SMS_web_app', '0014_alter_logisticdetail_dc_date'),
]
operations = [
migrations.AlterField(
model_name='logisticdetail',
... |
997,227 | 80e0fa84edb126365c43a00600c422b1cc574dcf | """
Copyright 2013 Twitter, 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 agreed to in writing, software
distr... |
997,228 | 8e3c5e381e8041c00968e07d238b83b8f2479f95 | import hashlib
strs = '35eb09'
def md5(s):
return hashlib.md5(str(s).encode('utf-8')).hexdigest()
def main():
for i in range(10000000,100000000):
a = md5(i)
if a[0:6] == strs:
print(i)
exit(0)
if __name__ == '__main__':
main()
|
997,229 | 6fa8b90ced904f8470fd202a8bbb60764a5794b1 | import json
import logging
import uuid
from django.conf import settings
from django.contrib.auth import authenticate
from django.contrib.auth import get_user_model
from django.core.mail import EmailMultiAlternatives
from django.utils.translation import ugettext_lazy as _
from rest_framework import status
from rest_fram... |
997,230 | a013ec674b030a17efe63ec3514e68781fed383b | from env import *
from . import PaxosOracle
import networkx as nx
class LSPaxosOracleControl (LSController):
def __init__ (self, name, ctx, address):
super(LSPaxosOracleControl, self).__init__(name, ctx, address)
self.hosts = set()
self.controllers = set([self.name])
self.oracle = PaxosOracle()
se... |
997,231 | 110264d03316d9ed753fbc8b6637c46eccee5184 | import numpy as np
from utils import distance
# the node class used to form a graph for performing A*
class Node:
def __init__(self, coord_xy, end_xy, graph):
self.key = tuple(coord_xy)
self.coord_xy = coord_xy
self.heuristic = distance(self.coord_xy, end_xy)
self.shortest_dist = np... |
997,232 | 3129204c70b762d75fe810f44a03390f4e715435 | '''
Created: 17.04.2018
@author: davidgraf
description: main application to run
parameter:
'''
# ---------------------
# Konfiguration
#DATA_DIR = "C:/Temp/DCASE2017_development_set"
# 'SVM' or 'DecisionTree' or 'RandomForest' or 'GaussianProcess' or 'AdaBoost' or 'NeuroNet' or 'NaiveBayes'
CLASSIFIER = 'NaiveBayes'... |
997,233 | 461e59a249f0168af00862ad5cdeda559abb6e17 | # =============================================================================
# import lib
# =============================================================================
from __future__ import print_function
import matplotlib.pyplot as plt
import math
import numpy as np
import matplotlib.image as mpimg
impor... |
997,234 | 0f51f5261295f82a24887cc28cd17a642830e8df | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
class Model(models.Model):
foreign_key = models.ForeignKey('auth.User', null=True, blank=True, related_name='+')
many_to_many = models.ManyToManyField('auth.User', blank=True, related_name='+')
|
997,235 | 1c2fb3f158067c67afc1cdeb2cac7e14464b4cc8 | from django.contrib import admin
from eLearn.models import Register
# Register your models here.
admin.site.register(Register)
|
997,236 | f6c12fcd5b85fca6f79ceb7da2b66589466b6a6d | def square_of_7():
print("I am before return")
return 7**2
print("I am after return") # wont print as the return stmt exits the function
result = square_of_7()
print(result) |
997,237 | 740acd30bc5fa2b5bbb5bb8033418b9414e17e4a | # Generated by Django 2.0.6 on 2018-06-20 20:43
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
atomic=False
dependencies = [
('catalog', '0020_auto_20180620_1442'),
]
operations = [
migrations.DeleteModel(
... |
997,238 | 6f885bb89cb68a2468f6c3b2f99ecea003e3ed22 | from utils import *
#I implemented water. Water can spread in all cardinal directions but up.
#If it hasn't spread it will slow down its check frequency to spare the CPU.
#It will also spread through gold and ropes without changing the level.
#It will also slow down player movement!
class Water(object):
WATER_DEL... |
997,239 | 08fb3947ba932ccb452c8f34a106d217067d0907 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from typing import Tuple
import numpy as np
import pytest
from aicsimageio import exceptions
from aicsimageio.readers.default_reader import DefaultReader
from ..conftest import get_resource_full_path, host
from ..image_container_test_utils import run_image_file_checks
... |
997,240 | a427c28a3d4fa69bd94067bcd47fd316004b3932 | # -*- coding: utf-8 -*-
"""
Created on Sun Dec 11 02:54:09 2016
@author: Fran Callejas
"""
'''
--------------------------
Francesca Callejas
ffc2108
12/10/2016
weighted_knn
The purpose of this code is to find the type of flower that the closest
neighbors of a point are. I added a count to see how many in the list of... |
997,241 | a2983e059605064f714ca0cc0b74336003f4c3ef | def angrmain():
import angr
import claripy
FILE_NAME = 'filegr.elf'
IN_FILE_NAME = 'home/vladkuznetsov/Vl/Projects/Reverse/HW-08/12/hehuha.txt'
FIND = ()
BAN = ()
NUMBER_SIZE = 8
CHAR_SIZE = 8
proj = angr.Project('./' + FILE_NAME)
input_size_min = 32
input_size_max = 32
... |
997,242 | d294218181210846ba37973214f594adbf36f68b | class Solution(object):
def numWays(self, steps, arrLen):
dp = [[None for _ in range(arrLen + 1)] for _ in range(steps + 1)]
dp[0][0] = 1
for i in range(1, steps + 1):
for j in range(arrLen + 1):
if j == 0:
left = 0
if dp[i... |
997,243 | 810386a9982631104d7242ab6feddf1e770d3a09 | from random import randint
from math import sqrt
GENERATION_SIZE = 10
BRANCHING_FACTOR = 4
def heuristic(board, gridsize=4, blocksize=2):
collisions = 0
# run collision check for each cell
for i in range(gridsize):
for j in range(gridsize):
val = board[i][j]
# check row for... |
997,244 | 5c3ecd0cad18420b27399ada850e44a8a0d39d0d | import tkinter as tk
import platform
import os
# from PIL import Image, ImageTk
CELL_SIZE = 32 # the pixel for a single square for play board
from Manual_play_window import *
ROOT_DIR = "."
class Start_window:
def __init__(self, master):
self.master = master
self.frame = tk.Frame(self.master)
... |
997,245 | c7fd85cf2f8b4ad104240377b361e4765abc86c0 | #!/usr/bin/env python
# encoding: utf-8
"""
A functional wrapper for UCSF Chimera & PLIP
"""
import sys
from cStringIO import StringIO
class Mock(object):
def __init__(self, *args, **kwargs):
pass
def __call__(self, *args, **kwargs):
return Mock()
@classmethod
def __getattr__(cls,... |
997,246 | d566778a40c009c821f0b29de65b4efeedfbcf43 | # 둘 중 하나가 기준 값 보다 순위가 높아야 합격
T = int(input())
for tc in range(1,T+1):
N = int(input())
rank = [[]for _ in range(N)]
for i in range(N):
rank[i]=list(map(int,input().split()))
# 성적 기준으로 오름차순 정렬
rank.sort(key=lambda x :x[0])
cnt = 1
base = rank[0][1] #기준을 맨 처음 면접성적을 잡음. 합격하려면 작아야함
f... |
997,247 | e1dda3983f6c5b4134ce3c4fcf7e7fe9b2316fa8 | import torch
from torch.utils.data import DataLoader, TensorDataset
import tensorflow as tf
from sklearn.model_selection import train_test_split
import math
import unicodedata
import re
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
from tqdm import tqdm
import sys
from collections import defaultdic... |
997,248 | 09f0d8a939e3bbf53e0bb908079764e6595417da | # -*- coding: utf-8 -*-
"""
Created on Fri Jun 27 10:20:51 2014
@author: Maria
"""
from astropy.io import fits
import os
####Take out hard coding of key words and make them arguments#######
##########
# DESCRIPTION
# Starts at base_path and it will call functions that create a text catalog.
# PARAMETERS
# base_path ... |
997,249 | b7a060df2a15e7603634b08af88ae2388204a09e | #!/usr/bin/env python
"""
Usage:
cloudmesh-indycar-deploy.py --info
cloudmesh-indycar-deploy.py --run [WORKFLOW] [--dashboard] [--stormui] [--ui] [--keep_history]
cloudmesh-indycar-deploy.py --step [--dashboard] [--stormui] [--keep_history]
cloudmesh-indycar-deploy.py --dashboard [--keep_history]
cloudmesh-in... |
997,250 | 90191e062ea4b826f478632040d887217ff2f152 | from odoo import models, fields, api
class PurchaseOrderHSCodeLine(models.Model):
_inherit = 'purchase.order.line'
HSCode = fields.Text(string='HS Code', store=True, default="")
|
997,251 | dc54090d11078d3c9b5b7818fa903dcdfa2eff4d | from xml.etree import ElementTree as ET
import os
from collections import defaultdict
NEWSPAPERS = ["ANJO", "BDPO", "BLMY", "BNER", "BNWL", "BRPT", "CHPN", "CHTR", "CHTT", "CNMR", "CTCR", "CWPR", "DNLN", "DYMR", "ERLN", "EXLN", "FRJO", "GCLN", "GLAD", "GNDL", "GWHD", "HLPA", "HPTE", "IPJO", "IPNW", "JOJL", "LEMR",... |
997,252 | 17a7e3956b4f0856ce3a67fca4e375f19855064a | #import utils
from utils import find_max
numbers = [10, 3, 6, 2, 5, 8]
#max = utils.find_max(numbers)
maximum = find_max(numbers)
print(maximum)
#print(maximum(number))
|
997,253 | 3210371ffe75665b59f784a2dbb546b27b5562fd | ###########################################
# Let's Have Some Fun
# File Name: 647.py
# Author: Weilin Liu
# Mail: liuweilin17@qq.com
# Created Time: Fri Apr 26 14:14:10 2019
###########################################
#coding=utf-8
#!/usr/bin/python
# 647. Palindromic Substrings
class Solution:
def countSubstri... |
997,254 | 998702e0cbfc76c630142855a72912e96c298241 | from gi.repository import Gtk, Gdk, GLib
class Monitor(object):
def __init__(self):
pass
@classmethod
def from_monitor(cls, mon):
res = cls()
geometry = mon.get_geometry()
res.height_mm = mon.get_height_mm()
res.width_mm = mon.get_width_mm()
res.manufacturer ... |
997,255 | b8d5a489220b6407f81d0eeab3c84c5cc5d692cb | #display output
print("first python post")
|
997,256 | 39b54740206e6e7c82a6ab85652b898ddc0027c0 | import smtplib, ssl
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
import os
import time
import random
def send_img_email(Num_Emails:int, Sender_Email:str, Sender_Pass:str, Target_Email:str, Img_Subject:str, Joke_File:str, Img_File:str):
def random_line(file):
... |
997,257 | 77f21be9bd1ac907d6323e1462a3fc21aedccb75 | from pyam import IamDataFrame
import pytest
from numpy.testing import assert_array_equal
@pytest.mark.parametrize(
"axis, exp",
(["scenario", [0.5, 0.5, 1]], [["model", "scenario"], [1, 1, 1]]),
)
def test_debiasing_count(test_pd_df, axis, exp):
"""Check computing bias weights counting the number of scena... |
997,258 | 6b6ec007e77381c153571637c4b56c6b7f78020a | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2018-2023 Fetch.AI Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You ma... |
997,259 | c7e274f8ecc26f3d512be4cb78da25f7e5e003e9 | from random import random
from time import perf_counter
DARTS = 10000*10000
hits = 0.0
start = perf_counter()
for i in range(DARTS):
x, y = random(), random()
dist = pow(x**2+y**2, 0.5)
if dist < 1.0:
hits += 1
pi = 4*hits/DARTS
print('圆周率是:{:.6f}'.format(pi))
print('运行时间:{:.3f}'.format(perf_counter()-start))
|
997,260 | b77f2998308d381f69f943d025ae8c422aeb06e1 | """The registration module provides classes for image registration.
See Also:
- `ITK Registration <https://itk.org/Doxygen/html/RegistrationPage.html>`_
- `ITK Software Guide Registration <https://itk.org/ITKSoftwareGuide/html/Book2/ITKSoftwareGuide-Book2ch3.html>`_
"""
import abc
import enum
import os
import... |
997,261 | e7622a9cddaeddff961c526b65f33e4cf446e21b | # -*- coding:utf-8 -*-
import numpy as np
import pandas as pd
import time
from collections import defaultdict
from sklearn.metrics import mean_squared_error
from gensim.models import word2vec
from keras.models import Sequential,load_model,Model
from keras.layers import Dense, Activation, Dropout, Embedding,BatchNormali... |
997,262 | 6e784a114dda21a70c87cc9136ac444bbae26c17 | import os
import tweepy
from pprint import pprint
import json
# fetch the secrets from our virtual environment variables
CONSUMER_KEY = os.environ['TWITTER_CONSUMER_KEY']
CONSUMER_SECRET = os.environ['TWITTER_CONSUMER_SECRET']
ACCESS_TOKEN = os.environ['TWITTER_ACCESS_TOKEN']
ACCESS_SECRET = os.environ['TWITTER_ACCESS_... |
997,263 | 3ed42da3ecb0241859fd8ff028b95cd38044db4c | x=[2, 5, 3]
asd=sum(x)
print(asd)
|
997,264 | 42a2bef495a254377d3430c6679f1f4ef7d4f2bf | def numberEight():
def mainFunction(a,b):
def subFunction(c,d):
return c+d
x = subFunction(a,b)
return x
result = mainFunction(5,10)
print(result)
|
997,265 | f76bbae1fffeed49a5654098370c846e04b66a21 | import unittest
from flowsample import baz
class TestBaz(unittest.TestCase):
def test_baz_returns_baz(self):
self.assertEquals(baz.baz(), 'baz')
|
997,266 | 0f6cb1c87bda05fbb840f9d2b5160d8a34dee702 | import codecs
import arff, os
#from keras.models import model_from_json
import numpy as np
#import tensorflow as tf
import scipy.io as sio
import scipy
import pickle
import pandas as pd
from PIL import Image
from scipy.io import arff as arff_v2
import tensorflow as tf
from keras.models import model_from_json
def loadA... |
997,267 | 6dd7506f089140eb9700a726ecc51685d8b884c5 | # coding=utf-8
import datetime
import json
from django.contrib import messages
from django.core.urlresolvers import reverse
from django.http.response import HttpResponseRedirect, HttpResponse
from django.utils.translation import ugettext as _
from django.views.generic import View
from accounts.views import LoginRequi... |
997,268 | 584f9e577fd23c3881aaa738c4447b48d36d32f9 | from requests.auth import HTTPBasicAuth
import unittest
from unittest.mock import MagicMock, patch, PropertyMock
from lib.jira_api_call import JiraApiCall
from lib.api_call import RequestTypes
from lib.exceptions import JiraEmailNotSetException, JiraApiTokenNotSetException, JiraHostnameNotSetException
class TestJira... |
997,269 | 694d4e62a0bc27815c86a85a0ca487d28aa13ddd | import numpy as np
import netCDF4
import os
import sys
import subprocess
import pyroms
from pyroms_toolbox import jday2date
from mpl_toolkits.basemap import Basemap
import numpy as np
import matplotlib.pyplot as plt
from datetime import datetime
# draw line around map projection limb.
# color background of map project... |
997,270 | adf9a1c272c6644e456b6ef9d3b4a30d25e7f244 | from django.shortcuts import render, redirect
from django.urls import reverse
from .forms import UserForm
from django.contrib.auth import login, authenticate
# Create your views here.
def signup(request):
if request.method == 'POST':
form = UserForm(request.POST)
if form.is_valid():
... |
997,271 | ba569827bf4ad3cf24b7097a06eab9bceec2d403 | from django.urls import path
from server.views import IndexView, PredictView
urlpatterns = [
path("", IndexView, name="home"),
path("predict", PredictView, name="predict")
]
|
997,272 | 66ab9f8d76c1cea21ae9951145681abb0f7e03b2 | # /usr/bin/evn python
# -*-coding:utf-8 -*-
# Author : XK
import xlrd
import os
class SheetTypeError:
pass
class ExcelReader:
def __init__(self,excel_file,sheet_by):
#判断文件是否存在
if os.path.exists(excel_file):
self.excel_file = excel_file
self.sheet_by = sheet_by
self._data = list()
else:
raise FileN... |
997,273 | fe47b11b8c9140a09f1130760c6aa0f88c6f9372 | from django.conf.urls import url
from .views import *
urlpatterns = [
url('get', get),
url('by_name', by_name),
url('by_id', by_id),
url('check', check),
url('delete', delete),
url('create/', create),
]
|
997,274 | 018bb73b334b0671c0c19471720fed10cc47893d | import datetime
import json
import logging
import re
import pandas as pd
from covid19_scrapers.census import get_aa_pop_stats
from covid19_scrapers.utils.http import get_cached_url
from covid19_scrapers.utils.parse import raw_string_to_int
from covid19_scrapers.utils.misc import to_percentage
from covid19_scrapers.ut... |
997,275 | ab8f7c3fb8b7de5ef602bc087fdc8b797495e19c | from django.contrib import admin
# Register your models here.
from .models import JeWorker
admin.site.register(JeWorker)
from .models import JeWorkerPortfolio
admin.site.register(JeWorkerPortfolio)
from .models import JeWorkerSkill
admin.site.register(JeWorkerSkill)
from .models import JeWorkerCe... |
997,276 | ecc0a0be60c476b02a704114f73f5d8d84a8630b | #!/usr/bin/env python3
from .error_logger import RuntimeException
class Environment:
def __init__(self, enclosing=None):
self.enclosing = enclosing
self.values = {}
def define(self, name, val):
self.values[name] = val
def get(self, name):
if name.lexeme in self.values:
... |
997,277 | 292444ba4e60991eb20122080a5c149a6413c7e7 | """
Client controller module.
Consists of internal and external interfaces to the Client Controller, as well as ClientModel - the data structure
that is shared between these interfaces.
Both interfaces of the Client Controller may be started with start_client_controller function.
"""
import logging
import sys
import ... |
997,278 | 854396bcfa7aefef2632007d783bfd0c290221b6 | /home/runner/.cache/pip/pool/ea/a5/2f/7f48105f6f5f352e799880d111018c8c33d37a8fdbc434dd9a889c117d |
997,279 | 76d8d1400ff74dc37cd860c45a6b5e8b372e1d30 | from random import randint
seq_num = 12
num_jogadas = 3
round = 1
print ('#######################')
print ('Ask To Oracle, the game')
print ('#######################')
while (round <= num_jogadas):
print ('Tentativa {} de {}'.format(round,num_jogadas))
tentativa = int(input('Advinhe a sequencia num... |
997,280 | 2c2849247a8acd683e85111453a5e70a080bd320 | #!/bin/env python
# This script was modified from program_09_template.py by Joshua Tellier on 3/18/2020 as part of the lab 9 assignment for ABE65100
#Joshua Tellier, Purdue University
import pandas as pd
import numpy as np
def ReadData( fileName ):
"""This function takes a filename as input, and returns a datafram... |
997,281 | 692b622efb9408546ebd3c01ea89e89cfd5caa24 | # -*- coding: utf-8 -*-
"""
Created on Thu Apr 03 09:27:01 2017
"""
import sys
import urllib3
from bs4 import BeautifulSoup
import urllib
import hashlib
import certifi
import ssl
import pymysql
http = urllib3.PoolManager(
cert_reqs='CERT_REQUIRED', # Force certificate check.
ca_certs=certifi.whe... |
997,282 | ffbe35492046f7eeeb4ce46697c8ad91157cb63a | # nombre = input('Digite su nombre: ')
# print(f"Hola {nombre}")
numero = float(input('Digite un numero: ')) # input solo guarta texto asi se escriban numeros
print(f"El numero es {numero+1}")
|
997,283 | 9d73ab975dab01357b9f990d81dbf5d2e7d9d37f | from . import discharge_summary
from . import ecg
from . import clinic_letter
exports = {
"discharge summary": discharge_summary.main,
"ecg": ecg.main,
"clinic letter": clinic_letter.main,
} |
997,284 | 8c2e01e976ae9ca0689db4209ffa1a08c8ecade1 | from django.conf.urls import url, include
from django.contrib.auth.views import LogoutView
from django.urls import path
from django.contrib.auth import views as auth_views
from django.views.i18n import JavaScriptCatalog
from dccrecibo.accounts import views
app_name = 'accounts'
urlpatterns = [
path('logout/', L... |
997,285 | c5c81ed3351d22bd447be55f348cad22b1cd6c84 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import io
import subprocess
from os import path
root_dir = path.abspath(path.dirname(path.dirname(__file__)))
def git_version():
return subprocess.run(
['git', 'describe', '--abbrev=0', '--tags'],
stdout=subprocess.PIPE,
text=True,
che... |
997,286 | 8c57485ed2b91ca2c8538066c6595dce362a74ed | """
Pedir dos números y decir si son iguales o no.
"""
n_1 = int(input("Write the first number: \n"))
n_2 = int(input("Write the second number: \n"))
print(n_1 == n_2)
|
997,287 | 0154fb3a5ed57bcbc7ed92211a5c0098bf83f718 | #Write a program to manipulate List data
A=['Shreyas','Atharv','Abhishek','Amit','Yashraj','abc',64,44,29,66,00]
print("\n\nList A :",A[:])
print("List A : 2 to 5",A[2:6])
print("List A In Reverse:",A[::-1])
A.append('Abhishek')
print("List A After Appending :",A[:])
A.insert(4,'Nikhil')
print("Lis... |
997,288 | fc6a4e1a0cd5310021f6ec7f7e5e13975ca650e7 | import requests
import pprint
import json
import os
import datetime
SPOTIFY_TOKEN = None
def get_spotify_token():
global SPOTIFY_TOKEN
current_time = datetime.datetime.now()
if SPOTIFY_TOKEN is None or current_time > SPOTIFY_TOKEN['expiration']:
url = "https://accounts.spotify.com/api/token"
payload ... |
997,289 | fe3d7f8a17dda33f0159791ec8f3b2bfc64e265c | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
# COPYRIGHT NOTICE STARTS HERE
# Copyright 2019 © Samsung Electronics Co., Ltd.
#
# 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
#
#... |
997,290 | 391deed48fc5b62627dde98b808a9c8be5dd4ff4 | '''
Write a program which accept range from user and return addition of all even
numbers in between that range. (Range should contains positive numbers only)
Input : 23 30
Output : 108
Input : 10 18
Output : 70
Input : -10 2
Output : Invalid range
'''
def DisplayEven(iStart,iEnd):
sum = 0;
if((iStart > iEnd) ... |
997,291 | dd9551a76243d5b309273fdbcd7932c362e3fb55 | # To support both python 2 and python 3
from __future__ import division, print_function, unicode_literals
# Common imports
import numpy as np
import os
# Chapter import
from sklearn.cluster import SpectralClustering
from sklearn.datasets import make_moons
# To plot pretty figures
import matplotlib
import matplotlib.... |
997,292 | 87e3c43c4437dd551b7bae1a266c9806284e9a63 | """
A basic server to convert email addresses into proper emails without mailto.
"""
import argparse
from base64 import b64decode
from email.mime.text import MIMEText
from http.server import BaseHTTPRequestHandler, HTTPServer
import logging
import os
import re
import smtplib
import sys
from threading import Thread
fro... |
997,293 | f129878d48a425f75c95dd873c027a24a7c24724 | n = int(input())
p = list(map(int, input().split()))
p.sort()
median = p[n // 2]
diff = 0
for i in p:
diff += abs(median - i)
print(diff)
|
997,294 | 1895e0b53c4abfaa3f79685091f61b8eceff790b | import torch
from PIL import Image
from torchvision import transforms
from torch.utils.data import Dataset
class CustomDataset(Dataset):
"""Face Landmarks dataset."""
def __init__(self, imgs_path, lbls,is_training):
self.imgs_path = imgs_path
self.lbls = lbls
#self.idx = list(range(0,... |
997,295 | 32086327aad051204d63709fec39f9ca594e4dec | from django import forms
from First.models import Employee
class EmpForm(forms.ModelForm):
class Meta:
model=Employee
fields=["ename","eemail","econtact"] |
997,296 | cccb306e5f2f300547290b71d90c9a8b19aaaa28 | # Original Version: Taehoon Kim (http://carpedm20.github.io)
# + Source: https://github.com/carpedm20/DCGAN-tensorflow/blob/e30539fb5e20d5a0fed40935853da97e9e55eee8/utils.py
# + License: MIT
# (Modified) Koki Yoshida and Chenduo Huang
# 2017-06-01
"""
Some codes from https://github.com/Newmu/dcgan_code
"""
import ... |
997,297 | d1a3471cb09ce784da636950b01eb018ed5cbe54 | from nose.tools import istest, assert_equal
from wordbridge.openxml import numbering
from wordbridge import openxml
@istest
def numbering_instance_is_read_from_num_element_with_abstract_num_base():
numbering_xml = _create_numbering_xml("""
<w:abstractNum w:abstractNumId="0">
<w:lvl w:ilvl="0">
<w:star... |
997,298 | c8470d7973e8ae4aa801d5f51510d07310123b3b | from sympy.core.function import (Derivative, Function)
from sympy.core.numbers import (I, Rational, oo, pi)
from sympy.core.relational import (Eq, Ge, Gt, Le, Lt, Ne)
from sympy.core.symbol import (Symbol, symbols)
from sympy.functions.elementary.complexes import (Abs, conjugate)
from sympy.functions.elementary.exponen... |
997,299 | 1dcdd762aad7b47ad861aca4bccdaa6dd57f5bb7 | #!/usr/bin/python
"""
Feature extraction module for SemEval Shared Task 1.
"""
__author__ = 'Johannes Bjerva, and Rob van der Goot'
__email__ = 'j.bjerva@rug.nl'
import os
import requests
import numpy as np
from collections import defaultdict
from scipy.spatial.distance import cosine
from nltk.corpus import wordne... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.