index
int64
0
1,000k
blob_id
stringlengths
40
40
code
stringlengths
7
10.4M
15,800
53574d75c46789ccfdd52b94c19254a63027e5a2
# -*- coding: utf-8 -*- """ Created on Mon Aug 31 10:52:39 2020 @author: evely """ from lifestore_file import lifestore_products from lifestore_file import lifestore_sales from lifestore_file import lifestore_searches print("Welcome to LifeStore Inventory") print("Account Login") users = ["user1", "user2", "user3"...
15,801
943a694b2ee715df0041340ca5e2ab5b34af94c2
# -*- coding: utf-8 -*- # Generated by Django 1.11.3 on 2017-09-19 18:02 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('fiscales', '0001_initial'), ] operations = [ ...
15,802
7ac28c5bf8734e18693792b92563e26b81428cb2
import requests import string def get_keywords(keywords, depth): market_id = 'ATVPDKIKX0DER' # Amazon US # Get extra keywords by attaching a-z and aa-zz to front and back of keyword alphabet = list(string.ascii_lowercase) alphabet += [letter*2 for letter in alphabet] for keyword in list(dict.from...
15,803
03f78ca833b14deef11320997a6e6a6581d8a9bb
# 如果有两个字符串"hello"和"world",生成一个列表,列表中元素["hw","eo","lr","ll","od"] mystr = "hello" mystr1 = "world" l = [] for i in range(len(mystr)): l.append(mystr[i]+mystr1[i]) print(l)
15,804
1eee2c36d1c705be9e046e37c387e9eef08897ec
#! /usr/bin/python import rospy import json from threading import Lock from std_msgs.msg import String from hbba_msgs.msg import Desire from hbba_msgs.srv import AddDesires from hbba_msgs.srv import RemoveDesires class TeleopGenerator: def __init__(self): rospy.init_node('teleop_generator') self....
15,805
c19129997981d3ef420c2637d5ec049d72f54260
""" @Time : 2021/2/19 4:33 PM @Author : Xiaoming 将多个召回合并 1、提升评估指标mrr 2、itemcf没有召回数据的新用户,可以用hot去补全 3、可以加入多种召回方法,进行召回(这里没有做) """ import os import warnings from collections import defaultdict from itertools import permutations import pandas as pd from tqdm import tqdm from utils_log import Logger from utils_evaluate i...
15,806
782a6526cbea81c1322a492b790d64df0ffbcd3d
from node import Node from zip import Zip class Commodity: def __init__(self, origin: Node, dest: Zip): """ :param origin: origin node :param dest: dest zip :param quantity: number of packages """ self.name = origin.name+dest.name self.origin_node = origin ...
15,807
4bda88897e6d779c44441a693b39323902159d32
""" Home Climate Monitoring author: GiantMolecularCloud This script is part of a collection of scripts to log climate information in python and send them to influxdb and graphana for plotting. Manually back up the homeclimate directory to someothermachine. This simply copies over the current version including all sc...
15,808
a20a28d8d5156e1830185af9bb9f112834cc95a4
from .text import *
15,809
a35bf29f700ea2d1aa0a6b7b2283c9928dce33aa
# function createPythonScriptProcess(targetFile, options) { # options = _.pick(options || {}, ['shell', 'cmd']); # # const processOptions = getPythonCommandOptions(options), # cmd = options.cmd || 'python'; # # return processes.create(cmd, [targetFile], processOptions); # }
15,810
31fb9e229dd8869e2fd8076b074733f1ef692a28
#1.5 String Array Practice #---------------------------------------- #Question 1 #Declare day, month, and year in integer #Create a string format day## month## year#### #Print today's date using format #Check the length of the string #Turn the string to upper case #Split the string into 3 parts day, month...
15,811
b6501b5d9b2eb50cd55121b2e87926761cb2a887
import numpy as np from .core import Monitor __all__ = ['Print', 'PlotStat', 'Cache'] class Print(Monitor): '''Print data without changing anything.''' def __init__(self, input_shape, itype, **kwargs): super(Print, self).__init__(input_shape, input_shape, itype) @classmethod def monitor_fo...
15,812
19e1d5d5f36046f9885ec3d01d449d7a06d7f594
''' "why does numpy not work in venv???????? When I install it not in the venv, then it runs...???? => NEED TO ADJUST THE PYTHON VENV PATH!!!, THEN IT RUNS!" ''' import numpy as np import turtle_start as ts forw = int(input("Pls enter distance in pixels: ")) print(ts.move_turtle(forw)) #----------------------------...
15,813
4c6763eede53f0ccaf0fdeb8677fe6020976f5ea
# Generated by Django 3.0.8 on 2020-08-31 04:47 from django.conf import settings from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('network', '0003_auto_20200831_0432'), ] operations = [ migrations.AlterField( model_name='user'...
15,814
d21a8fd9b9ce542b0153b151072301f4331ee6c3
#selection sort algorithm using python """ selection sort steps: - find the smallest element in the array - exchange it with the intial position - find second smallest and exchange it with second """ import random #function to find teh smallest element of the array def element_smallest(value, length, array, key...
15,815
8832d6bcc87bb40b2bf7afc79d39366107a89038
from flask import Flask, render_template, request, redirect, url_for, flash from flask_mysqldb import MySQL app = Flask(__name__) # mysql database app.config['MYSQL_HOST'] = 'localhost' app.config['MYSQL_USER'] = 'root' app.config['MYSQL_PASSWORD'] = '' app.config['MYSQL_DB'] = 'casodb' mysql = MySQL(app) app.secret...
15,816
42eb0359fa448b062bcca6d9714dda38076b69e9
from django import template from ..constants import ReviewResponse from ..forms import FileSubmitForm from ..models import Review, Submit register = template.Library() @register.inclusion_tag('submit/parts/submit_form.html') def submit_form(receiver, redirect, user, caption=None): """ Renders submit form (o...
15,817
9a1993b35787e2d869bc8c3ab0b66586981e1911
# -*- coding: utf-8 -*- # Generated by Django 1.10 on 2018-07-06 13:40 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('blogposts', '0002_question_date_que'), ] operations = [ migrations.AddField( ...
15,818
f279a0a40e10c73e9ee3d072de689c5d84294d44
import scipy.io import math import numpy from sklearn.metrics import confusion_matrix # Initial dataset Numpyfile = scipy.io.loadmat('mnist_data.mat') train_x = Numpyfile['trX'] # 784x12116 train_y = Numpyfile['trY'] # 12116x1 test_x = Numpyfile['tsX'] # 784x2000 test_y = Numpyfile['tsY'] # 2002x1 """ 2-D fe...
15,819
6dd0f426daab4a2896f4f4ff8d463f575ada7262
print([x for x in [1,3,6,78,35,55] for y in [12,24,35,24,88,120,155] if x==y]) s1 = set([1,3,6,78,35,55]) s2 = set([12,24,35,24,88,120,155]) s1 &= s2 print(list(s1))
15,820
149f2f9b6139cf398bb5bbc0a6058a76d84a93a8
from __future__ import unicode_literals from faker.providers import BaseProvider class Provider(BaseProvider): def ffo(self): return 'bar'
15,821
09408ecbde8ee4c402482d1804ab93a97a299afb
from setuptools import setup, find_packages with open('README.md', 'r') as fh: long_description = fh.read() setup( name='cloudflare_dynamic_ip', version='0.0.3', author='Cristian Steib', author_email='cristiansteib@gmail.com', description='Service to auto update ip in cloudflare', long_des...
15,822
db239c37f7ee3d1c9e282b5580341962e16ad678
time = 0 def on_button_pressed_ab(): global time time = 0 basic.show_number(time) input.on_button_pressed(Button.AB, on_button_pressed_ab)
15,823
e4ae56caf4f44ea0322e1a5dd920043ec30693eb
# Asks the user for a distance in feet and converts it to inches. # 7/14/2020 # CTI-110 P5T2_FeetToInches # Ian Roberson # feet = float(input('Enter the distance in feet: ')) feetToInches = 12 inches = feet * feetToInches if feet == 1: print(feet, 'foot is', inches, 'inches.') else: print(feet, '...
15,824
bcff2081d55d80c898e46acd4d3da8aae7c5b114
# Write a function that takes an ordered list of numbers (a list where the elements are in order # from smallest to largest) and another number. The function decides whether or not the given number # is inside the list and returns (then prints) an appropriate boolean. # # Extras: # # Use binary search. import ra...
15,825
60dd0c17b8ffb690f803f91054cdacddf7b904d1
from flask import Flask, Blueprint, render_template import os import adal import requests import json from azure.common.credentials import ServicePrincipalCredentials from . import config idam = Blueprint('idam', __name__) @idam.route('/idam_services') def idam_services(): return render_template('idam_service...
15,826
3107fdda6de8cca77045337f5168f2f95b677fe2
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Thu Nov 23 16:35:21 2017 @author: eti """ import torch import torch.nn as nn from torch.autograd import Variable import torch.optim as optim import numpy as np import time import os import cPickle import matplotlib.pyplot as plt from Load_attrnet_inputs ...
15,827
1c0d2841436f1fc1453a2c4c5e8bd9d0afb1b2dd
import numpy as np a = np.zeros((3,1))
15,828
a96dd7f72007c2df318b7cc5c2187e443c141e6d
import json import os from dataclasses import dataclass from functools import lru_cache from typing import Any, Callable, Dict, List, Optional, Type from pythonbible.bible.bible_parser import BibleParser from pythonbible.bible.osis.parser import OSISParser from pythonbible.books import Book from pythonbible.converter ...
15,829
9deaf2e368fc30cbc69ed6f706d728451030bc68
from classes.piece import Piece from functions.pieces import Pieces class King(Piece): def __init__(self): super().__init__('KK') self.player = '' self.id = '' self.position = '' def move(self, King): self.moves = Pieces.moves(King) return self.moves
15,830
44cc9117668a9a69598f1ec1a874733948b2f522
N = int(input()) rl = [0, N-1] rl_condition = ["",""] flag = True for i, RL in enumerate(rl): print(RL) print("\n") s = input() rl_condition[i] = s if s == "Vacant": flag = False break while flag: center = (rl[0] + rl[1])//2 print(center) print("\n") s = input() if s == "Vac...
15,831
2ea14536ff2b3f24323d0abb0e9a62f12dc6923a
import pandas as pd from sklearn import preprocessing def get_data(): df = pd.read_csv('300k.csv') df = df[(df != '?').all(axis=1)] target = df['class'] target = pd.get_dummies(target,columns=['class']) # preprocess used_col = ['latitude', 'longitude','appearedTimeOfDay','appearedDayOfWeek','te...
15,832
bfb5b3557c0af5fe4c7c41a1ec31d533ed11faac
#!/usr/bin/env python3 """calculates the specificity each class in a confusion matrix""" import numpy as np def specificity(confusion): """ confusion is a confusion numpy.ndarray of shape (classes, classes) classes is the number of classes """ total = np.sum(confusion) truPos = np.diagonal(c...
15,833
4be5055a1b36fc3eefa65cd0b9a6ae1f06709d83
# -*- coding: utf-8 -*- """ Created on Mon Sep 21 00:15:37 2020 @author: Keith Monreal """ # Give the user some context and get his or her name print("\nAre you ready to take a quiz about everything and anything under the sun today?") choice = input("Yes or No\n") if 'Yes' in str(choice): print("\nOka...
15,834
37cd07d7974974a0e7977a3fdcb48619d0e8f9c7
import os import pandas as pd import subprocess from sentiment import * from csv import writer def append_list_as_row(file_name, list_of_elem): # Open file in append mode with open(file_name, 'a+', newline='') as write_obj: # Create a writer object from csv module csv_writer = writer(write_obj...
15,835
a2dddc34bd293794209a26c77086d8dbd5137244
#!/usr/bin/env python3 from sys import argv from os import path from subprocess import call s5 = 0 s60 = 0 s900 = 0 s1800 = 0 pos = 0 neg = 0 ins = 0 diff = 0 bad = {"BAD", "ERR", "UR"} fail = {"TO", "MO", "RTE"} with open("../results/tw_time.csv", 'r') as file: for line in file: tline = line.strip().split(","...
15,836
026f932182ab51c1ccfb1a84fcbd716717babe2e
def chunk_iterator(idx, total, chunks, max_length=None): '''https://stackoverflow.com/a/37414115''' '''If you divide n elements into roughly k chunks you can make n % k chunks 1 element bigger than the other chunks to distribute the extra elements''' '''[(n // k) + (1 if i < (n % k) else 0) for i in range(k...
15,837
846a933b541e20f2c2e720b58a9599e82b13c009
# coding=gbk ###1. 375 西直门---学院路---387----北京西站 ##375包含了西直门 f=open("busTrans") d={} while 1: line=f.readline().strip() if line: d1=line.split(":") d[d1[0]]=d1[1].split(",") else: break print(d) r1=input("from:") r2=input("to:") for i in d.keys(): if r1 in d.g...
15,838
f10a178bc8ca2571e5a73aa258f02c2d407a9e37
li = [] for i in range(100): li.append(bin(i).count('1'))
15,839
37e63a775db24c1b41f74bcd129d1877d4e48458
a = list(map(int, input().split()))[:4] c = 0 b = [] for i in a: if i not in b: b.append(i) print(4-len(b))
15,840
85173d2d831f2610c6ac717cfa236747e91a96ac
def esconde_senha (n): senha = n *"*" print (senha)
15,841
d7e10e3b43941114a0c820d5e6fb6f3121d8bbd6
from django.contrib.admin import SimpleListFilter from django.core.cache import cache from wagtail.contrib.modeladmin.options import ( ModelAdmin, ModelAdminGroup, modeladmin_register, ) from wagtail.core.signals import page_published from .models import Group, GroupContribution, MeetingType, Regi...
15,842
e7e78b6962805dba0cfd92d71011c4abbd0bcb6f
from server_part.app import app from server_part.database.tables import User, Post from flask import jsonify from server_part.utils.misc import auth # admin could get information about some users using this function @app.route('/user/<int:user_id>', methods=['GET']) @auth.login_required(role=['admin']) def show_user...
15,843
2ef0a6d8ab9369e8d127dd607bffa95570c212d4
"""test_serdepa.py: Tests for serdepa packets. """ import unittest from codecs import decode, encode from serdepa import ( SerdepaPacket, Length, List, Array, ByteString, nx_uint8, nx_uint16, nx_uint32, nx_uint64, nx_int8, nx_int16, nx_int32, nx_int64, uint8, uint16, uint32, uint64, int8, int16, i...
15,844
f6008fa23129af3de30dc19c36fa93025789f085
# -*- coding: utf-8 -*- """Log schema.""" from datetime import datetime from typing import List, Optional from pydantic import BaseModel from projects.utils import to_camel_case class LogBase(BaseModel): class Config: alias_generator = to_camel_case allow_population_by_field_name = True ...
15,845
bbe96af1c091b5bd9a30ce7b7fd8bbfd709fa6b4
n, m = map(int, input().split()) arr = list(map(int, input().split())) d = {} for a in arr: if a in d: d[a] += 1 else: d[a] = 1 dd = [[k, v] for k, v in d.items()] dd = sorted(dd, key=lambda x: x[1]) if dd[-1][1] > n // 2: print(dd[-1][0]) else: print("?")
15,846
a7827063f3de253130fa14634b6d2bfe543b8e4e
# Lesson 2.4: While Loops # Loops are an important concept in computer programming. # Loops let us run blocks of code many times which can be # really useful when we have to repeat tasks. # https://classroom.udacity.com/nanodegrees/nd000/parts/0001345403/modules/356813882475460/lessons/4196788670/concepts/50222508420...
15,847
df79a8584bb50528479149140be296b481e223eb
import WavePy.wavelet as wv import WavePy.spiht as spiht from WavePy.lwt import * import pickle from pylab import * lim = [# "cameraman", #"house", #"jetplane", #"lake", #"lena_gray_512", #"livingroom", #"mandril_gray"#, "peppers_gray"#, #"pirate", #...
15,848
295ab96565099f894ef7de68f93d88a62895eec5
import tkinter as tk import ctypes # An included library with Python install. import packetCapture import featureExtract import reporting import classifier import numpy as np from tkinter import messagebox LARGE_FONT = ('Comic Sans MS', 30) f= np.empty([1,76]) class gui(tk.Frame): def __init__(self): ...
15,849
cd1065b22a580bf9ae72cd158d6ddb275891a4a2
from Tree import BinaryNode from Tree import minTree def checkBalanced(rootNode): depths = [] global depths findImbalances(rootNode, 0) def findImbalances(rootNode, depth): if rootNode.getLeft(): findImbalances(rootNode.getLeft(), depth + 1) if rootNode.getRight(): findImbalances(r...
15,850
784f51c2c416e9eda2cdd89bc42946de90da11ed
import json import pickle import argparse # Manually check to see how well the translation_probabilities_table was generated with this command line tool. # Pass a Dutch word (not a phrase) and see the top 10 most likely translations to English. if __name__ == "__main__": parser = argparse.ArgumentParser() pars...
15,851
b21c2f716a7f23f43086222cf6fb71e10e6aea8d
# Generated by Django 3.1.6 on 2021-06-14 14:37 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('employeeapi', '0002_employee_email'), ] operations = [ migrations.RemoveField( model_name='employee', name='email', ...
15,852
456b6ec4516dd47576f3aaef7f592f9b208c6fe8
import multiprocessing as mp def cube(x): return x**3 pool = mp.Pool(processes=4) results = [pool.apply_async(cube, args=(x,)) for x in range(1, 7)] output = [p.get() for p in results] print(results) print(output)
15,853
d73e3142421e788f86356e6dbeffd7825c085272
import boto.s3 import cStringIO import os import os.path import time import tarfile import zipfile from worker.config import config def fetch(key, logger=None): """download and extract an archive""" template = "$AICHALLENGE_PREFIX/var/lib/aichallenge/submissions/%s" path = os.path.expandvars(template % key) if ...
15,854
eabf53ccfe5a58e2bb2da6e32138140d754dc3b6
from modules.attack_methods.base_neo4j import BaseAttackMethod class EC2RoleCompromise(BaseAttackMethod): def get_edge_types(self): return ['UserPublicIPAddress'] def get_attack_difficult(self): return 30 def get_attack_name(self): return "GrabAPIToken" def get_target_node(s...
15,855
793f88934785e82f6694ceb738f8816a34c9326d
HOST_LDAP = 'http://127.0.0.1:8010' TOKEN_LDAP = None USER_MAP_LDAP = { 'mail': 'email', 'sAMAccountName': 'username', 'givenName': 'first_name' }
15,856
2576aca732547aeee81a450ef56a8ec5708faa6e
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Tue Jun 13 16:34:32 2017 Script that creates the PSF of all files. @author: jmilli """ import os import numpy as np import irdisDataHandler as i import pdb import vip #ds9=vip.fits.vipDS9() from astropy.io import ascii,fits import matplotlib.pyplot as plt f...
15,857
718da997426e6dcc1db8f94d2fcfe03ea19bddb1
# https://www.acmicpc.net/problem/2110 import sys n, c = list(map(int, sys.stdin.readline().split(' '))) homes = sorted([int(line) for line in sys.stdin.readlines()]) start = homes[1] - homes[0] end = homes[-1] - homes[0] result = 0 while(start <= end): mid = (start+end)//2 value = homes[0] count = 1 ...
15,858
84af944c2bb57facc1d60cc7b64bb244eaf39a7d
import sae from honey import wsgi application = sae.create_wsgi_app(wsgi.application)
15,859
51085f185c1b0a8ef333ad4b55f847e3edf6b4a7
import numpy as np from mpmath import mp mp.dps = 500 def construct_s(bh): s = [] for bhj in bh: if bhj != 0: s.append(np.sign(bhj)) s = np.array(s) s = s.reshape((len(s), 1)) return s def construct_A_XA_Ac_XAc_bhA(X, bh, n, p): A = [] Ac = [] bhA = [] for...
15,860
1a01df5f519b0f4d5f5b4581be6ffc6c3f149d63
from RunLenCode import * from SEA import * from twice_encode import * scale=1 stastic=[] stastic_2=[] for i in range(6): l = [10, 33, 100, 319, 1000, 3190] scale = l[i] s=Sea(scale,scale,3) s.init_random() r=RLC() code=r.Sea2Code(s) stastic.append(len(code)/(2*scale*scale)) t=Twice_encod...
15,861
3322d62bc64fa0057263fd19af3c208d1b27c379
# from celery import task # from django.core.mail import send_mail # from .models import ShopOrder # # # @task # def order_created(order_id): # order = ShopOrder.objects.get(id=order_id) # subject = f"Order nr. {order_id}" # message = f"Dear {order.client.first_name},\n\nYou have successfully placed an orde...
15,862
4469d5757f502fe810c83f08a8cbec651b2a4ccf
import rootpy.plotting.views as views import math def quad(*xs): return math.sqrt(sum(x * x for x in xs)) class MedianView(object): ''' Takes high and low, returns median assigning half the diff as error. ''' def __init__(self, highv=None, lowv=None, centv=None): self.highv = highv self.low...
15,863
8f115212810b39e02330dae358cba9f212abf937
from django.urls import path from .views import SignUpView, register, user_cad_sucesso from . import views urlpatterns = [ path('signup/', SignUpView.as_view(), name='signup'), path("register/", views.register, name="register"), path("user_cad_sucess/", views.user_cad_sucesso, name="user_cad_sucesso"), ]
15,864
ad1dfaa588d6366e3dc517e8ad703749168c1bf2
import scipy as _sp import time as _time import scipy.sparse as _sprs import OpenPNM as _op from scipy.spatial.distance import cdist as dist def find_path(network, pore_pairs, weights=None): r""" Find the shortest path between pairs of pores. Parameters ---------- network : OpenPNM Network Object...
15,865
fe39683628096a28a29237364fe6407771285c41
from corehq.apps.reports.datatables import DataTablesColumn from corehq.apps.reports.datatables import DataTablesHeader from custom.icds_reports.utils import ICDSMixin class BaseIdentification(ICDSMixin): title = '1.a Identification and Basic Information' slug = 'identification' has_sections = False ...
15,866
f25876b0be627d2b73aff2be0bb919c2e027c8b2
''' >>> Rutgers SALT Supernova Spectral Reduction Pipeline <<< This module prints the history of pipeline processes run on each data file in the working directory. It also contains functions for modifying specific keywords in a FITS header. These keywords, notably 'RUPIPE' and 'RUIMGTYP', let the pipeline sort fil...
15,867
fc8cfc661a660648f758a30d772e5557be6113fb
import mechanize url = "http://cmiskp.echr.coe.int/tkp197/search.asp?skin=hudoc-en" br = mechanize.Browser() br.set_handle_robots(False) br.open(url) allforms = list(br.forms()) print "There are %d forms" % len(allforms) for i, form in enumerate(allforms): print i, form.name, form # br.select_form("aspnetFor...
15,868
8569943fbea33e101d13509ce618b996ee0bb228
""" Unit tests for field.py """ # pylint: disable=missing-class-docstring # pylint: disable=missing-function-docstring import unittest import numpy as np from lib.field import Field from lib.tetromino import Tetromino def generate_valid_state(state): """ Given a partially filled np array (valid column count...
15,869
71f6fce2384d524a3b56bf57e7800e488ad34e33
import os print "PC Name : "+os.environ['COMPUTERNAME'] print os.popen('systeminfo | findstr /c:"Total Physical Memory" /c:"Available Physical Memory"').read()
15,870
9f448b951016246ecf3d13c67ee7deed4aa42db1
import sys from collections import Counter as cc def input(): return sys.stdin.readline().rstrip() def ii(): return int(input()) def mi(): return map(int, input().split()) def li(): return list(mi()) def main(): a, b = mi() def sxor(x): ret = ((x+1)//2)%2 if x%2 == 0: ret ^= x ...
15,871
db8299cc6ae699b11e4d551d0e3f63c609c43aab
# -*- coding: utf-8 -*- """ Created on Mon Oct 22 17:22:43 2018 @author: Zhang Han do clustering by TF-IDF and Kmean of scikit learn """ #-*- coding: utf8 -*- import pandas as pd from sklearn.cluster import KMeans from sklearn.externals import joblib from sklearn.feature_extraction.text import TfidfVectorizer import...
15,872
ca564f66fa9c29bf9ea35357ca285ae3650e6967
# [START imports] import json import sys import os import argparse import datetime import configparser import yaml from datetime import datetime import sys import argparse sys.path.insert(0, './python-modules') # sys.path.insert(0, './resources') sys.dont_write_bytecode = True # [END imports] # [START import modules]...
15,873
6b19ac1cb7e42f9df5efa8a88536d728e6a2bea9
from rack.models import Arch, Repo, Group, Package, Spin, UserProfile, UserGroup, PackageRating, GroupRating, UserGroupRating from django.contrib import admin admin.site.register(Arch) admin.site.register(Repo) admin.site.register(Group) admin.site.register(UserGroup) admin.site.register(Package) admin.site.register(S...
15,874
15a468050bb2bf8aff266e0df9bc8679cb7af633
pytest_plugins = "pytester"
15,875
aff57ebdfaf6485cf9d66472b6584c7408567f52
#!/usr/bin/env python # coding: utf-8 import numpy as np # linear algebra import pandas as pd # import matplotlib.pyplot as plt import seaborn as sns get_ipython().run_line_magic('matplotlib', 'inline') sns.set() #Importing the auxiliar and preprocessing librarys from sklearn.metrics import accuracy_score, confusio...
15,876
6cda5cd8b185a42409f3020e25e8e2d4f56f7f4e
"""Save object into XML file. Write content of object _x into file _data._xml. Source: programming-idioms.org """ # Implementation author: Fazel94 # Created on 2019-09-27T14:19:13.327701Z # Last modified on 2019-09-27T14:19:13.327701Z # Version 1 import pyxser as pyx # Python 2.5 to 2.7 # Use pickle or marshall m...
15,877
98d1762d00c851baab6b55239a209ce70ade30fb
import numpy as np from numpy.testing import assert_array_equal # takes a list def get_3_max_values(arr): np_array = np.array(arr) sorted_index_array = np.argsort(np_array) sorted_array = np_array[sorted_index_array] indices = sorted_index_array[-3:] result = sorted_array[-3:] return indices, result clas...
15,878
1e8270c8cf22426f24ec52fd72a4f935a3a3d611
from tkinter import * from tkmacosx import Button root = Tk() root.title("goyn GUI") root.resizable(True, False) root.mainloop()
15,879
94312e2e5b189afcf3715b0732aca1ec16b72859
# AUTOGENERATED BY NBDEV! DO NOT EDIT! __all__ = ["index", "modules", "custom_doc_links", "git_url"] index = {"say_hello": "01_greeter.ipynb", "HelloSayer": "01_greeter.ipynb"} modules = ["greeter.py"] doc_url = "https://ruivalmeida.github.io/nbdev_presentation/" git_url = "https://github.com/ruivalmeida/...
15,880
bbe610556e9051b3a68e50d0cfbab982967802f6
""" You have been given 3 integers - l, r and k. Find how many numbers between l and r (both inclusive) are divisible by k. You do not need to print these numbers, you just have to find their count. Input Format The first and only line of input contains 3 space separated integers l, r and k. Output Format Pr...
15,881
a16ba91eb2505071c3880aa44fdae90aa292e423
#!/usr/bin/env python """User Related Functionality.""" from django.shortcuts import render, redirect from django.contrib.auth.models import User from django.contrib.auth import login, logout, authenticate from django.http import Http404 from myblog.models import UserMessage def index(request): """ Index Pag...
15,882
66a407f3e4f5d5642db1079d2c7f62e24e8e57e4
""" You have n fair coins and you flip them all at the same time. Any that come up tails you set aside. The ones that come up heads you flip again. How many rounds do you expect to play before only one coin remains? Write a function that, given n, returns the number of rounds you'd expect to play until one coin remains...
15,883
d51b5a09a103649744034c6e17b30384b874d46b
import json import numpy as np class MyEncoder(json.JSONEncoder): def default(self, obj): if isinstance(obj, np.integer): return int(obj) elif isinstance(obj, np.floating): return float(obj) elif isinstance(obj, np.ndarray): return obj.tolist() el...
15,884
66ff8001d7c010f4224060d5b8f9854d1b87b438
import os import platform import shutil import subprocess import textwrap from pathlib import Path import pytest import yaml from . import helpers class Dumper(yaml.Dumper): """A YAML dumper to properly indent lists. https://github.com/yaml/pyyaml/issues/234#issuecomment-765894586 """ def increase...
15,885
02aba038a5c457346576dfbe4d8b97dbee5cfa36
import tkinter # 创建主窗口 win = tkinter.Tk() # T是大写k是小写 win.title("窗口标题") win.geometry("400x200") ''' 框架控件 在屏幕上显示一个矩形区域,多作为容器控件 ''' # 创建底层frame frm = tkinter.Frame(win) frm.pack() # left # 在底层Frame上创建leftFrame frm_l = tkinter.Frame(frm) # frm_l = tkinter.Frame(win) # 在win上创建 tkinter.Label(frm_l, text='左上', bg='...
15,886
95bf0aeb8785716d30e7ff465eefbb861f334a3e
import numpy as np import pandas as pd from sklearn.datasets import load_iris from sklearn.metrics import f1_score from sklearn.model_selection import train_test_split from sklearn.naive_bayes import GaussianNB from sklearn import svm, neighbors #https://stackoverflow.com/a/38105540 # save load_iris() sklearn datas...
15,887
8b106b455175d325fafa6847fabd1212f5ce3dc5
# creates a newgameplay.json with all the data you need from Battlerite.championData.dataParser.inireader import read_and_convert from Battlerite.championData.dataParser.jsonreader import combine_json_data from flask import jsonify import json, os def update_champion_data(): read_and_convert() combine_json_dat...
15,888
440a79e329a2de4c1933412ae5248149e5db2132
import sys sys.path.insert(0, "..") sys.path.insert(0, "../../common") import json import rospy import random import time import serial import thread from klampt import * from klampt.glprogram import * from klampt import vectorops,so3,se3,gldraw,ik,loader from OpenGL.GL import * from planning.MyGLViewer import MyGLVie...
15,889
81e2f141a3de0a8f2831645e5b8de103f68841ea
from django.apps import AppConfig class BeentoConfig(AppConfig): name = 'BeenTo'
15,890
810b10c42c6c0edd90c18c880272d95a0866a0bf
num1, num2 = input().split() def reverse_Num(num): num_list = [] while num > 0: temp = num % 10 num_list.append(int(temp)) num = (num-temp) / 10 new_num = 100 * num_list[0] + 10 * num_list[1] + 1 * num_list[2] return new_num def num_Comparison(num1, num2): if num1 > num2: ...
15,891
084333abadb23cc2acb335092f00edaaa260cf1a
# -*- coding: utf-8 -*- # Generated by Django 1.9.8 on 2017-08-18 10:04 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Profile...
15,892
d9b41178b8747d8f0f023a089377ca07855d64f3
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db.models.functions import datetime from django.shortcuts import render, HttpResponse, redirect from django.contrib.auth.decorators import login_required from django.db import transaction from django.contrib import messages from django.utils.t...
15,893
b1542f9157442e8e4e10aa2971652a242d027807
# 어려움;; 다른사람 코드 참고 class Solution: def maxEvents(self, events: List[List[int]]) -> int: events.sort(reverse = True) h = [] res = d = 0 while events or h: if not h: d = events[-1][0] # 마지막 인덱스의 시작 시간 while events and events[-1][0] <= d: # ...
15,894
b19037452b1bcbab6afb2e80b19e7fe5cafff7e4
# Copyright 2012 The hookshot 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://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in...
15,895
ff58fd82df1da945292d951a2acbe1b5bf2ed673
def min_second_min(nums:list) -> tuple: min_el = None second_min = None for num in nums: if min_el is None: min_el = num elif second_min is None: min_el, second_min = min(min_el, num), max(min_el, num) elif num < second_min: min_el, second_min = mi...
15,896
5382675fa8f63e439efd587a13c22bd5982cb11b
# Generated by Django 2.1.4 on 2019-02-18 21:14 from django.db import migrations, models import django.db.models.deletion import django.utils.timezone class Migration(migrations.Migration): dependencies = [ ('users', '0006_counsellee_twitter_handle'), ] operations = [ migrations.CreateM...
15,897
f914360018cd9bbd2684464f83a673f3bed52b4d
import pandas as pd import argparse import weather_functions parser = argparse.ArgumentParser() parser.add_argument("input", type=str, help="Input data file") parser.add_argument("output", type=str, help="Output plot file") parser.add_argument("-s", "--start", default="01/01/2019", type=str, help="Start date in DD/MM/...
15,898
79b65a5b1275a54da9875e511f452d18b3cb00ec
"""" 名称:54 童芯派控制Tello无人机(MicroPython usocket标准库) 硬件: 童芯派 功能介绍:简单的利用童芯派实现对Tello无人机的起飞降落控制。 难度:⭐⭐⭐⭐⭐⭐ 支持的模式:上传 """ # ---------程序分割线----------------程序分割线----------------程序分割线---------- import usocket import cyberpi import time import sys cyberpi.wifi.connect("TELLO-5A186C", "") while not cyberpi.wifi.is_connect():...
15,899
1ed3242d817a7633ba209d94f15838cee641256e
#! /usr/bin/env python # -*- coding: utf-8 -*- from gevent import monkey; monkey.patch_all() # noqa import gevent import sys from qtpy.QtCore import QTimer from qtpy.QtWidgets import QApplication from pyqtconsole.console import PythonConsole def greet(): print("hello world") class GEventProcessing: ""...