index int64 0 1,000k | blob_id stringlengths 40 40 | code stringlengths 7 10.4M |
|---|---|---|
987,900 | 64525f8c1e9755c950d60e3dec223c83f061e3fd | #!/usr/bin/env python
"""
Copyright (c) 2006-2019 sqlmap developers (http://sqlmap.org/)
See the file 'LICENSE' for copying permission
"""
import httplib
import re
import socket
import urllib
import urllib2
from lib.core.common import getSafeExString
from lib.core.common import getUnicode
from lib.core.common import... |
987,901 | 68b8cdae76f59fd43d07c7be7607ff2e6bffd94b | import calc
info = "\
Chapter 27: \n\
\t 1) motion in a magnetic field\n\
\t 2) hall effect\n\
\t 3) magnetic torque\n\
\t 4) magnetic potential energy\n\
Chapter 28: \n\
Chapter 29: \n\
\t 5) displacement current density (two plates)\... |
987,902 | 82bbf6c470e37dc72e57afad9000d81eea5da253 | from django.conf import settings
from django.urls import path,include
from .views import ModelSave
from django.conf.urls.static import static
urlpatterns = [
path('mldb/',ModelSave.as_view()),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) |
987,903 | b3038166c105364c2f263215197e5747bdf181cf | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright © 2019 Manoel Vilela
#
# @project: Inteligência Computacional UFC 2019.1 - Redes Neurais
# @author: Manoel Vilela
# @email: manoel_vilela@engineer.com
#
"""-- Módulo com algoritmos de teste e métricas de avaliação.
Para classificação:
+ accu... |
987,904 | cd7c7d0f592ed2ee6c042e558236a76ea1b5b156 | #!/usr/bin/env python
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
import sys
import os
import gzip
infile = "merged_universal_neg_intersected.bed.gz"
chroms_file = "hg38.chrom.sizes"
chrom_to_size = dict([(x.rstrip().split("\t")[0],
... |
987,905 | 68ee7cda139d89d0a2aac024c7908d2aef691661 | import os
from io import StringIO
from django.core.management import BaseCommand
from django.core.management import call_command
import yaml
class Command(BaseCommand):
help = "Generate a schema file and add relevant metadata."
def handle(self, *args, **options):
"""Read the API document from gener... |
987,906 | 5ed7099e6c9256ba7823a71b56e6b674df707ea4 | for i in "python":
if i=="h":
continue #corta el flujo de ejecucion y no hace el print, lo devuelve al for
print(f"viendo la letra {i}")
nombre="Fabricio Vargas"# Voy a contar solo las letras y no los espacios en blanco
contador=0
for i in nombre:
if i==" ":
continue
contador+=1
print... |
987,907 | b7d489bb7f3c1072e64183ca4be36e654ca7f991 | # Generated by Django 3.0.4 on 2020-04-26 11:16
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import user.models
class Migration(migrations.Migration):
dependencies = [
('user', '0004_auto_20200426_1102'),
]
operations = [
mig... |
987,908 | c17b4672bf3d3a5930643265e2594cf0785c4251 | import ispisivanje
print(type(ispisivanje))
ispisivanje.pprint ('Pozdrav, svijete')
ispisivanje.pprint ('Moduli su super')
ispisivanje.pprint ('Python je zaista super')
ispisivanje.print_upper ('Ovo ide u velike slove')
from math import sgrt as korijen
print(korijen(2)) |
987,909 | 8cde1ce2f0999bc105107656941101476e2653c2 | #!/usr/bin/env python
import numpy as np
from scipy.optimize import curve_fit
X = np.array([
0.00,
6.05,
11.87,
18.01,
23.99,
30.01
])
Y = np.array([
2.36,
1.85,
1.60,
1.45,
1.19,
1.09
]) * 0.01
def fit_func(x, a, c):
return a * x ** 2 - 72 * a * x + c
fx = np.li... |
987,910 | 278a89b08cca8d50afbfae3741c012ff79d9aaac | import glob
import os
import signal
import open3d as o3d
import numpy as np
import fire
DOWNSAMPLE_VOXEL_SIZE = 2
def find_raytrix_pcd_files(pcd_dir: str):
pcd_files = glob.glob(os.path.join(pcd_dir, '*.pcd'))
pcd_files.sort(key=lambda v: int(os.path.basename(v).split('_')[3])) # Sort by frame number
r... |
987,911 | eb3f3e108b81bd3ea0fdd013cf80ce10aa40e4fc | import math
K = 15
# C = 2
lambdaa = 10 # llegan 10 clientes en intervalo de 1 hora => Poisson(lambda = 10)
mu = 6 # Tiempo de servicio promedio: 10 minutos = 1/6 hora => media = 1/mu => exp(mu = 6)
costo_encola = 10
costo_cajero = 15
def first_sum(C):
counter = 0
for i in range(0, C+1):
to_add... |
987,912 | 5b8c5d30ae7cd3e8888c42defbe380f3f1051e17 | import os
import numpy as np
import matplotlib.pyplot as plt
from thinkdsp import read_wave
wave = read_wave('C:/Users/38407/Desktop/2/数字信号处理/python/5python练习第三章/72475__rockwehrmann__glissup02.wav')
plt.rcParams['font.sans-serif']=['SimHei']
plt.rcParams['axes.unicode_minus']=False
wave.make_spectrogram(512)... |
987,913 | fd81ef81b3e8f7636279cbb1eda37fe6c195ad46 | # This program uses a thermal printer to print out various information from
# the internet or the "fortune" program
from Adafruit_MCP230xx import *
import RPi.GPIO as GPIO
import time, subprocess, re, textwrap, urllib, urllib2, os, Image, ImageDraw, unicodedata, datetime
from xml.dom.minidom import parseString
from bs... |
987,914 | 589beb097abc15a7ac2207ba99a045c67330251f | #!/usr/bin/env python
# encoding: utf-8
import re
import json
import urllib
from datetime import datetime
from client.csrfopner import CSRFOpenerDirector
from bs4 import BeautifulSoup
HTTP = 'http://'
HTTPS = 'https://'
HOST = 'www.xuetangx.com'
BASE_URL_S = HTTPS + HOST
BASE_URL = HTTP + HOST
LOGIN_PAGE = BASE_URL_... |
987,915 | b57f6b1366c26765a1fa2979b574d10bd9693523 | year=int(input("请输入年份"))
month=int(input("请输入月份"))
day=int(input("请输入日子"))
sum=0
i=2000
j=1
k=1
while i<year:
if i%4==0 and i%100==0 or i%400==0:
sum+=366
else:
sum+=365
i+=1
while j<month:
if j==4 or 6 or 9 or 11:
sum+=30
elif j==2:
if year%4==0 and year%100==0 or ye... |
987,916 | 49a0b1a18c61bbab6408810d53d4daa341b410fb | import os
def main():
os.mkdir('request_data')
for filename in os.listdir('data'):
file = open('data/' + filename, 'r', encoding='utf=8').read()
file = file.split("\n\n")
request_string = [s for s in file if 'nif:isString' in s]
request_file = open('request_data/' + filename,... |
987,917 | e540ab9858ecaa0b2918661096d80fcecd888754 | import os
import mock
from xml.etree import ElementTree
from django.test import TestCase
from casexml.apps.case.mock import CaseFactory
from corehq.util.test_utils import TestFileMixin
from corehq.apps.userreports.sql import IndicatorSqlAdapter
from corehq.apps.userreports.models import StaticDataSourceConfiguration
fr... |
987,918 | f7adcb36b00421afc104b95431b36d3e6875cd7a | #homework
a=str(input())
b=str(input())
list=[a,b]
output=[str for str in list if a.endswith(b)]
def pstr(output,list):
if output==list:
return True
else:
return False
pstr(output,list)
'''23. Complete the solution so that it returns true if the first argument(string)
passed in ends with the... |
987,919 | 58a6ba952501f6bf65b88fdc0197bcbf66725d24 | from pathlib import Path
class Device:
"""A Class for the state of an IntCode program"""
def __init__(self, data):
data = data.split("\n")
reg_names = "ab"
self.reg = dict(zip(list(reg_names), [0] * len(reg_names)))
self.instr_ptr = 0
self.instrs = []
for line... |
987,920 | a2344520779a8863fb84b398261e4c3e3394299a | import speedtest
test = speedtest.Speedtest()
download = test.download()
upload = test.upload()
print(f"Download Speed : {download}\n
Upload Speed : {upload}")
def Credit():
Space(9); print "#####################################"
Space(9); print "# +++ Internet Speed Test +++ #"
Space(9); pri... |
987,921 | bc3a5964370254f9763e55688a60d2a817e2675e | import numpy as np
import pandas as pd
from scipy import signal
image=np.array([[1,2,3],[4,5,6],[7,8,9]])
mask=np.array([[1/4,1/4],[1/4,1/4]])
re=signal.convolve2d(image,mask,boundary='symm',mode='valid')
# print(re)
def conv(il,m_s,i_s):
length=len(il)
il=il.reshape(length,i_s,i_s).tolist()
masklist=[]
for i in... |
987,922 | 6b1718be595a10a5f8172400e2926c65c12b7af5 | #!/usr/bin/python
import logging
import os
current_directory = os.getcwd()
logger = logging.getLogger('CTFsetup')
hdlr = logging.FileHandler(current_directory + '/log/setup.log')
formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s')
hdlr.setFormatter(formatter)
logger.addHandler(hdlr)
logger.setLevel... |
987,923 | dcf76f797351c8027fd0f6a830004d0a351892e8 | import numpy as np
import mlrose
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score
from sklearn import preprocessing, datasets
import time
from random import randint
import warnings
def our_fitness_func(state):
global... |
987,924 | 98ceb806a8f412afde707f2559c2ec99e709d21f | import sys
from gam.var import *
from gam import controlflow
from gam import display
from gam import gapi
from gam.gapi import directory as gapi_directory
from gam import utils
def create():
cd = gapi_directory.build()
body = {'domainAliasName': sys.argv[3], 'parentDomainName': sys.argv[4]}
print(f'Addin... |
987,925 | 4702a3f4992ab18dfc9456fb75d63fb73d0eb7d2 | from .common import json2dict
from .dicttree import DictTree
|
987,926 | 45f674f5173cb5575b8267aad794408b16b3d4b4 | from flask import Flask, Blueprint, render_template
bp = Blueprint("HomeController", __name__)
@bp.route("/")
@bp.route("/index")
def index():
return render_template("index.html") |
987,927 | 8c30f0b8e896652d302d2bf94e4921e02f7f6ebb | # coding: utf-8
import dataclasses
import typing
import serpyco
from sqlalchemy.orm.exc import NoResultFound
from guilang.description import Description
from guilang.description import Part
from guilang.description import Type
from rolling.action.base import WithResourceAction
from rolling.action.base import WithStuf... |
987,928 | d4283c3a002794545865b0babd5cad25600ac1b6 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.cluster import KMeans
from sklearn.datasets import load_wine # load_wine() -> I can't load data and target from it ?¿ :(
"""
In this sample we will try to categorize some wines of which we have some features
Unlike classification, in ... |
987,929 | 55ff033b632720abc3401e70ef4f4bba7d0aee74 | import unittest
from kalk import Kalk
class KalkTest(unittest.TestCase):
def testOnEmptyString(self):
self.assertEqual(0, Kalk.add(""))
def testASingleNumber(self):
self.assertEqual(42, Kalk.add('42'))
def testTwoNumbers(self):
self.assertEqual(42, Kalk.add('40,2'))
def tes... |
987,930 | 90c52167c2572cd841695841cf7b325985d2518d | # Generated by Django 2.0.6 on 2018-06-30 09:40
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('challenges', '0006_challenge_classes_list'),
]
operations = [
migrations.AddField(
model_name='challenge',
name='tim... |
987,931 | 3a5fd6a60da46d16eabb67a2b4eb2002954ac0a2 | list = [23,2,53,1,10]
for b in list:
if b < 5:
print (b)
|
987,932 | 09c7c4a65ddc2fa970ac5a9e037b79dc7ce06f05 | """
* Copyright 2020, Departamento de sistemas y Computación, Universidad
* de Los Andes
*
*
* Desarrolado para el curso ISIS1225 - Estructuras de Datos y Algoritmos
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published b... |
987,933 | e955297bd782fbbc01fcf275606cab0478adccb2 | """
Autor: GAÑAN, Tomas // CERIONI, Enrique
Ejercicio 2: Moneda Falsa
"""
# Importacion de librerias/modulos
import numpy as np
import random
# Eligir una moneda aleatoriamente / identificar cuál es la falsa
moneda = [0,0,0,0,0,0,0,0,0,0,0,0]
num = random.randint(0,11)
moneda[num]=1
true_coin = [0,0,0]
print("\... |
987,934 | 0eb1dee9dee337b2e985aa81c14b7e01600a9127 | import scipy.stats
from scipy.special import hermite
from scipy.linalg import eigh
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.path as path
from hermite_poly import Hermite, Poly
from simple_models import simulate, VAC, well_well, makegrid, fcn_weighting, L2subspaceProj_d, OU, dot
from mpl_too... |
987,935 | ee2b1d9b8f190b2faba4237f266a4741262d5869 | #Alina Omorbekova
#В магазине есть список разных продуктов, у каждого продукта есть
# название, цена, уникальный номер. Сперва пользователю нужно отобразить
# весь список продуктов с их информацией, после нужно сказать чтобы он
# ввел название товара, если такой товар есть предложить пользователю
# купить этот ... |
987,936 | 960de71e49255acbeb95764a31503d27dafafa83 | import logging
import requests
import xmltodict
try:
from urllib.parse import urljoin
except ImportError:
from urlparse import urljoin
LOGGER = logging.getLogger('cisco_olt_http.client')
class Client(object):
def __init__(self, base_url):
'''
:param base_url: OLT box API base url.
... |
987,937 | aca47ed5259a4a36a4b0fc8cf0b62ccf9c0086a7 | import numpy as np
import pandas as pd
#import matplotlib.pyplot as plt
#import seaborn as sns
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegression
from sklearn.metrics import r2_score
from sklearn.metrics import mean_squared_error
from analysis_util import *
import net... |
987,938 | fcfc71eac1cc42b582305e7e8db9222b8bc88d09 | import sys
def calculate_growth(capital, growth, years):
return capital * (growth ** years)
def calculate_growth_on_consist_invest(capital, investment, growth, years):
accumulated_capital = calculate_growth(capital, growth, years)
original_capital = capital
for i in range(years - 1, 0, -1):
... |
987,939 | 86d4c3ba585ceeeea124a1970dc53e34861a3d28 | import os
import dnacauldron as dc
repo = dc.SequenceRepository()
files = ["RFP_GFP_plasmid_parts.fa", "RFP_GFP_plasmid_BOs.fa"]
repo.import_records(files=files)
plan = dc.AssemblyPlan.from_spreadsheet(path="assembly_plan.csv")
simulation = plan.simulate(repo)
stats = simulation.compute_stats()
simulation.write_repor... |
987,940 | e9f022cd03dcb110d14d60c64f746f2800d2be20 | import random
import numpy as np
import torchvision.transforms as tt
from collections import deque
import PIL.Image
import cv2
class Seed():
def __init__(self):
self.seeds = deque([])
self.pointer = -1
self.new_seed_flag = True
def new_seed(self):
if self.new_seed_flag is False... |
987,941 | 4f693fdea3a9af3ca34bf4705922c04b42f11322 | class Packet:
def __init__(self, data):
self.event = data[0]
self.time = float(data[1])
self.from_node = data[2]
self.to_node = data[3]
self.pkt_type = data[4]
self.pkt_size = int(data[5])
self.flow_id = data[7]
self.source_addr = data[8]
self.... |
987,942 | 6b7f874afc11b420613200c654a1acd976037f2b | from django.shortcuts import render
# Create your views here.
from .models import (
CarModel,
SelectionServices,
RequestUser,
DeleteRequest,
DiscountCode,
Comment
)
from .serializers import (
GetCarModelSerializer,
GetSelectionServicesSerializer,
PostDeleteRequest,
PostDiscountC... |
987,943 | f87c3e8ce7a545fa0f162e4adbdd81a29f0f4d85 | import sys
sys.stdout = open('a_big.out', 'w')
sys.stdin = open("a_big.in", 'r')
sys.setrecursionlimit(1500)
def empty(row):
for c in row:
if c != '?':
return False
return True
def filled_out(row):
for c in row:
if c == '?':
return False
return... |
987,944 | 6d70d7322e6e462bd2092bc9d8b5b71f0a36cbe7 | import os
from torchvision import transforms
from torch.utils import data
from .image_utils import imageLoader, is_image_file, make_dataset
class ImageDataset(data.Dataset):
def __init__(self, root, transform=None, smalltransform=None,
toTensor=None, loader=imageLoader):
imgs = ma... |
987,945 | e8748d9125c2012d250b1c7d6273f50314a3bfcb | from inverse_kinematics.InverseKinematics import *
torch.manual_seed(1510)
sample_rate = 12
selected = get_fnames(["walk"])
data = parse_selected(selected, sample_rate=sample_rate, limit=1000)
X, y = gather_all_np(data)
X = X[:, :(X.shape[1] - 3)]
dummy_joints, dummy_pose = dummy()
# excluded = ['lfingers', 'lthumb... |
987,946 | 2826450917806698d29e38f27dbcdf0803297f88 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import rospy
import random
from geometry_msgs.msg import Twist
from geometry_msgs.msg import PoseWithCovarianceStamped
from sensor_msgs.msg import Image
from sensor_msgs.msg import Imu
from sensor_msgs.msg import LaserScan
from sensor_msgs.msg import JointState
from nav_m... |
987,947 | 4d220f728fee371971674da28041baec5081d397 | from visual.controls import *
def change(): # Called by controls when button is clicked
if b.text == 'Click me':
b.text = 'Try again'
else:
b.text = 'Click me'
c = controls() # Create controls window
# Create a button in the controls window:
b = button( pos=(0,0), width=60, height=... |
987,948 | 9dfd3c0cc13fa0357338a94cc9c1dd67b4a57778 | #!/usr/bin/env python3.7
from user import User,Credentials
def create_user(uname,password):
"""
Function to create a bew user
"""
new_user = User(uname,password)
return new_user
def save_users(user):
"""
Fuction to save user
"""
user.save_user()
def find_user(user_name):
"""
... |
987,949 | f7b0d4196f6049279fb3f754233bb260c914d7bd | int i
print("enter the number")
for(i=1;i<=n;i++)
{
printf("Hello World ");
}
|
987,950 | 91a1b5626db189cad227edecfe1fdec03547afd9 |
class LoginPageData:
email_id = 'sbabu@psmi.com'
password = 'Password1!'
invalid_passwd = 'Password1!1'
psmi_landing_page_title = 'Registration Requests' |
987,951 | f979b6b1473ac7be56ff7cb448a495a40ed6f053 | from tkinter import *
class V_SearchReader:
def __init__(self):
self.__root = Tk()
self.__root.title('SearchReader')
self.__root.geometry('400x200')
self.__root.resizable(0,0)
|
987,952 | 61aff5e001d7d0212c7d01d8b6b5b86eb65f2d22 | ############################################################
# -*- coding: utf-8 -*-
#
# # # # # # #
# ## ## # ## # #
# # # # # # # # # # #
# # ## # ## ## ######
# # # # # # #
#
# Python-based Tool for interaction with the 10micron mounts
# GUI with PyQT5 fo... |
987,953 | f96d2da2661f787c4db845e4899b94c63058e829 | # Generated by Django 1.11.21 on 2019-07-08 11:57
import django.db.models.deletion
from django.db import migrations, models
import waldur_core.core.fields
import waldur_core.core.models
import waldur_core.core.validators
class Migration(migrations.Migration):
dependencies = [
('structure', '0009_project... |
987,954 | 5873c89c1a284cd3d4d267cc9be25187e9f2cd24 | # -*- coding: utf-8 -*-
import pandas as pd
from sklearn.cross_validation import train_test_split
from sklearn.metrics import recall_score, precision_score
#导入随机森林算法库
from sklearn.ensemble import RandomForestClassifier
from sklearn.linear_model import LogisticRegression
from sklearn.grid_search import GridSearchCV
fr... |
987,955 | 5a856534b94b5030e659023d3d8f6b55d64e0c40 | import numpy as np
from standardizeList import standardizeList
# Randomly choose bench players [fr. relative (MP/G)^N]
def benchSelect(bench, num, power):
players = list(bench.Player)
probs = standardizeList(list(bench.MP_per_game), power)
choices = sorted(np.random.choice(players, replace=False, size... |
987,956 | befac1765b645a3463446f377e67d8a296a8f64c | #var
count= 0
fact=1
#input
num = int(input("Please enter a number:\n"))
#loop
while num > count:
count += 1
fact *= count
#statement
print("The factorial is " +str(fact))
|
987,957 | b3362310290e1cff92d0567722cccd2cccd86fd2 | #!/usr/bin/env python
import curses
import calendar
import gevent
import time
import global_mod as g
import getstr
class BlockViewer(object):
def __init__(self, block_store, window):
self._block_store = block_store
self._window = window
self._mode = None # TODO debug
self._browse... |
987,958 | a8287d589bdaf43b03e362184eb2dd3fe6fc6282 | from abc import abstractmethod, ABCMeta
# Stolen from cpython's _collection_abc.py
def _check_methods(C, *methods):
mro = C.__mro__
for method in methods:
for B in mro:
if method in B.__dict__:
if B.__dict__[method] is None:
return NotImplemented
... |
987,959 | fb14a569c127111dca1caec1a8813d20af2602a1 | import critic
import performance_system
import experiment_generator
import generalizer
from random import uniform
'''
This module used for train management and study with the other modules
'''
end_main = False
while not end_main:
print("--------------")
print("Welcome to manager view")
print("1. Create and... |
987,960 | 0bee34fb247bfb780bfec0b95a83cb3d56b0af20 | from pyparsing import oneOf, Literal, Word, Optional, Combine, delimitedList, MatchFirst, CaselessLiteral
from ...util.grammar import *
def define_encode():
encodeKeyword = CaselessLiteral("encode").setResultsName('encode')
encode_options = _define_encode_options()
encode = encodeKeyword + Optional(encode... |
987,961 | 73fc2b26f5d8cc96f39615e0e0773368f2fd399a | from __future__ import absolute_import
import os
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
PACKAGE_PATH = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(PACKAGE_PATH, 'README.md'), encoding='utf-8') as fp:
readme = fp.read()
setup(
name=... |
987,962 | 983649d57abc6d4a886bbe803091550263b91c30 | #!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
Created on Tru Jun 3 15:13:37 2020
@author: Robinson Montes
"""
import json
def save_to_json_file(my_obj, filename):
"""
Save object to a file
Arguments:
my_obj (obj): The inputed object to convert in json format
filename (str): The name of ... |
987,963 | d705603b2672b12c41bcb655713e779237f81a76 | import re
make_list = []
p = re.compile(r"(\w+)\s+(\d+)[-](\d+)[-](\d+)")
m = p.search("park 010-1234-5678")
print(m)
print(m.group(0))
print(m.group(1))
print(m.group(2))
print(m.group(3))
print(m.group(4), '- *******')
h = m.group(4)+'- ********'
print(h)
|
987,964 | f4ae0e6ddab2557d2ae539b3eef6fc93ee211653 | from django.contrib import admin
from .models import Service
class ServiceModelAdmin(admin.ModelAdmin):
list_display = ("service", "price", "cost", "duration", "profit")
admin.site.register(Service, ServiceModelAdmin)
|
987,965 | 0d026efa6b13a5844dc61ad818ae4dea3171bf0a | def partition(a, l, r):
#가장 왼쪽 요소를 피봇으로
pivot = a[l]
i = l
j = r
while i < j:
#피봇보다 큰 요소 찾기
while a[i] <= pivot:
i += 1
#빼먹으면 안 됨
if(i == r): break
#피봇보다 작은 요소 찾기
while a[j] >= pivot :
j -= 1
#빼먹으면 안 됨
... |
987,966 | e315f3fb6fa8178a45519569e8caaab7b3c922ad | import numpy as np
from scipy.integrate import odeint
from equats import traj_and_speed, w_rel_and_quat
import matplotlib.pyplot as plt
from calculate_w_ref import w_ref, w_ref_dif, determineAEP
from ext_moments import mom_gravit
from utils import rotation_to_connected
t_0, nu = 0, 6.809e15
t_final = 500000
t = np.... |
987,967 | da177da7c0f53cc62187f50e170a006e4d4778a8 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Desc :
# @Time : 2020-11-14 22:14:22
# @Author : Lydia
# @Site :
# @File : sort.py
# @Software: PyCharm
if __name__ == '__main__':
fruits = ['grape', 'raspberry', 'apple', 'banana']
print(sorted(fruits))
print(fruits)
print(sorted(fruits, ... |
987,968 | ab67c951d869d4da7798881e84ba5ded393f6f0d | import dash_core_components as dcc
import dash_html_components as html
import dash_bootstrap_components as dbc
import plotly.graph_objects as go
from dash.dependencies import Output, Input
from app import app
from utils.organization_chart import oc
from utils.chorus_dt_handler import ch
from components.html_components... |
987,969 | 381cffbf3d3cb6e16bef880e1d8f88410fcfbc6c | #basic functions for ML
#updated from basic.py 22nd September
#IMPORTS
from collections import defaultdict as ddict, OrderedDict as odict
from typing import Any, Dict, List
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from rdkit.Chem import PandasTools, AllChem as Chem, ... |
987,970 | 0a37fab81efaba77abd85832a2aa0f8b0e60ef52 | #!/usr/bin/env python3
with open('/home/kami/Projetos/Cod3r/Manipulação_Arquivo/pessoas.csv') as arquivo:
with open('/home/kami/Projetos/Cod3r/Manipulação_Arquivo/pessoas.txt', 'w') as saida:
for registro in arquivo:
pessoa = registro.strip().split(',')
print('Nome: {}, Idade: {}'.f... |
987,971 | 47012baf23787de2eba489754d4c1a83da13b5f7 | from django.db import models
# Create your models here.
class Comment(models.Model):
user_name=models.CharField(max_length=20)
titleId=models.IntegerField()
date_time=models.DateTimeField(auto_now_add=True)
content=models.CharField(max_length=200,null=True,blank=True)
def __str__(self):
re... |
987,972 | 60ca389028e84c41a83fe1e1a5ee0cf8ab1a149c | from sys import stdin, stdout
def solve(s, p, totals):
count = 0
for total in totals:
subs = False
for i in range(11):
good = False
for diff in [-2, -1, 0, 1, 2]:
j = i + diff
k = total - (i + j)
if k >= 0 and k <= 10 and ... |
987,973 | 11495ddbc466e5bcc9fa1693abf256c86a9981d8 | import numpy as np
from matplotlib import pyplot as plt
import random
import sys
def processFile(filename, cat, sup_output = False, verbose = False):
if verbose:
print("filename",filename)
images = np.load(filename)
number_of_exp = images.shape[0]
if not sup_output:
print('Number of',cat,'images: ', number_of_... |
987,974 | 86094677eedbbd5b214df98462d2ffc7823afd5f | #!/usr/bin/env python3
"""
Obsolete: script that assigns clades to sequences based on clade designations in `defaults/clades.tsv`
"""
import numpy as np
import argparse, sys, os
from Bio import AlignIO, SeqIO, Seq, SeqRecord
from Bio.AlignIO import MultipleSeqAlignment
from augur.translate import safe_translate
from au... |
987,975 | 7c951bb9f97d3862664c63641a9d3b664e10f73c | # -*- coding: utf-8 -*-
import json
class OCSSSearchRunner:
"""
This runner should perform searches from ocss search logfile against elastic
"""
# define search data
search_data = []
def initialize(self, params):
# check given parameter
if "index" in params and type(params["... |
987,976 | d8b19aac459c94d33cc7d53dc36cc5f6398c0068 | Python 3.4.0 (default, Apr 11 2014, 13:05:18)
[GCC 4.8.2] on linux
Type "copyright", "credits" or "license()" for more information.
>>> def func(x):
if x%3==0:
print(x,"is odd")
>>> func(9)
9 is odd
>>> def func(x):
if x%2==0:
print(x,"iseven")
else:
print(x,"is odd")
>>> func(9)
9 is odd
>>> func(4)
... |
987,977 | dbec6cc718a939cc52bcaf6b01b8a2649491e51c | # This script tests the corpusreader
# Useage: python test_corpusreader.py > test_corpusreader_output.txt
# The results will be printed to test_corpusreader_output.txt
import sys
import os
sys.path.append(os.path.join(os.path.dirname(__file__), '../..'))
import pprint
from ml_ner.corpus.corpusreader import CorpusRea... |
987,978 | f074e30cb07a661408f87eeb9492800bda6240cd | from rest_framework.response import Response
from rest_framework.decorators import api_view
from graphs.v2.serializers import *
from datetime import datetime
import queries
mock_data = {
'process_type': 17,
'start': '2018-01-01-08-00-00-000000',
'end': '2018-01-31-08-00-00-000000',
}
@api_view(['GET'])
def product... |
987,979 | 2ba4f85c1af458025af9b38a1422d7e6be09b1c6 | #Chapter 20.17
# INSERTION OF A NODE IN A DOUBLY LINKED LIST
class dnode: # node class
def __init__(self):
self.data = 0
self.left = None
self.right = None
def insert(p, q, n): # inser nodes
if(p == None):
p = dnode()
if(p == None):
print("Error")
... |
987,980 | 0bdd75bbdedf6eea57836fa1677223084779aa86 | #!/usr/bin/env python
import hackercodecs
from pwn import *
def str_or(a, b):
ret = ''
for i, j in zip(a, b):
ret += chr(ord(i) | ord(j))
return ret
red = open('red').read().strip().replace('\n', '').decode('bin')
green = open('green').read().strip().replace('\n', '').decode('bin')
blue = open('blue').read().st... |
987,981 | 7b3415185339f8b69492c29e050d01dc2e76ef47 | #!/usr/bin/env python3
'''Simple HTTP Server With Upload.
This module builds on BaseHTTPServer by implementing the standard GET
and HEAD requests in a fairly straightforward manner.
see: https://gist.github.com/UniIsland/3346170
'''
__version__ = "0.1"
__all__ = ["simple-py3httpd"]
__author__ = "woody"
__home_p... |
987,982 | 1d7eed1a7493155ce39afaff7d141c89a3199fd1 | import os
import cv2
import math
import logging
import datetime
import pandas as pd
from PIL import Image
import LPIPS as models
import matlab.engine
import torch
import argparse
from tqdm import tqdm
from logging import handlers
import numpy as np
import yaml
class Logger(object):
level_relations = {
'de... |
987,983 | f2d7df228cca9f4a1b479ff38447cd2b57d51425 | # -*- coding: utf-8 -*-
# @Time : 2018/2/22 9:58
# @Author : Yeh
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
import sys
class Solution:
maxValue=-100000
def maxPathSum(self, root):
... |
987,984 | 801ab63283f2c5ef1f14b15e714374310b722cee | # Generated by Django 3.0.7 on 2020-11-10 16:56
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('test2', '0005_remove_activities_email'),
]
operations = [
migrations.AddField(
model_name='acti... |
987,985 | f436b689f7512711ac1303b077ddaf55441e6700 | import requests
from bs4 import BeautifulSoup
import re
response = requests.get('https://ja.wikipedia.org/wiki/%E6%97%A5%E6%9C%AC%E3%81%AE%E8%A6%B3%E5%85%89%E5%9C%B0%E4%B8%80%E8%A6%A7')
soup = BeautifulSoup(response.text, 'html.parser')
data = soup.find_all('a', href=re.compile('/wiki/.*'))
data_arr = [i.get_text() fo... |
987,986 | f35cb7107d30b6163bc3e14278d6cfb3d502da34 |
import re
# constants
re_reply = re.compile(
r'@(\w+)'
)
re_url = re.compile(
r'(?<!"|\()((https?|ftp|gopher|file)://(\w|\.|/|\(|\)|\?|=|%|&|:|#|_|-|~|\+)+)'
)
re_anchor = re.compile(
r'(<\s*a[^<>]*)(>(?!(https?|ftp|gopher|file)://... |
987,987 | 0f380450ebd44f4acc35abdbe7aa4114bc9343af | from hello import greeting
greeting("do something else")
|
987,988 | acd9a7fbef77c153777fae9b5a7aacd2da58b686 | # Generated by Django 2.2 on 2020-09-22 12:50
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
opera... |
987,989 | e4005b1fb09ee2a5d58da2bab8a09a94cad080b5 | """
Benchmark evaluating evy's performance at speaking to itself over a localhost socket.
Profiling and graphs
====================
You can profile this program and obtain a call graph with `gprof2dot` and `graphviz`:
```
python -m cProfile -o output.pstats path/to/this/script arg1 arg2
gprof2dot.py -f pstats out... |
987,990 | 5ddb0695019cef62d8f2b01a87bafaa702dcd970 | import json
import requests
import os
from pathlib import Path
def get_rdap_info(ip_address, force_update_cache=False):
"""
Gets rdap information about from ip address
https://rdap.arin.net
"""
print('Retrieving RDAP from', ip_address)
rdap_info = None
if not force_update_cache:
r... |
987,991 | 30205067d345bb02f2b8fd202c3e09a7e84e6cdc | # '''functions'''
# #Question 1: Take two number print and return sum
# #Question 2: Extend Question 1 by passing an arbitary amount of ints.
# def sum_numbers(a,b,*numbers):
# sum = a + b
# for number in numbers:
# sum += number
# return sum
# sum = sum_numbers(1,1,1,1)
# print(sum)
# #Question ... |
987,992 | a37278f117e17c92b6a675c8ac22faf90edebc05 |
def test_list_customers(app):
response = app.get('/customers', params={"skip": 0, "limit": 10})
assert response.status_code == 200
customers = response.json()
assert len(customers) == 10
assert customers[0] == {
"id": 1,
"first_name": "MARY",
"last_name": "SMITH",
}
... |
987,993 | d0949798e40b1fee964a3bb87bfbb34728a8e262 | # standard library
import sys
import argparse
# third-party
pass
# local
import rsync_system_backup
if not len(sys.argv) > 1:
print("WARNING: you didn't specify any arguments, therefore appending --help..")
sys.argv.append("--help")
from rsync_system_backup.cli import *
main() |
987,994 | 95aab1716b7b227092ef2cbab42af21242865c3b | import os
SECRET_KEY = os.urandom(32)
APP_DIR = os.path.dirname(os.path.realpath(__file__))
DEBUG = True
SQL_LOGGING = False
DATABASE_PATH = os.path.join(
os.environ.get('DATABASE_DIR', APP_DIR), 'patch_server.db')
if os.name == 'nt':
SQLALCHEMY_DATABASE_URI = r'sqlite:///{}' .format(DATABASE_PATH)
APP... |
987,995 | 3147e9c63958abb21cc698b285959de3d0216610 | import csv
import sys
username = input('Enter username: ').strip()
password = input('Enter password: ').strip()
user_present = False
fail_msg = 'User Not Found'
if len(username) == 0 or len(password) == 0:
print('Enter valid credentials!')
sys.exit()
try:
with open('users.csv', mode='r') as file:
... |
987,996 | 6f5abd237c95b6590f222c0e5c2dbaf1c7243e99 | #No method is needed to iterate over a dictionary:
d = {'A': 'Apple', 'B': 'Ball', 'C': 'Cat'}
for Key in d:
print(Key)
#But it's possible to use the method iterkeys():
for key in d.iterkeys():
print(key)
#The method itervalues() is a convenient way for iterating directly over the values:
f... |
987,997 | 503450aaa6cf25bc62f0603a4226955a14577716 | total=0
for number in [1,2,3,4,5,6,7,8,9,10]:
num=input("Enter #" + str(number) +": ")
total = float(total) + num
if number == 1:
high = num
if num > high:
high = num
average = total / 10.0
print
print " Total =", int(total)
print "Average =", average
print "Largest =", hi... |
987,998 | 7df400f36e824c87427ad2fd60e5542132565fc4 | import numpy as np
import astropy
from astropy.io import fits
import matplotlib
import matplotlib.pyplot as plt
#from astropy.nddata import NDData
from astropy.nddata import CCDData
import ccdproc
import astropy.units as u
from astropy.modeling import models
from ccdproc import Combiner
import os
import mycode
import m... |
987,999 | 0c7efeefb6581f8f073cd689723d8757ae4a7a9d | from django.conf import settings
from django.conf.urls import url
from django.contrib import admin
from django.urls import include, path
from rest_framework_jwt.views import refresh_jwt_token, obtain_jwt_token
from .routers import urlpatterns as api_urlpatterns
from rest_framework import permissions
urlpatterns = [
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.