index int64 0 1,000k | blob_id stringlengths 40 40 | code stringlengths 7 10.4M |
|---|---|---|
9,500 | 8dfea24545ec4bb95b66d4b5ff3c4936990eb73a | """
Plugin for ResolveUrl
Copyright (C) 2022 shellc0de
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
... |
9,501 | 8e28135da60f8e11459697c4ae9c63e60c437d7a | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri May 24 18:46:26 2019
@author: kiran
"""
import matplotlib.pylab as plt
import pandas as pd
import numpy as np
import statsmodels as sm
from statsmodels.graphics.tsaplots import plot_acf, plot_pacf
from statsmodels.tsa.stattools import acf, pacf
from stat... |
9,502 | 7cf6a4b8057280b38572dd92693013724751c47f | import numpy as np
import cv2
print("read imafe from file" )
img = cv2.imread("panda.jpg")
print("create a window holder for the image")
cv2.namedWindow("Image",cv2.WINDOW_NORMAL)
print ('display the image ')
cv2.imshow("Image",img)
print ('press a key inside the image to make a copy')
cv2.waitKey(0)
|
9,503 | 22f4ae755e7ea43604db39452ca80f44f540708a | import pandas as pd
dict_data = {'c0': [1, 2, 3], 'c1': [4, 5, 6], 'c2': [
7, 8, 9], 'c3': [10, 11, 12], 'c4': [13, 14, 15]}
df = pd.DataFrame(dict_data)
print(type(df))
print('\n')
print(df)
# <class 'pandas.core.frame.DataFrame'>
# c0 c1 c2 c3 c4
# 0 1 4 7 10 13
# 1 2 5 8 11 14
# 2 ... |
9,504 | 38ffbb6a66837e975a611a57579bb365ab69a32c | """
\tSeja bem-vindo ao Admirável Mundo Novo!
\tO objetivo do jogo é dar suporte ao desenvolvimento de Agentes Inteligentes que utilizam Deep Reinforcement Learning
\tpara tarefas de Processamento de Linguagem Natural em língua portuguesa.
\tAutor: Gabriel Pontes (@ograndoptimist)
"""
import random
fr... |
9,505 | 6e845f2543b548fb936cc3719eb150e530281945 | stevila = [5, 2, 8, 3]
#Izpis vseh števil
print(stevila)
#Izpis števila na mestu 1
print(stevila[1]) |
9,506 | e81294c984497dbba9fa345b61abb8d781f136bf | #######################
# PYMERGE V.1.1 #
#######################
# Samuel Farrens 2014 #
#######################
"""@file pycatcut.v.1.1
@brief Code that merges cluster catalogues into a single catalogue.
@author Samuel Farrens
"""
import math, optparse, numpy as np
import errors
from classes.cluster import Cl... |
9,507 | 00fd5efa4c66b7bd4617f4c886eddcdf38b951b7 | print ("Hello, Django girls!")
volume = 57
if volume < 20:
print("It's kinda quiet.")
elif 20 <= volume < 40:
print("It's nice for background music")
elif 40 <= volume < 60:
print("Perfect, I can hear all the details")
elif 60 <= volume < 80:
print("Nice for parties")
elif 80 <= volume < 100:
print... |
9,508 | 8cb7290792f9390dd350e0c79711e0dd72d6063b | a=range(1,11) #1~10숫자를 에이에 저장
b=1
for i in a: #a에있는 원소를 b에 곱하고 비에 저장
b*=i
print(b)
|
9,509 | c2490c3aacfa3ce22c3f47a69dbc44b695c2a2e5 | # -*- coding:utf-8 -*-
from __future__ import unicode_literals
from django.db import models
SERVICE_RANGE_CHOISE = {(1, '1年'), (2, '2年'), (3, '3年'), (4, '4年'), (5, '5年'), (6, '6年'), (7, '7年'), (8, '8年'), (0, '长期')}
USER_STATUS_CHOISE = {(1, '停用'), (2, '正常'), (3, '锁定')}
DBSERVER_POS_CHOISE = {(1, '8层机房'), (2, '11层机房')... |
9,510 | c3a7a8a006f717057a7ad2920f19d82842b04a85 | import cv2
import numpy as np
import matplotlib.pyplot as plt
'''
def diff_of_gaussians(img):
grey_img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
blur_img_grey = cv2.GaussianBlur(grey_img, (9,9), 0)
blur_img_colour = cv2.GaussianBlur(img, (9,9), 0)
#plt.fig... |
9,511 | 677154aa99a5a4876532f3e1edfec45b1790384c | from flask_marshmallow import Marshmallow
from models import Uservet
ma = Marshmallow()
class UserVetSchema(ma.Schema):
class Meta:
model = Uservet
user_vet_1 = ['dni','email','nombre','apellidos','telefono','tipo_uservet']
|
9,512 | 9db2377f15aaf28373959dad88c6ec7b6dacffd2 | import sys
sys.stdin = open('retire.txt', 'r')
def counseling(pay, row):
global max_sum
if row == N - 1:
if arr[row][0] == 1:
pay += arr[row][1]
max_sum = max(pay, max_sum)
return
if row == N:
max_sum = max(pay, max_sum)
return
if row > N - 1:
... |
9,513 | 2417dd4f3787742832fec53fec4592165d0fccfc | from tensorflow import keras
class SkippableSeq(keras.utils.Sequence):
def __init__(self, seq):
super(SkippableSeq, self).__init__()
self.start = 0
self.seq = seq
def __iter__(self):
return self
def __next__(self):
res = self.seq[self.start]
self.start = (self.start + 1) % len(self)
... |
9,514 | 09792da1c3cc38c7df7def2b487c2078de4e8912 | import config
import psycopg2
from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT
def check_db_exists(opt):
try:
conn = psycopg2.connect(opt)
cur = conn.cursor()
cur.close()
print('Database exists.')
return True
except:
print("Database doesn't exist.")
return False
def create_db(opt):
if check... |
9,515 | 9e43eb3c3ab3be4e695dbc80aa005332b8d8a4ec | from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class StravaAuthConfig(AppConfig):
name = "strava.contrib.strava_django"
verbose_name = _("Strava Auth")
def ready(self):
pass
|
9,516 | 9c320db85ca1a9df6b91f6bb062e4d5c3d94ee91 | from test.framework import TestCase
from test.mock import Mock
from package.util.svnutil import ReleaseXmlParser, Release
import time
class SvnUtilTests(TestCase):
def setUp(self):
r1 = Release()
r1.name = 'BETA1.1.0'
r1.type = 'BETA'
r1.version = '1.1.0'
r1.date = time.strp... |
9,517 | c5f46be6d7214614892d227c76c75e77433a8fa9 | from CTO import CTO
#from UI import UIManager
from Cidades import Cidades
from Database import Database
from datetime import datetime
class Main:
def __init__(self, cidade_filename="", dados_filename=""):
#cidade_filename, dados_filename = UIManager().get_filenames()
print("cidade: " + cidade_fil... |
9,518 | 2d192963bfe046bce1a0c82e0179380693f5c541 | from tkinter import *
root = Tk()
photo = PhotoImage(file = 'flag.png')
panel = Label(root, image=photo)
panel.pack()
root.mainloop()
|
9,519 | 020691fe2c7e7092d45415b72ce1804618421a2a | """
Question:
You are given a string s consisting only of digits 0-9, commas ,, and dots .
Your task is to complete the regex_pattern defined below, which will be used to
re.split() all of the , and . symbols in s.
It’s guaranteed that every comma and every dot in s is preceded and followed
by a digit.
Sample Input... |
9,520 | 625a5d14aaf37493c3f75ec0cdce77d45ca08f78 | #Packages to be imported
import requests
import pandas as pd
from geopy.distance import distance
import json
from datetime import date
from datetime import datetime
import time
#POST request to get authentication token
URL = "https://api.birdapp.com/user/login"
email = {"email": "himanshu.agarwal20792@gmail.com"}
head... |
9,521 | f66306908f1fdd5c662804e73596b445c66dc176 | # -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://docs.scrapy.org/en/latest/topics/item-pipeline.html
from sqlalchemy.orm.session import sessionmaker, query
from FoodPandaStore.FoodPandaStore.model import *
import datetime as ... |
9,522 | 02e40e051c19116c9cb3a903e738232dc8f5d026 |
from BeautifulSoup import BeautifulSoup, NavigableString
from urllib2 import urlopen
from time import ctime
import sys
import os
import re
restaurants = ["http://finweb.rit.edu/diningservices/brickcity",
"http://finweb.rit.edu/diningservices/commons",
"http://finweb.rit.edu/diningservices/crossroads",
"http://finweb.r... |
9,523 | d3b0a1d8b9f800c5d34732f4701ea2183405e5b4 | # -*- coding: utf-8 -*-
"""
Created on Fri Jul 3 18:27:30 2020
@author: PREET MODH
"""
for _ in range(int(input())):
n=int(input())
xco,yco=[],[]
flagx,flagy,xans,yans=1,1,0,0
for x in range(4*n-1):
x,y=input().split()
xco.append(int(x))
yco.append(int(y))
... |
9,524 | f327f408ae2759407ac9f01ad4feff5c6a0845f1 | #Function to remove spaces in a string
def remove(string_input):
return string_input.replace(" ", "")
|
9,525 | 3b8c4f19e28e54e651862ec9b88b091c9faff02b | import urllib.request, urllib.parse, urllib.error
from urllib.request import urlopen
import xml.etree.ElementTree as ET
import ssl
# # Ignore SSL certificate errors
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
url = input('Enter a URL: ')
# if len(url) < 1 : url = 'ht... |
9,526 | 0c283cd31203291da24226a0eae781bd397e84d4 | '''
Generate a ten-character alphanumeric password with at least one lowercase,
at least one uppercase character, and at least three digits
'''
import secrets
import string
alphabets = string.ascii_letters + string.digits
while True:
password = "".join(secrets.choice(alphabets) for i in range(10))
if(a... |
9,527 | 0ebd19079a16a6e3da34da2ecfda0d159b8580b2 | #!/usr/bin/python
#
# @name = 'fmsrutil.py'
#
# @description = "F-MSR utilities module."
#
# @author = ['YU Chiu Man', 'HU Yuchong', 'TANG Yang']
#
import sys
import os
import random
from finitefield import GF256int
from coeffvector import CoeffVector
from coeffvector import CoeffMatrix
import common
#Check if C l... |
9,528 | 65ea27851d9db0f0a06d42bd37eff633d22a1548 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-01-30 14:50
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('books', '0007_auto_20170127_2254'),
]
operations = [
migrations.AlterField(... |
9,529 | aac334256c1e05ef33a54da19925911af6645a10 | from django.urls import path
from .authentication import GetToken, RegisterUserAPIView
from .resurses import *
urlpatterns = [
path('register/', RegisterUserAPIView.as_view()),
path('get/token/', GetToken.as_view()),
path('card/list/', ShowCardsAPIView.as_view()),
path('card/create/', CreateCardAPIVie... |
9,530 | 8a0c0f5ca6a965e07f59a6c88d4dd335310cbdfc | import text
nan=""
section_words = {'start': -1, '1.1': 17, '1.2': 38, '1.3': 55, '1.4': 76, '1.5': 95, '1.6': 114, '1.7': 133, '1.8': 151, '1.9': 170, '1.10': 190, '1.11': 209, '1.12': 233, '1.13': 257, '1.14': 277, '1.15': 299, '1.16': 320, '1.17': 341, '1.18': 364, '1.19': 385, '1.20': 405, '1.21': 428, '2.1': 451, ... |
9,531 | 6028b46eab422dea02af24e9cf724fe0d8b3ecc4 | import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.model_selection import GroupKFold
from sklearn.linear_model import LinearRegression
from sklearn.metrics import mean_squared_log_error
from sklearn.preprocessing import OneHotEncoder
from sklearn.linear_model import... |
9,532 | 821afa85eb783b4bf1018800f598a3294c4cbcfb | from django.contrib import admin
# Register your models here.
from registration.models import FbAuth
class AllFieldsAdmin(admin.ModelAdmin):
"""
A model admin that displays all field in admin excpet Many to many and pk field
"""
def __init__(self, model, admin_site):
self.list_display = [fi... |
9,533 | 15e0b396a4726f98ce5ae2620338d7d48985707e | try:
fh = open("testfile","w")
fh.write("test")
except IOError:
print("Error:没有找到文件")
else:
print("sucess")
fh.close()
|
9,534 | 60079005c2091d2dc0b76fb71739671873f0e0f1 | import threading
import time
g_num = 0
def work1(num):
global g_num
for i in range(num):
g_num += 1
print("__in work1: g_num is {}".format(g_num))
def work2(num):
global g_num
for i in range(num):
g_num += 1
print("__in work2: g_num is {}".format(g_num))
def main():
... |
9,535 | ff7cb8261f3abb70599725fe7c598c571d037226 | ## 허프변환에 의한 직선 검출
# cv2.HoughLines(image, rho, theta, threshold, lines=None, srn=None, stn=None, min-theta=None, max-theta=None) => lines
# image : 에지 입력 영상(Canny 연산을 이용한 에지 영상)
# rho(로우) : 축적 배열에서 rho 값의 간격(보통 1.0 사용)
# theta(세타) : 축적 배열에서 theta 값의 간격(보통 np.pi/180)
# rho, theta 값이 커지면 축적배열의 크기는 작아지고, 값이 작으면 축적배... |
9,536 | 00429a16ac009f6f706ef11bc29b0aec77b9ebe6 | import pandas as pd
iris_nan = pd.read_csv("MLData/iris_nan.csv")
iris_nan.head()
Y = iris_nan["class"].values
X = iris_nan.drop("class", axis=1)
# Our iris dataframe presents some NaN values, and we need to fix that.
# We got some methods to apply on a pandas dataframe:
# 1: Drop records presenting a NaN value: We... |
9,537 | c60b8eec57d845c73ee3e00432747d23748c1706 | import tensorflow as tf
def Float32():
return tf.float32
def Float16():
return tf.float16 |
9,538 | 8de6877f040a7234da73b55c8b7fdefe20bc0d6e | import pandas as pd
df = pd.read_csv('~/Documents/data/tables.csv')
mdfile = open('tables_with_refs.md', 'w')
mdfile.write('# Tables with references\n')
for i, row in df.iterrows():
t = '\n```\n{% raw %}\n' + str(row['table']) + '\n{% endraw %}\n```\n'
r = '\n```\n{% raw %}\n' + str(row['refs']) + '\n{% end... |
9,539 | 8559448822b3d3989a9795e7b497a2791588c327 | f = open("resources/yesterday.txt", 'r')
yesterday_lyric = ""
while 1 :
line = f.readline()
if not line :
break
yesterday_lyric = yesterday_lyric + line.strip() + "\n"
f.close()
# 대소문자 구분없이 yesterday 단어의 개수 세기 : 대문자로 또는 소문자로 만들고 카운드 세기
num_of_yesterday = yesterday_lyric.upper().count("YESTERDAY")
... |
9,540 | d7b91b0476a1f2e00408ce1f1501bf98d4c06e4e | # -*- coding: utf-8 -*-
# @Author: Marcela Campo
# @Date: 2016-05-06 18:56:47
# @Last Modified by: Marcela Campo
# @Last Modified time: 2016-05-06 19:03:21
import os
from flask.ext.script import Manager
from flask.ext.migrate import Migrate, MigrateCommand
from server import app, db
app.config.from_object('confi... |
9,541 | 33daf5753b27f6b4bcb7c98e28cf2168e7f0b403 |
#calss header
class _WATERWAYS():
def __init__(self,):
self.name = "WATERWAYS"
self.definitions = waterway
self.parents = []
self.childen = []
self.properties = []
self.jsondata = {}
self.basic = ['waterway']
|
9,542 | 73cacc1317c8624b45c017144bc7449bc99bd045 | import torch
from torchelie.data_learning import *
def test_pixel_image():
pi = PixelImage((1, 3, 128, 128), 0.01)
pi()
start = torch.randn(3, 128, 128)
pi = PixelImage((1, 3, 128, 128), init_img=start)
assert start.allclose(pi() + 0.5, atol=1e-7)
def test_spectral_image():
pi = SpectralIm... |
9,543 | 9cb734f67d5149b052ff1d412d446aea1654fa69 | import uuid
from cqlengine import columns
from cqlengine.models import Model
from datetime import datetime as dt
class MBase(Model):
__abstract__ = True
#__keyspace__ = model_keyspace
class Post(MBase):
id = columns.BigInt(index=True, primary_key=True)
user_id = columns.Integer(required=True, index=... |
9,544 | 38c1b82a29a5ad0b4581e63fb083ca2487a79817 | #Created by Jake Hansen for Zebra interview take home assessment, July 2020.
import csv, os, sys, pickle
from datetime import date
#Class For storing information about each file generally. Helpful for future
#use cases to remember the indicies from a file, if file has thousands of fields
#Also can be used as a log to ... |
9,545 | c8ab53c77ff3646a30ca49eaafc275afeadd2ca6 | from __future__ import division # floating point division
import csv
import random
import math
import numpy as np
import dataloader as dtl
import classalgorithms as algs
def getaccuracy(ytest, predictions):
correct = 0
for i in range(len(ytest)):
if ytest[i] == predictions[i]:
correct ... |
9,546 | 08568c31e5a404957c11eca9cbc9472c71cf088b | import os
import re
import logging
import time
from string import replace
from settings import *
import wsgiref.handlers
from google.appengine.ext import webapp
from google.appengine.ext.webapp import template
from modules.xml2dict import *
from modules import kayak
from modules.messaging import *
from modules.cron im... |
9,547 | 87e0b9dc518d439f71e261d5c5047153324919ba | # Generated by Django 2.0.2 on 2018-06-10 18:24
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Expression',
fields=[
... |
9,548 | 4dcc0261abdb783c60471736567faf7db8b56190 | from model.area import AreaModel
from flask_restful import Resource, reqparse
from flask_jwt import jwt_required
class Area(Resource):
pareser = reqparse.RequestParser()
pareser.add_argument('name',
type = str,
required = True,
help = 'Area name is required')
@jwt_required()
def get(self,... |
9,549 | 6bd9c8e38373e696193c146b88ebf6601170cf0e | from django.urls import reverse_lazy
from django.views.generic import CreateView, edit, ListView
from django.shortcuts import render
from django.contrib.auth import authenticate, login
from users.forms import CustomUserCreationForm, LoginForm
from users.models import CustomUser as Users
class SignUpView(CreateView):... |
9,550 | a3f6ea649fc5e60b0f8353b1404912d060686b99 | # 10.13.20 - sjg
# Exercise 15 - solution A
# Write a function called greatestCommomFactor that,
#given two distinct positive integers,
#returns the greatest common factor of those two values
#Input: greatestCommonFactor(9,12)
#Output: 3
#Input: greatestCommonFactor(6,18)
#Output: 6
#Input: greatestCommonFactor(11... |
9,551 | 00e8e0b5aeccd2a67f6cfdad63012a0d8b066e6f | from django.shortcuts import render
from django.template import loader
# Create your views here.
from django.http import HttpResponse
from .models import Student
def index(request):
student_objects = Student.objects.all()
context = {"students": student_objects}
return render(request, 'student_list.html', context... |
9,552 | 0bf970a84911d29a8343575ef15f2765875b8b89 | from graphics import *
from random import random
def printIntro():
print("This program evaluates pi via Monte Carlo techniques")
def simDarts(n):
win = GraphWin("", 400, 400)
win.setCoords(-1.2, -1.2, 1.2, 1.2)
hits = 0
for i in range(n):
pt = getDarts()
if hitTarget(pt):
... |
9,553 | 42f021c728a88f34d09f94ea96d91abded8a29fb | # Generated by Django 3.2.6 on 2021-08-19 16:17
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('crm', '0040_auto_20210819_1913'),
]
operations = [
migrations.RemoveField(
model_name='customer',
name='full_name',
... |
9,554 | 5718eab8c5fac4cb7bfa1b049b63ca1e30610247 | L = [
[
"0",
"0",
"00"
],[
"..0",
"000"
],[
"00",
".0",
".0"
], [
"000",
"0"
]
]
J = [
[
".0",
".0",
"00"
],[
"0..",
"000"
],[
"00",
"0",
"0"... |
9,555 | eba8e2bda786760898c10d3e75620144973d6236 | class FixtureBittrex:
PING = {"serverTime": 1582535502000}
MARKETS = [
{
"symbol": "ETH-BTC", "baseCurrencySymbol": "ETH", "quoteCurrencySymbol": "BTC",
"minTradeSize": "0.01314872", "precision": 8,
"status": "ONLINE", "createdAt": "2015-08-14T09:02:24.817Z"},
... |
9,556 | 67b483d9d002cc66dd368cf53fdc49ebb7b4f4d4 | # type: ignore[no-redef]
import pytest
@pytest.mark.asyncio
@pytest.mark.core
async def test_async_executor(executor):
def func():
pass
result = await executor.run(func)
assert result is None
def func():
return 1
result = await executor.run(func)
assert result == 1
def ... |
9,557 | 62094d036596f39e7cf936fe7a91e67d53ee055e | from flask import (
Flask,
render_template,
request
)
import requests
app = Flask(__name__)
base_url = "https://api.github.com/users/"
@app.route("/", methods = ["GET", "POST"])
def index():
if request.method == "POST":
githubName = request.form.get("githubname")
responseUser = request... |
9,558 | ce65a672cae26bdb8ec8cb04eabfe1877f9cd7d4 | #!/usr/bin/env python
# coding: utf-8
from sklearn.metrics import confusion_matrix
import numpy as np
import pandas as pd
df = pd.read_csv('orb.csv')
d = pd.pivot_table(df,index='col1',columns='col2',values='result')
d.fillna(0,inplace=True)
|
9,559 | 8fa58791aae1352109b3bf7410d68bf5ae1d8cb7 | # coding: utf-8
"""
Styled object
=============
A :class:`~benker.styled.Styled` object contains a dictionary of styles.
It is mainly used for :class:`~benker.table.Table`, :class:`~benker.table.RowView`,
:class:`~benker.table.ColView`, and :class:`~benker.cell.Cell`.
"""
import pprint
class Styled(object):
""... |
9,560 | 53909b750f259b67b061ba26d604e0c2556376df | ###############################################################################
# #
# This program is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by ... |
9,561 | fd2b60de2ef540264855f04e1c5bcb9d1cf23c51 | """Changed Views table name
Revision ID: 7f559bb24ca4
Revises: cc927fe47c8f
Create Date: 2021-08-20 23:20:31.959984
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "7f559bb24ca4"
down_revision = "cc927fe47c8f"
branch_labels = None
depends_on = None
def upgrade... |
9,562 | cac49a9a2cb753bb81c45ac1d2d887b1f48dd9bb | from Tkinter import *
import time
def create_window():
window = Toplevel(root)
w, h = root.winfo_screenwidth(), root.winfo_screenheight()
canvas = Canvas(window,width=w,height=h)
canvas.create_text(w/2,h/2,text="this will close after 3 seconds",font="Arial")
canvas.pack()
window.overrideredirec... |
9,563 | 91188b55b0f5d8277812d82711f5bcde82819b30 | import datetime, time, threading, os
from . import queues
logLevels = ["none", "info", "debug"]
level = "none"
def write(message):
queues.logger_queue.put(message)
def runLogger():
while True:
# The log path should be read from config. Pass into logger?
log_path = "/home/pi/Desktop/Projects/r... |
9,564 | 0e0e51904f05b41b4769b730c836568b8bb63869 | #Sorting for a number list
#ascending and descending
ls=[1,34,23,56,34,67,87,54,62,31,66]
ls.sort(reverse=True)
print(ls)
ls.sort()
print(ls)
#Sorting a letter's list with different scenarios
ls_l=["aaa","ertdf","ieurtff","fnjr","resdjx","jfh","r","fd"]
#1-sort according to string length from small length to bigger
ls... |
9,565 | 7b38c64174656d1c4ec2b0541e6ed8d6680af7d7 | '''
we have source files with a certain format and each file has 200 columns and there is a process that takes the source
files and loads into hbase and moves it into sql data warehouse. We have to create automated test scripts that compares
with with is with hbase and sql data warehouse. load into hbase and query the ... |
9,566 | 857e3e04b99cb346fd89b34c0d14957d65b7ac38 | #公路工程工程量清单编码默认格式母节点为数字型式,子节点为-b字母形式,为使编码唯一便于数据处理,编制此脚本
import re
import pandas as pd
import os
def get_csv_path():#原编码保存为csv文件的一列,便于读取
path=input('enter csv path:')
if os.path.isfile(path):
return path
else:
print('csv file not exsit,try again:')
return get_csv_path()
def unique_code... |
9,567 | 84d0c439fcee4339250ced11dd2264740cc20d9c | import ply.lex as lex
print("hello word!")
|
9,568 | 797cedc9dc2a47713b9554e4f5975a4505ecf6d3 | #!/usr/bin/env python3
# encoding: utf-8
"""
@version: ??
@author: ami
@license: Apache Licence
@file: dictTest.py
@time: 2019/9/25 18:26
@tools: PyCharm
"""
def func():
pass
class Main():
def __init__(self):
pass
if __name__ == '__main__':
pass
d = {'name': 'Bob', ... |
9,569 | cc985ae061c04696dbf5114273befd62321756ae | __title__ = 'pyaddepar'
__version__ = '0.6.0'
__author__ = 'Thomas Schmelzer'
__license__ = 'MIT'
__copyright__ = 'Copyright 2019 by Lobnek Wealth Management' |
9,570 | 79ff164c36cc5f0a2382a571ec183952a03e66cc | import csv
import hashdate as hd
with open('Grainger_Library.csv', newline='') as f:
reader = csv.reader(f)
data = list(reader)
del data[0]
gld = []
glo = []
data.sort(key=lambda x:x[1])
for i in range(0,len(data)):
gld.append((data[i][1],data[i][2]))
print('ahd:')
#print(ahd)
glh = hd.hashdate(365,2020... |
9,571 | 7ca88d451ad702e5a8e532da3e3f5939cfaa7215 | import argparse
import subprocess
import os
def get_files(dir_path, ext='.png'):
relative_paths = os.listdir(dir_path)
relative_paths = list(filter(lambda fp: ext in fp, relative_paths))
return list(map(lambda rel_p: os.path.join(dir_path, rel_p), relative_paths))
def ipfs_add_local(file_path):
'Ret... |
9,572 | d4625dd743dd6648044e40b02743ae80f4caea36 | import argparse
import datetime
import json
import os
import sys
import hail as hl
from .utils import run_all, run_pattern, run_list, RunConfig
from .. import init_logging
def main(args):
init_logging()
records = []
def handler(stats):
records.append(stats)
data_dir = args.data_dir or os.... |
9,573 | 8d8f1f0dbb76b5c536bd1a2142bb61c51dd75075 | import pandas as pd
import numpy as np
df = pd.DataFrame([['Hospital1', '2019-10-01'],
['Hospital2', '2019-10-01'],
['Hospital3', '2019-10-01'],
['Hospital1', '2019-10-01'],
['Hospital2', '2019-10-02'],
['Hospital3',... |
9,574 | 4f1956b34ac3b55b2d40220b79816c139b4a2f5c | import setuptools
setuptools.setup(
name='cppersist',
install_requires=['Eve']
)
|
9,575 | 8adcd75e925fe0c5a50b2fc7dc8c472a9610b4f2 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2017--2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You may not
# use this file except in compliance with the License. A copy of the License
# is located at
#
# http://aws.... |
9,576 | 763e2db4eb9ad5953273fb310c8e9714964a39e6 | from flask import Blueprint, request, render_template, session, redirect
log = Blueprint('login', __name__, )
@log.route('/login', methods=['GET', 'POST'])
def login():
print(request.path, )
if request.method == 'GET':
return render_template('exec/login.html')
else:
username = request.for... |
9,577 | 759b440bf436afbfb081cf55eeb4a0f075ed3e6d | ulang = 'y'
while True :
a = int(input ("masukkan nilai = "))
if a > 60 :
status = "LULUS"
elif a <= 60 :
status = "TIDAK LULUS"
print(status)
ulang = input("apakah anda ingin mengulang? y/n = ") |
9,578 | 5616ec135a2233e742ff3b2b1f378ec12298b935 | from flask_restful import Resource, reqparse
import sqlite3
from flask_jwt import jwt_required
from models.item_model import ItemModel
from flask_sqlalchemy import SQLAlchemy
from d import db
from models.store_model import StoreModel
class Modell(Resource):
def get(self, name):
item = Store... |
9,579 | d806d1b31712e3d8d60f4bfbc60c6939dfeeb357 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 16 20:47:28 2019
@author: jaco
"""
|
9,580 | ccf3ada9a2bedf29820170f2e8184fc16f1b7aea | #
# @lc app=leetcode.cn id=15 lang=python3
#
# [15] 三数之和
#
# https://leetcode-cn.com/problems/3sum/description/
#
# algorithms
# Medium (25.76%)
# Likes: 1904
# Dislikes: 0
# Total Accepted: 176.6K
# Total Submissions: 679K
# Testcase Example: '[-1,0,1,2,-1,-4]'
#
# 给你一个包含 n 个整数的数组 nums,判断 nums 中是否存在三个元素 a,b,c ,... |
9,581 | a22bc3bdb5e35060eff7f523b90d605ff2dd3878 | import requests
import datetime
import time
from tqdm import tqdm
import json
import logging
logging.basicConfig(filename='logo.log', level=logging.DEBUG, filemode='w')
logging.debug('debug message')
logging.info('info message')
# from pprint import pprint
id_vk = input('введите id пользователя вк: ')
token_vk = input... |
9,582 | ea4ec2e605ab6e8734f7631fe298c93467908b5f | import json
import decimal
import threading
import websocket
from time import sleep
from supervisor.core.utils.math import to_nearest
def find_item_by_keys(keys, table, match_data):
for item in table:
matched = True
for key in keys:
if item[key] != match_data[key]:
matc... |
9,583 | c7037b6a576374f211580b304f8447349bbbbea3 | #!/usr/bin/python
# -*- coding: latin-1 -*-
from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
def index():
return render_template('index.html', titre="Ludovic DELSOL - Portfolio")
@app.route('/etude')
def etude():
return render_template('etude.html', titre="Portfolio Ludovic DEL... |
9,584 | 7f7d087b7001cd7df01d4f22e056809be5a35568 | # 使用celery
from django.conf import settings
from django.core.mail import send_mail
from django.template import loader,RequestContext
from celery import Celery
import time
# 在任务处理者一
#
# 端加的代码
import os
import django
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "dailyfresh.settings")
django.setup()
from goods.models ... |
9,585 | 40a73ceeeb310c490fe2467511966679a1afa92b | #usage: exploit.py
print "-----------------------------------------------------------------------"
print ' [PoC 2] MS Visual Basic Enterprise Ed. 6 SP6 ".dsr" File Handling BoF\n'
print " author: shinnai"
print " mail: shinnai[at]autistici[dot]org"
print " site: http://shinnai.altervista.org\n"
print " Once you create... |
9,586 | f5542cfe6827c352cc6e6da1147e727f2b2d8247 | import pandas as pd
import numpy
dato=pd.read_csv('medallero_Panamericanos_Lima2019.csv')
print(dato)
def calculo_suma():
print("---Funcion con Python---")
print("la sumatoria de los valores: ", dato['Bronce'].sum())
print("---Funcion con Numpy---")
print("la sumatoria de los valores: ", numpy.sum(dat... |
9,587 | eea962d6c519bee802c346fcf8d0c7410e00c30b | h = int(input())
a = int(input())
b = int(input())
c = (h - b + a - b - 1) // (a - b)
print(int(c))
|
9,588 | 11ca13aca699b1e0744243645b3dbcbb0dacdb7e | import random as rnd
import pandas as pd
from sklearn.metrics import accuracy_score
from sklearn.metrics import f1_score
from sklearn.metrics import roc_auc_score
from sklearn.metrics import confusion_matrix
from sklearn.metrics import precision_recall_fscore_support, roc_auc_score
import os
def mkdir_tree(source):
... |
9,589 | 8a3cf65550893367b9001369111fa19a3e998d82 | import oneflow as flow
import torch
def convert_torch_to_flow(model, torch_weight_path, save_path):
parameters = torch.load(torch_weight_path)
new_parameters = dict()
for key, value in parameters.items():
if "num_batches_tracked" not in key:
val = value.detach().cpu().numpy()
ne... |
9,590 | c41388043295280f9354e661a8d38ae46cae2d65 | #for declaring the variables used in program
img_rows=200
img_cols=200
img_channels=1
nb_classes=3
nb_test_images=1
|
9,591 | 1d817ee09705301b574c421a9ff716748c146fdd | import pandas as pd
import re
import sqlite3 as lite
import os
from pybedtools import BedTool
import django
from checkprimers import CheckPrimers
from pandas import ExcelWriter
import datetime
os.environ['DJANGO_SETTINGS_MODULE'] = 'mysite.settings'
django.setup()
class GetPrimers(object):
"""Extracts data from e... |
9,592 | 576d6bec4a91ba6f0597b76a5da5ad3ef6562b19 | import numpy as np
#!pip install pygame
import pygame
#from copy import deepcopy
pygame.init()
#-----------
# Modifications (Matthieu, 15/04):
# Modification de la représentation du terrain du jeu. Il est maintenant représenté par une seule liste.
# un seul identifiant par coupe semble plus simple à gérer qu'un... |
9,593 | 8b009451e9f65ef12e5db1321a9d5347ef7fd756 | # aylat
# This program will calculate an individual's body mass index (BMI),
# based on their height and their weight
# Prompt user to input information
Name = input('Enter your full name: ')
Weight = float(input('Enter your weight in pounds: '))
Height = float(input('Enter your height in inches: '))
# Perform BMI ... |
9,594 | 3c03f71ef9de8825ecd7c89208c79f43c9fb7a56 | """
Python Challenge - Level 1 - What about making trans?
"""
import string
#import requests
#res = requests.get('http://www.pythonchallenge.com/pc/def/map.html')
#res.raise_for_status()
#print(res.text)
INPUT_TEXT = string.ascii_lowercase # abcdefghijklmnopqrstuvwxyz
OUTPUT_TEXT = INPUT_TEXT[2:]+INPUT_TEXT[:2... |
9,595 | 4f674b30c919c7ec72c11a8edd9692c91da7cb90 | import json
import spotipy
import spotipy.util as util
from spotipy.oauth2 import SpotifyClientCredentials
from flask import abort, Flask, flash, redirect, render_template, request, session
from flask_session import Session
from tempfile import mkdtemp
from helpers import login_required
# Configure application
app = ... |
9,596 | 367c3b4da38623e78f2853f9d3464a414ad049c2 | '''
Utility functions to do get frequencies of n-grams
Author: Jesus I. Ramirez Franco
December 2018
'''
import nltk
import pandas as pd
from nltk.stem.snowball import SnowballStemmer
from pycorenlp import StanfordCoreNLP
import math
from nltk.tokenize import RegexpTokenizer
from nltk.corpus import stopwords
import st... |
9,597 | 164167590051fac3f3fd80c5ed82621ba55c4cc4 | from arnold import config
class TestMicrophone:
def setup_method(self, method):
self.config = config.SENSOR['microphone']
def test_config(self):
required_config = [
'card_number', 'device_index', 'sample_rate', 'phrase_time_limit',
'energy_threshold'
]
... |
9,598 | b694c834555843cc31617c944fa873f15be2b9c5 | #
# This source file is part of the EdgeDB open source project.
#
# Copyright 2016-present MagicStack Inc. and the EdgeDB authors.
#
# 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... |
9,599 | 07854dc9e0a863834b8e671d29d5f407cdd1c13e | import requests
import datetime
from yahoo_finance import Share
def getYahooStock(ticker, date1, date2):
companyData = Share(ticker)
dataList = companyData.get_historical(date1, date2)
endData = dataList[0];
startData = dataList[len(dataList) - 1];
print ticker, float(startData['Open']), float(endD... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.