index int64 0 1,000k | blob_id stringlengths 40 40 | code stringlengths 7 10.4M |
|---|---|---|
999,900 | 6f42cbc3ae5b2537efc59b29d82048ecffbcaccc | logo = """
____ ____ ____ ____ ____ _________ ____ ____ ____ _________ ____ ____ ____ ____ ____ ____
||G |||u |||e |||s |||s ||| |||t |||h |||e ||| |||n |||u |||m |||b |||e |||r ||
||__|||__|||__|||__|||__|||_______|||__|||__|||__|||_______|||__|||__|||__|||__|||__|||__||
|/__\|/__\|/__\|/__\|/__\|/______... |
999,901 | 04917c4e1e49ba5c20a9fe578e54811c53f42c7b | #!/usr/bin/env python
"""
This action will create a CHAP account on the cluster for each client and configure the client with the CHAP credentials
"""
from libsf.apputil import PythonApp
from libsf.argutil import SFArgumentParser, GetFirstLine, SFArgFormatter
from libsf.logutil import GetLogger, SetThreadLogPrefix, l... |
999,902 | c21500260fbd8697558c32ab4d02839cf7a01446 | import os, sys
from ROOT import *
from DataFormats.FWLite import Events,Handle
import array, math
#gROOT.Macro( os.path.expanduser( '~/rootlogon.C' ) )
gROOT.Reset()
gROOT.SetStyle("Plain")
gStyle.SetOptStat(0)
gStyle.SetOptFit(0)
gStyle.SetTitleOffset(1.2,"Y")
gStyle.SetPadLeftMargin(0.18)
gStyle.SetPadBottomMargin(... |
999,903 | 71a0d6bac88b73222fd08d41dbe1b82a54681826 | # Creating an object
class Classroom:
def __init__(self):
self._people = []
def add_person(self, person):
self._people.append(person)
def remove_person(self, person):
self._people.remove(person)
def greet(self):
for person in self._people:
person.say_hello()
class Person:
def __init__(self, name)... |
999,904 | 7a559d44b71b76fc84361a341ddea9cdb737fcff | '''
ChainMap in collection.
- chainMap就是封裝許多dictionaries 到一個簡單的 unit,並return 一個list的dictoraries。
Reference:
- https://www.geeksforgeeks.org/python-collections-module/
'''
from collections import ChainMap
d1 = {'a': 1, 'b': 2}
d2 = {'c': 3, 'd': 4}
d3 = {'e': 5, 'f': 6}
c = ChainMap(d1, d2, d3)
pri... |
999,905 | 9fc7f4c6ffde05a09619c9a4171ef623928af350 | import random
lst1 = [random.randint(0,100) for i in range (100)]
lst2 = [random.randint(0,100) for i in range (100)]
print(lst1)
print(lst2)
print(set(el for el in lst1 if el in lst2)) |
999,906 | 8b5017fcee5c86b1a5d037acab67b7fc14c97d15 | import os
import keras
import numpy as np
from keras import regularizers
from keras.callbacks import ModelCheckpoint, LearningRateScheduler
from keras.datasets import cifar100
from keras.layers import Flatten, Dense, Dropout, Activation, Conv2D, MaxPool2D, BatchNormalization
from keras.models import Sequential
from ke... |
999,907 | af839b47e0ca3bbdd42b3eecfe1c6c77447df354 | from tkinter import *
import sqlite3
import os.path
import datetime
import sys
sys.path.append(os.path.abspath(os.path.dirname(__file__) + '/' + '../..'))
from HospitalManagementDBMS import settings
settings.init()
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
db_path = os.path.join(BASE_DIR, "../database.db"... |
999,908 | 391643082c08c81c39d0a4c21cf1c4f390193f79 | # This script starts a number of forked processes to generate TSV files.
#
# Usage
#
# python run_h5_to_tsv.py h5file 0
#
# Where 0 is the slice that will be converted into a CSV.
import os, sys
os.system("python " + os.path.dirname(os.path.realpath(__file__)) + "/make_feature_tsv_from_h5.py {}&".format(sys.argv[1]))
... |
999,909 | 98d6926e750579086e5304985863b1ac87f33ac9 | # Довженко Віталій
# Лабораторна робота №2
# Розрахувати значення x, визначивши і використавши відповідну функцію
from PyQt5 import QtWidgets
from PyQt5.QtWidgets import QMessageBox
from PyQt5.uic import loadUi
from math import sqrt
import sys
class mywindow(QtWidgets.QMainWindow):
def __init__(self):
s... |
999,910 | bcae0b431d9bb8f1f7dbfede7a9696060dda5c11 | from data_importers.management.commands import BaseXpressDemocracyClubCsvImporter
class Command(BaseXpressDemocracyClubCsvImporter):
council_id = "MAV"
addresses_name = "2021-03-03T13:39:58.634524/Democracy_Club__06May2021.tsv"
stations_name = "2021-03-03T13:39:58.634524/Democracy_Club__06May2021.tsv"
... |
999,911 | 125dbacd9c7d3b92c3d2a316ff9c717581f2f9c6 | import argparse
import os
import subprocess
import sys
# map location in repo to deploy path (relative to home directory)
path_mappings = {
".bashrc": ".bashrc",
".bash_aliases": ".bash_aliases",
".config/nvim/init.vim": ".config/nvim/init.vim",
".config/nvim/go.vim": ".config/nvim/go.vim",
".conf... |
999,912 | 86d2f95e8af1f0ddcffdbd74ba9059f64025210f | import os
import cgi, cgitb
import random
form = cgi.FieldStorage()
from flask import Flask, request, redirect, render_template, session, url_for, g, jsonify
app = Flask(__name__)
app.config.from_mapping(SECRET_KEY='devIAm') # Needed for session tracking
# Note flask does CLIENT session data storage! Watch da... |
999,913 | 4ade6f502323803542f640a268cf1edabf1a9bd8 | '''
Module containing the methods for the detection of the arrows
Here is where the Neural Network can be applied and the images are passed through
Methods here are:
load_default_model(): Loads the model that is defualt, works well for most reaction images
get_direction(): gets the direction of the arrow, recursively... |
999,914 | 8fead57ad7427a5ea0f554acc4562555a387aa91 | from __future__ import print_function
import sys
from lxml import etree, objectify
xml = objectify.parse(open(sys.argv[1]))
print(etree.tostring(xml, pretty_print=True, xml_declaration=True, encoding="UTF-8").decode())
|
999,915 | aecea8735463b15be9cb1487d29539eb5eb48324 | import vanilla
from django.db.models import Q
from django.contrib import messages
from django.http import Http404
# For LoginRequiredMixin
from django.utils.decorators import method_decorator
from django.contrib.auth.decorators import login_required
class LoginRequiredMixin(object):
u"""Ensures that user must be auth... |
999,916 | a4ee059317ccbe7baae8ee7dac619a0d11ce29d7 | import json
import jieba
import pandas as pd
from core.utils import *
from core.vggnet import Vgg19, load_and_resize_image
from collections import Counter
import os
import sys
from scipy import ndimage
import hickle
import tensorflow as tf
from PIL import Image
from config import *
import hashlib
def fenci(sentence):
... |
999,917 | 5da2fb43ea53c791d80071ffb4a72d4c70239e26 | ```
A city with 6 districts has 6 robberies in a particular week. Assume the robberies are
located randomly, with all possibilities for which robbery occurred where equally likely.
What is the probability that some district had more than 1 robbery?
Solving by-hand yields 1 - 6!/6^6 = .98456.
```
import numpy as np
n... |
999,918 | 76c494e90fd69abad57bf3bb421cad709e3dd11c | import json
import aiohttp
import asyncio
import requests
import pandas as pd
import xlsxwriter
def get_proxy():
return requests.get("http://127.0.0.1:5010/get/").text
def delete_proxy(proxy):
requests.get("http://127.0.0.1:5010/delete/?proxy={}".format(proxy))
async def fetch(session, url):
... |
999,919 | f0108efdd0172c4f40f89f198dcf89a687ef2b70 | import os
from getWebForecasts import extractDarkSky, extractAccuWeather, extractWUnderground, extractNWS, getDarkSkyHistory, getCities, get_API_keys
def getAllDataFromDirectory(prediction_directory, actual_directory, write_directory, cities_file, utc_offset = False):
"""
Create a spreadsheet for each city.
... |
999,920 | 3b6e6ae70843fdef493d60803f0759f927d7f8d9 | import io
import json
from typing import List, Union, Type
import altair as alt
import pandas as pd
import pytest
from altair_saver import (
save,
render,
BasicSaver,
HTMLSaver,
NodeSaver,
Saver,
SeleniumSaver,
)
from altair_saver._utils import JSONDict, mimetype_to_fmt
FORMATS = ["html",... |
999,921 | fdb64aecbbfd3a10e5b60563f870b8ac208d7979 | import pandas as pd
from sklearn import preprocessing
from model_F17 import *
def sim_zsrc_Neff(Nsamp, dth, zmin = 0, zmax = 10, dz = 0.001, Neff_scale = 1, model = 'Be13'):
'''
Simulate the source redshift in a light cone with Neff(z)
Neff is derived from Fonseca 17 Schechter LF model.
Inputs:
... |
999,922 | b6848b07f6c0d56b2566701e68c6842694463c5b | from django.apps import AppConfig
class ExportCalculosConfig(AppConfig):
name = 'export_calculos'
|
999,923 | 6e1278ee0f67e717329a6773c3dc7c8be09718ca | from typing import Optional, Dict
from logging import Logger, getLogger
from optmlstat.basic_modules.class_base import OptMLStatClassBase
from optmlstat.opt.opt_prob import OptimizationProblem
from optmlstat.opt.opt_alg.optimization_algorithm_base import OptimizationAlgorithmBase
from optmlstat.opt.iteration import It... |
999,924 | 10c4e72a2108a85869c8eced22d27b959499e443 | # 5 4 2
# +-----> B -----> D ------+
# | ^ \ | v
# A 8| \2 |6 F
# | | \> v ^
# +-----> C -----> E ------+
# 2 7 1
graph = {
'A': {
'neighbors': {
'B': 5,
'C': 2,
},
'__start__':... |
999,925 | 501f689b8cc92e72fc316d15daf3d5f81d725f4d | import os
import sys
path_to_virtualenv_file = '/path/activate_this.py'
execfile(path_to_virtualenv_file, dict(__file__=path_to_virtualenv_file))
os.environ['DJANGO_SETTINGS_MODULE'] = 'path.to.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler() |
999,926 | ced072875f5dca4eaffc92bb804a1c61fd744209 | import requests
import re
import os
from bs4 import BeautifulSoup
headers={'User-Agent':"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/22.0.1207.1 Safari/537.1"}
all_url="http://www.58pic.com/piccate/10-0-0.html"
start_html=requests.get(all_url,headers=headers).text
#soup=Bea... |
999,927 | 1458696b28a812959838f7947c047ebae5a41877 | from style.style import style
import sqlite3
import os
class sqlite(style):
_connect = None
_cursor = None
def __init__(self):
for root, _, files in os.walk(os.path.split(os.path.realpath(__file__))[0]):
for name in files:
if name.find("config.db") != -1:... |
999,928 | ca3abce0ff23ec1eb8aac389b37a6150879f179b | '''
inp : OQQSNPOQZBCETV NPSU SUNPRTJLHJ XZZB HJ KMDFMOHJ
out : PROPADU OT TOSKI YA I LENI
'''
import string as str
inp = list(input())
eng_alphabet = list(str.ascii_uppercase)
d = {eng_alphabet[a]:eng_alphabet[a+1] for a in range(25)}
d_t = {'Z' : 'A'," " : " "}
d.update(d_t)
a=0
while a<len(inp):
if d[inp[a]]... |
999,929 | 605a2dc0c21bbaa836d04563a4f1fa8dd98c42e8 | class Solution(object):
def rob(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
if (len(nums) == 0):
return 0
elif (len(nums) == 1):
return nums[0]
else:
profit = [0] * (len(nums) + 2)
for i in range(len(... |
999,930 | 6d95fb65fff3548c0fe63ed21a7601993564e143 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('sequencelistings', '0014_auto_20161217_1629'),
]
operations = [
migrations.AddField(
model_name='sequence',
... |
999,931 | 3da504f118da15f7a2fa4e94efb6d361c04ef425 | #!/usr/bin/env python
import logging
from typing import (
Dict,
Optional
)
from hummingbot.logger import HummingbotLogger
from hummingbot.core.event.events import TradeType
from hummingbot.core.data_type.order_book cimport OrderBook
from hummingbot.core.data_type.order_book_message import (
OrderBookMessage... |
999,932 | 99c9833b137ffb593c5443df6b7216b1374afcee | #!/bin/python3
#-*-coding:utf-8-*-
import os, json, re, scrapy, requests, time
from flask import Flask, render_template, request, jsonify, abort
from flask_cors import CORS, cross_origin
from pymongo import MongoClient
from billiard.process import Process
from whoosh.fields import Schema, TEXT, ID, KEYWORD, STORED
fro... |
999,933 | 62e1ecfebf33e86573118b537d6ff41afd3d22d6 | import sqlite3
import calendar
import plotly.graph_objs as go
from plotly.subplots import make_subplots
import pandas as pd
import paceutils
from .settings import color_palette, db_filepath, agg_filepath
helpers = paceutils.Helpers(db_filepath)
enrollment = paceutils.Enrollment(db_filepath)
demographics = paceutils.De... |
999,934 | de157ad3270733d041d055a34796caafd09dd610 | import numpy as np
import matplotlib.pyplot as plt
import quantities as pq
import neo
import pandas as pd
import string
import glob
import sys
def csv_to_raster(fileName, title, output):
MEA_data = pd.read_csv(fileName , sep=',', encoding='latin1')
data = {}
for i in range(1, 9): #column
for ... |
999,935 | de217f7e297f6d9e628ff27736b822a254a8a30d | #!/usr/bin/env python3
import argparse
from pathlib import Path
from json import load
from junitparser import JUnitXml
import csv
from vunit.color_printer import COLOR_PRINTER
def get_project_info(project_info_path):
test_to_requirement_mapping = dict()
tested_requirements = set()
with open(project_info_... |
999,936 | 6db075067d78e16d9af66f9b788df71ea549c24e | from django.contrib.auth import authenticate, login, logout
from django.contrib.auth.decorators import login_required
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect, HttpResponse
from django.shortcuts import get_object_or_404
from django.shortcuts import render
from django.uti... |
999,937 | f33123c429ec6dd41b65322f60e76b0f098a4b6e | from __future__ import division, print_function, unicode_literals
import pyglet
from pyglet.gl import *
from pyglet import *
from pyglet.window import *
from pyglet import clock
import ctypes
import primitives
import random
import user_input
constant = 10;
win = window.Window(fullscreen = True)
glClearColor(1, 1, 1, 1... |
999,938 | a9bb5ecd764f11ff135896892dc0ae64d04ab31b | from django.db import models
from .. import Team
class TeamRole(models.Model):
team = models.ForeignKey(Team, on_delete=models.CASCADE)
name = models.CharField(max_length=30)
can_modify_members = models.BooleanField(default=False)
can_remove = models.BooleanField(default=False)
def __str__(self)... |
999,939 | b2058b44dd358d3a16ae1aa769b3cf3bdf43b8a2 | import os
import requests
from decimal import Decimal
from models.image import Image
from models.donation import Donation
from flask_login import current_user
from instagram_web.util.helpers import gateway
from flask import Blueprint, render_template, request, redirect, url_for, flash
donations_blueprint = Blueprint('... |
999,940 | 97c44d4c3e2eafce376dbbe603ba3d8bed5e7835 |
import matplotlib.pyplot as plt
# testing examples from http://matplotlib.org/users/pyplot_tutorial.html
def example_line():
numbers = [1, 2, 3, 4]
plt.plot(numbers)
plt.ylabel('Numbers :) ')
plt.show()
# example_line()
def example_red_dots():
numbers = [1, 2, 3, 4]
more_numbers = [1, 4, ... |
999,941 | fa196bad482d4b2c5b754045f3bab554b250e1b2 | # coding=utf8
# https://leetcode.com/problems/word-pattern/description/
# Easy
class Solution(object):
def wordPattern(self, pattern, str):
"""
:type pattern: str
:type str: str
:rtype: bool
"""
if not len(str.split(" ")) == len(pattern):
return False
... |
999,942 | 7b1ae0fcf04e38538145cb65d119d48c21dd7168 | #!/usr/bin/env python3
# day165.py
# By Sebastian Raaphorst, 2019
from typing import List
def right_cones(array: List[int]) -> List[int]:
"""
We have an array, say 3 4 9 6 1.
We want to return a new array where 3 is replaced by the number of number of smaller elements of 3 (1).
We want to return a n... |
999,943 | 30632aa9235364a2498156d36858efb24f11a8aa | import matplotlib.pylab as plt
import numpy as np
from mpl_toolkits.axes_grid1.inset_locator import zoomed_inset_axes
from mpl_toolkits.axes_grid1.inset_locator import mark_inset
data_0,data_1 = np.loadtxt("xgVSx_CTEQ6L_Q10.dat", usecols=(0,1), unpack=True)
data_2,data_3 = np.loadtxt("xgVSx_CT14_Q10.dat", usecols=(0,... |
999,944 | 48251a6b3c1fa6b628fd09d66c6ad512a637e0b0 | # -*- coding:utf-8 _*-
import pandas as pd
from sklearn.preprocessing import StandardScaler, LabelEncoder
import lightgbm as lgb
import time
from gen_feas import load_data
import matplotlib.pyplot as plt
train, test, no_features, features = load_data()
X = train[features].values
y = train['target'].astype('int32')
tes... |
999,945 | 68f9e4d53178d9d79647148d435c351c2e55764a | import pickle
import numpy as np
from mlgame.communication import ml as comm
import os.path as path
# cd C:\Users\user\Desktop\課程\大二下\基於遊戲的機器學習\MLGame-master
# python MLGame.py -i Data.py pingpong HARD 10
# 'frame': 10, 'status': 'GAME_ALIVE', 'ball': (35, 143), 'ball_speed': (-7, 7), 'platform_1P': (35,420... |
999,946 | ec3559250a4c123bfeee3090da0e133655a97399 | import requests
URL = 'http://127.0.0.1:5000/'
# To get a single request
data = [{'name': 'Neural Network programming with Pytorch', 'views': 152000, 'likes': 14500},
{'name': 'Natural Language Processing', 'views': 120300, 'likes': 12662},
{'name': 'Python OOPs concepts', 'views': 1111020, 'likes': 1... |
999,947 | cbf50e5dcd5c62ce3b882ef9ff358c41908fbbe7 | #!/usr/bin/env python
# encoding: utf-8
"""
__author__ = 'FireJohnny'
@license: Apache Licence
@file: data_clean.py
@time: 2018/6/3 17:07
"""
import csv
import codecs
import jieba as jb
import random
import sys
# sys.setdefaultencoding("utf-8")
import pandas as pd
import numpy as np
def read_data(file_dir):
... |
999,948 | 2fd9fe8864a1e616c5b29dafa0931c68bb60d2e0 | # Copyright (C) 2019 The Raphielscape Company LLC.
#
# Licensed under the Raphielscape Public License, Version 1.d (the "License");
# you may not use this file except in compliance with the License.
#
# Port to userbot by @MoveAngel
import datetime
from telethon import events
from telethon.errors.rpcerrorlist import Y... |
999,949 | 7a416f6ec553be0dcfec10080c35eadd70453708 | str1 = "I love python"
chars = []
for i in str1:
#chars.append(i)
chars += i
print(chars)
# Currently there is a string called str1.
# Write code to create a list called chars
# which should contain the characters from str1.
# Each character in str1 should be its own element
# in the list chars. |
999,950 | 9ec7c6c4d6b2e396cec15f64c43188d468ae0865 | class Solution:
def backspace_compare(self, str1, str2):
str1, str2 = self._helper(str1), self._helper(str2)
return str1 == str2
def _helper(self, s):
# while "#" in s:
# i = s.index("#")
# s = s[:i-1] + s[i+1:] if i >0 else s[i+1:]
# return s
st... |
999,951 | ffdd0c55d61a34d2fdad392c1bb9aa523ba529d5 | import requests
import json
resp = requests.get('https://developer.nrel.gov/api/alt-fuel-stations/v1/nearest.json?api_key=VWJLTUJMHcLn25INdExtx46gCX9lowhtFRXdvCRm&location=Denver+CO')
print(resp.text)
|
999,952 | 415e9374c2748aadfc681fe8eb279d60865143d9 | """ThreeUpShow is a variant of ShowBase that defines three cameras covering
different parts of the window."""
__all__ = ['ThreeUpShow']
from .ShowBase import ShowBase
class ThreeUpShow(ShowBase):
def __init__(self):
ShowBase.__init__(self)
def makeCamera(self, win, sort = 0, scene = None,
... |
999,953 | cdef6f47adf2fd3cdfb1e2f59974df16d5b57323 | import pymel.core as pm
import lcGeneric as gen
import pickle
def hookOnCurve(tangent = False):
sel = pm.ls (sl=True)
crv=sel[-1]
sampleNPoC = pm.createNode ('nearestPointOnCurve')
sampleGrpA = pm.group (empty=True)
crv.worldSpace[0] >> sampleNPoC.inputCurve
sampleGrpA.translate >> s... |
999,954 | cf17b61802dd25ca2ef98ce38add63dcf8fe0a24 | # Generated by Django 2.2.13 on 2021-08-13 15:05
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('games', '0003_auto_20210812_1530'),
]
operations = [
migrations.CreateModel(
name='Parameter',
fields=[
... |
999,955 | f87022e804b3c09ecb99772298aaceafd0fa0034 | default_app_config = 'debug_permissions.apps.DebugPermissionsConfig'
|
999,956 | bb98b08759d0d4a819458292e536da198c96ddbc | import os
from algorithms.pgirl import solve_ra_PGIRL, solve_PGIRL, make_loss_function
from utils import compute_gradient, load_policy, filter_grads, estimate_distribution_params
import numpy as np
import re
import argparse
from trajectories_reader import read_trajectories
# SCRIPT TO RUN SINGLE IRL EXPERIMENTS USING... |
999,957 | a4d6655893330e675cb0768f0dc85f680c97d1d5 | import copy
import logging
import re
import traitlets as traits
from nbconvert.preprocessors import Preprocessor
from nbformat.notebooknode import NotebookNode
class FinalCells(object):
""" a class that stores cells
"""
def __init__(self, header_slide):
self.cells = []
if header_slide:
... |
999,958 | 7d1818cdce02f30e89188ceb0986f10184c4fa8d | import cv2
import numpy as np
MIN_MATCH_COUNT = 10
# Query image
img = cv2.imread("images/kariusbaktus_v2.png", cv2.IMREAD_GRAYSCALE)
cap = cv2.VideoCapture(0)
# Features SIFT or ORB (Orb doesn't work with flann?)
sift = cv2.xfeatures2d.SIFT_create()
keypoints, descriptors = sift.detectAndCompute(img, None)
#orb = ... |
999,959 | 7c024a6ca00a829a806dd529a1b817cf9dc8b04a | # importing module
import random,pygame,sys
from pygame.locals import *
FPS = 30 # frames per second
WIDTH = 650 # width of the window's
HEIGHT = 500 # height of the window's
SLIDING_SPEED = 3 # speed of each boxes on reveals and covers
BOX_SIZE = 35 # size of box height & weight in pixels
GAP_SIZE = 10 # size of g... |
999,960 | 073d3ef6e83e14b6e5af78216812c920fd54e4b2 | s=""
for x in input().split():s+=x[0]
print(s.upper()) |
999,961 | 210cf2edf91a39df1126081ee51100ca7303e13f | from django.shortcuts import render, HttpResponse, HttpResponseRedirect
import random
import hashlib
from .models import Diary, Log, AdminDiary, student
from collections import defaultdict
def logging(func):
def wraper(request):
if 'HTTP_X_FORWARDED_FOR' in request.META:
ip = request... |
999,962 | 4c3de1efda5dc4e3e46c615032cea05484d15311 | #Enter the number to be reversed
string1=input("enter the number to be reversed:")
#converting entered number into string
num1=int(string1)
reverse=0
# Using while loop
while num1>0:
remainder=num1%10
reverse=reverse*10+remainder
num1=num1//10
#printing the output
print(reverse)
|
999,963 | 4de7c49aa4c1cfac0b9b6ce0313fad42299ba40f | # Generated by Django 2.1.8 on 2020-08-26 07:01
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('photo', '0002_auto_20200825_2237'),
]
operations = [
migrations.AlterField(
model_name='photo',
name='updated',
... |
999,964 | 665c8ab2941a9dd1284c8f2e3ad46ca3d611ff5f | import requests
r =requests.get('http://127.0.0.1:5000/', params={
'sentence': "I charge it at night and skip taking the cord with me because of the good battery life.",
'aspect': "cord",
'start': 41,
'end': 45
})
print(r.text) |
999,965 | c04d1300d676d9a4f9552a2111db81dc9eb89ed4 | from abc import ABCMeta, abstractmethod
from logging import Logger
from typing import Dict
from rsmtpd.core.config_loader import ConfigLoader
from rsmtpd.handlers.shared_state import SharedState
from rsmtpd.response.base_response import BaseResponse
class Command(metaclass=ABCMeta):
def __init__(self, logger: Log... |
999,966 | a80a134da3c08ad736c2b794a15c5508abf19622 | from pytest_bdd import (
given,
scenario,
then,
when,
parsers,
)
import os
from features.services.WebApp.web_app_api import WebApp
web_app = WebApp()
@scenario(r'tests' + os.sep + 'webapp' + os.sep + 'web_app_api.feature', 'Verify List of devices in my network')
def test_verify_list_of_devices_i... |
999,967 | f67a1b64b7eff6deab1c43b13ff0bbfbfcefafe1 | import numpy as np
def lu_decomposition(matrix):
U = np.copy(matrix)
P = np.diag(np.ones(len(np.diag(U))))
i=0
j=0
while i<len(U) and j<len(U[0]):
pivot = np.argmax([abs(x) for x in U[i:,j]]) + i
if(U[pivot][j] == 0):
j+=1
else:
aux = [x for x in U[pivot]]
U[pivot,:] = U[i]
U[i,:] = aux[:]
... |
999,968 | 3e26ca4aef652d1e277381a6b2c88048699c48d2 | """
Non-overlapping Intervals
@ Greedy: The key point is try to select the interval with smaller end.
So we sort by interval.end, and try to select the selectable interval with smaller end first.
@ O(NlogN) time for sorting.
"""
class Solution(object):
def eraseOverlapIntervals(self, intervals):
... |
999,969 | d7723e68ee70b44aaa52856cd3666a9d7a68d4f7 | #Factory libraries
import re
import sys
import os
import inspect
import openpyxl
import datetime
import json
import string
import copy
import importlib
import datetime
import time
from datetime import timedelta
path = os.path.dirname(os.path.abspath(__file__))
#print "Path: ", path
#Changes to config path must be ref... |
999,970 | e9fe1ecd8fec7862766920426b68fe3efe210adb | #!/usr/bin/env python3
#conding=utf-8
#python version=3.6
#通过ssh 保存交换机配置脚本
import paramiko
device_list = ['192.168.99.2']
device_username = 'admin'
device_password = ''
command = 'dis cu'
for each_device in device_list:
client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.WarningPolicy... |
999,971 | 6273f30484a894ff0acde9a3b30577c7e030da36 | # Generated by Django 2.1.5 on 2019-04-06 23:54
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('my_stash', '0004_auto_20190407_0840'),
]
operations = [
migrations.RemoveField(
model_name='itemset',
... |
999,972 | 97e105a74a003a78dc0a6ec2650a1c0dd41526b9 | #!/usr/bin/python3
from bs4 import BeautifulSoup
import json
import os
import random
import requests
import sys
# Get the config
config_path = input('Config file path: ')
with open(config_path, encoding='utf-8') as config_file:
config = json.load(config_file)
# Get teams to exclude
to_exclude_str = input('Team ID... |
999,973 | 901e9154f89a77e51e8eda0b779bc2f14111d369 | SWITCH_PROFILE = """mutation switchProfile($input: SwitchProfileInput!) { switchProfile(switchProfile: $input) { __typename account { __typename ...accountGraphFragment } activeSession { __typename ...sessionGraphFragment } } } fragment accountGraphFragment on Account { __typename id activeProfile { __typename id } pro... |
999,974 | 41df132e2c753d7c624cedb483ce8d0f12020852 | # -*- coding: utf-8 -*-
import random
from itertools import combinations, chain
from collections import Counter
def gen_scores(num_campany=4, num_students=10):
"""
企業ごとの学生に対するscoreマップを生成
TODO:外部ファイル読み込みにしたほうがよさ気
"""
scores = []
for i in range(num_campany):
score = list(range(num_studen... |
999,975 | 3d7b687328a6e06c63132bb66d82666240856925 | import os
import shutil
from git import Repo
from scripts.git_utilities import GitUtilities
from scripts.project_details import ProjectDetails
from scripts.release_details import ReleaseDetails
from scripts.utilities import assert_step, replace_text_in_file, use_directory, run, check_url_exists, \
ensure_director... |
999,976 | 4829aa424b8f6bba0d19e3b1bd1006c0ba94829d | s = '''
{ 1, 0, 0, 0},
{ sqrt(3)/2, 0, 0, 0.5},
{ sqrt(3)/2, 0, 0, -0.5},
{ 0.5, 0, 0, sqrt(3)/2},
{ 0.5, -0, -0, -sqrt(3)/2},
{ 0, 1, 0, 0},
{ 0, sqrt(3)/2, 0.5, 0},
{ 0, sqrt(3)/2, -0.5, 0},
{ 0, 0.5, sqrt(3)/2, 0},
{ -0, 0.5, -sqrt(3)/2, -0},
{ 0, 0, ... |
999,977 | 3efde453c59554bde3b389675cfa5e8e01305fe6 | from flask import make_response, jsonify, request
parties = {}
class Party(object):
def __init__(self):
self.party_id = 0
self.party_name = ''
self.logo = ''
self.members = ''
self.parties = parties
@staticmethod
def add_party(party_name, logo, members):
"... |
999,978 | 35b85b50e4b9550195f597408844880b1357cf93 | units = {"tank", "plane", "ship", "dog"}
print(units)
# Add lisää yhden arvon settiin
units.add("zeppelin")
print(units)
# Update lisää taulukollisen alkioita settiin
units.update(["helicopter", "juri"])
print(units)
# discard poistaa alkion setistä, heittämättä virhettä
units.discard("dog")
units.discard("dog")
pri... |
999,979 | d000eb7141067fe8b0468323cb03286470c5448e | # -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-09-01 06:58
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('movie', '0025_notfoundmovie_release_date'),
]
operations = [
migrations.AddF... |
999,980 | 0dd3d8384856a002f6b07581b678b8102d166922 | import psycopg2
DB_NAME = "iuwubbvc"
DB_USER = "iuwubbvc"
DB_PASS = "wJIkY9ANC0Pe2VWsocTrDCxoft1VSTtm"
DB_HOST = "isilo.db.elephantsql.com"
DB_PORT = "5432"
conn = psycopg2.connect(database=DB_NAME,user=DB_USER,password=DB_PASS,host=DB_HOST,port=DB_PORT)
print("database connected successfully")
cur=conn.cursor()
cu... |
999,981 | feffcef2d34870f2187aa4f4e47d38a0459162bd | def s():
[n,m] = list(map(int,input().split()))
a = [input() for _ in range(n)]
b = {input() for _ in range(m)}
res = [[]]
aa = len(a)*[False]
def r(x=0):
if x == n:
p = [a[i] for i in range(n) if aa[i]]
if len(p) <= len(res[0]):
return
for i in p:
for j in p:
if i+' '+j in b ... |
999,982 | 4ab78fe433d41686014d94286b048e1d6cf7dc41 | # ------------------------------------------------------------------------------
# Copyright 2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://w... |
999,983 | 215ebe5f150e15d9704074404022911dc9efa6ce | import os
import subprocess
import gevent
import pytest
@pytest.mark.skipif(
not (gevent.version_info.major >= 1 and gevent.version_info.minor >= 3), reason="gevent 1.3 or later is required"
)
def test_gevent_warning(monkeypatch):
subp = subprocess.Popen(
("python", os.path.join(os.path.dirname(__fil... |
999,984 | f124719b46b04b346a3a20f1b98a16cd8d5a853a | import paho.mqtt.client as mqtt
import MySQLdb
import json
#import datetime
import sys
#import time
from datetime import datetime
import requests
####################################################
def get_data(mosq,obj,msg):
db = MySQLdb.connect("localhost","root","root","myPrototype")
cursor = db.cursor()
... |
999,985 | 37db8e7ef464a97dc420717372a747d428ea5e82 | import pickle
from getDictionary import get_dictionary
meta = pickle.load (open('../data/traintest.pkl', 'rb'))
train_imagenames = meta['train_imagenames']
# -----fill in your implementation here --------
# Adjust these values for potentially more accurate results
a = 200
k = 500
imgPaths = ["../data/" + path for... |
999,986 | e861de441b15f3d0762500ea00018d355bac5f44 | #!/usr/bin/env python
# git-cl -- a git-command for integrating reviews on Rietveld
# Copyright (C) 2008 Evan Martin <martine@danga.com>
import getpass
import optparse
import os
import re
import subprocess
import sys
import tempfile
import textwrap
import upload
import urllib2
import projecthosting_upload
import cl_se... |
999,987 | 46fd993a0ff8bf5d39dbbe47280fd587c2cd2059 | class Solution:
def isMonotonic(self, A):
"""
:type A: List[int]
:rtype: bool
"""
if not A:
return False
if len(A) == 1:
return True
big = lambda x, y: x >= y
small = lambda x, y: x <= y
if A[-1] - A[0] >= 0:
... |
999,988 | 4b75f4c935919c349e8f6e487ed686b4b3e36dfd | """ Napisz funkcję która zwraca listę liczb pierwszych aż do zadanej wlącznie.
Funkcja ma nazywać się primes i przyjmować jeden argument: to_number. """
def primes(number):
lst = []
k = 0
for i in range(2, number+1):
for j in range(2, i):
if i % j == 0:
k = k + 1
... |
999,989 | e80dc850d31b14188a55c38a3f487de0e71ee6bf | from pykinect2 import PyKinectV2
from pykinect2.PyKinectV2 import *
from pykinect2 import PyKinectRuntime
import pygame
TRACKING_COLOR = pygame.color.Color("green")
HIGHLIGHT_COLOR = pygame.color.Color("red")
BG_COLOR = pygame.color.Color("white")
class BodyGameRuntime(object):
def __init__(self):
pyga... |
999,990 | 75d169a6fd8a39d0cd8ee8aa37d543fc8cc5a163 | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
from enum import Enum
__all__ = [
'KnownDataCollectionEndpointResourceKind',
'KnownDataCollectionRuleResourceKind',
'KnownDataFlowStreams'... |
999,991 | ed3a61e5d28b6518a622f8386b01ddc4c4c77a51 | import csv
from collections import defaultdict
import numpy as np
from sklearn.cross_validation import train_test_split
from pre_survey import *
from sets import Set
responseUserID = {}
userScore = {}
userVideoTime = {}
userVideoMatrix = {}
videoNames = []
videoCounts = defaultdict(int)
videoCountsClassification = def... |
999,992 | 0722aec69a901e906b5b1f0fbc1a844ddb13e623 | from hashlib import sha256
import json
import time
import pymongo
from pymongo import MongoClient
from flask import Flask, request,flash
import requests
import copy
import quality_control
class Block:
def __init__(self, index, transactions, timestamp, previous_hash, nonce=0):
self.index = index
sel... |
999,993 | 71e984e071f95075e16eeb209d5d5f221858aa6d | # DROP TABLES
songplay_table_drop = "DROP TABLE songplays CASCADE"
user_table_drop = "DROP TABLE users CASCADE"
song_table_drop = "DROP TABLE songs CASCADE"
artist_table_drop = "DROP TABLE artists CASCADE"
time_table_drop = "DROP TABLE time CASCADE"
# CREATE TABLES
songplay_table_create = """CREATE TABLE IF NOT EXIS... |
999,994 | 20c277ff663c86e7a46e3bb593e17cc0b0183c70 | # !/usr/bin/env python
# -*- coding: utf-8 -*-
import json
import pymysql
def insert_new_user(stime, y, y_sum):
sql = "INSERT INTO new_user (day_t,hour0, hour1, hour2,hour3,hour4,hour5,hour6,hour7,hour8,hour9,hour10,hour11,hour12,hour13,hour14,hour15,hour16,hour17,hour18,hour19,hour20,hour21,hour22,hour23,sums)VA... |
999,995 | 53217abbbe75ca8b9da8b0948fc526b04ea28e50 | import pandas as pd
import csv
import argparse
import numpy as np
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='choose test result path')
parser.add_argument("-output", default=None, type=str, required=True)
parser.add_argument("-k", default=None, type=int, required=True)
... |
999,996 | b0c286b3e51ad59bbcde27114d3f049e62782d5d | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# for large table should be replaced
# to non-recursive version of algorithm
def findCycles(graph, begin, current, path = None, paths = None):
if path is None:
path = []
if paths is None:
paths = []
path.append(current)
current_node_... |
999,997 | 6bbdc30b872115a9afc2fca1ccb194ca66ea3ebf | # -*- coding: utf-8 -*-
from halo import Halo
import subprocess
import requests
import random
import sys
import json
output_file = open('.work/context', 'w')
feedback_file = open('.work/feedback', 'w')
setup={}
spinner = Halo(text='Loading', spinner='dots')
GKE_NUM_DEPLOYMENTS=3
GKE_FRONTEND='3000'
GKE_DB='9200'
GK... |
999,998 | a34b7b8017b43b499fa8bb3df7fb9270ada7f0ac | # an array of state dictionaries
import random
states = [
{"name": "Alabama", "capital": "Montgomery"},
{"name": "Alaska", "capital": "Juneau"},
{"name": "Arizona", "capital": "Phoenix"},
{"name": "Arkansas", "capital": "Little Rock"},
{"name": "California", "capital": "Sacramento"},
{"name": ... |
999,999 | 3ed1d9b84ee80055ace62d6981b8575cee869d72 | from __future__ import annotations
import logging
from abc import ABC, abstractmethod
from typing import Any, Generic, Iterable, List, Mapping, TypeVar
from snuba.utils.codecs import Encoder, TDecoded, TEncoded
logger = logging.getLogger("snuba.writer")
WriterTableRow = Mapping[str, Any]
T = TypeVar("T")
class ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.