index int64 0 1,000k | blob_id stringlengths 40 40 | code stringlengths 7 10.4M |
|---|---|---|
990,200 | 090a22514c4476415811b86530a294b86a1acae4 |
learning_step = 0
total_learning_step = 200
learning_candidates = 128
learning_selected = 64 # batch_size
learning_up = 2
learning_down = 1
learning_rate = 0.0001
lambda_starter = 1
fixed_lambda = -1 # -1 starts \lambda-curriculum
# FULL: FetchReach-v1, HandReach-v0, HandManipulateEggFull-v0
# ROTATION: HandManipul... |
990,201 | 7b9f2fe13aab2e800179bc32ef410996bcf53552 | import numpy as np
import tensorflow as tf
import pandas as pd
import div_tools as dt
import div_tools_np as dtnp
import matplotlib.pyplot as plt
from scipy.special import logit
import cPickle
from scipy.misc import imresize
from scipy.spatial.distance import pdist, squareform
def zeros(shape):
return tf.Variab... |
990,202 | e1be1ed43a6c0b6c41fb86e1d2546ab50858009a | '''
内建函数
'''
str1 = '123456'
print(len(str1))#长度
print(max(str1))#最大值
print(min(str1))#最小值
#求和
# print(sum(str1))#报错 字符串里面的字符不能直接相加
list1 = []
for ch in str1:
list1.append(int(ch))
sum(list1) |
990,203 | a06d04daee932555d46805d43e35aeaa7b2b78d1 | #!/usr/local/env python
# -*- coding: utf-8 -*-
'''
Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.
The brackets must close in the correct order, "()" and "()[]{}" are all valid but "(]" and "([)]" are not.
'''
class Solution:
# @return a boo... |
990,204 | fa04e9161db0914b5f7de74bbacf0ee43c9f8e1d | def sqlsentance():
print('mysql语句') |
990,205 | 6852bfec968675c66945c8457d351ce330a2a63a | import os
import csv
dirname = os.path.dirname(__file__)
csvpath = os.path.join(dirname, 'PyBank_data.csv')
outputpath = os.path.join(dirname, 'PyBank_Output.txt')
totalAmount = 0
totalMonths = 0
currentAmountChange = 0
nextAmount = 0
previousAmountChange = 0
changeAmount = 0
greatestMonth = ''
lowestAmountChange = 0... |
990,206 | 2f6d3320ad95a3471c1edf1a328a296d9c79d20b | from collections import namedtuple
import numpy as np
__all__ = ["extract_options", "make_cube", "inf_cube", "incube",
"uniform", "gaussian",
"individual", "collective", "rotative", "mh"]
Id = lambda x, *vargs, **kvargs: x
MESSAGE = "Starting point outside of the domain."
Roaming = namedtuple... |
990,207 | 548abb9274610c0aa46703f47ed5f9eb58c5fdd7 | from __future__ import unicode_literals, print_function, division
from io import open
import unicodedata
import string
import re
import random
import pickle
import numpy as np
import scipy.spatial
import torch
import torch.nn as nn
from torch.autograd import Variable
from torch import optim
import torch.nn.functional... |
990,208 | f23f3f977d93e2077fc957386e37ede3341e2752 | # Tool to collect generated files for deployment
import argparse
import collections
import json
import os
import re
import subprocess
import sys
parser = argparse.ArgumentParser(description='Collect files for deployment')
parser.add_argument('staticprep_files', nargs='+', metavar='STATICPREP_FILES', help='files produ... |
990,209 | f420b6dc058a92f5999c56fb70e910e792e8bd48 | # -*- coding: utf-8 -*-
"""
Created on Fri Nov 16 18:12:19 2018
@author: 18665
"""
from saveSymbolList import filename
def get_all_symbol_detail():
import json
with open(filename,'r') as f:
symbolList = json.load(f)
return symbolList
def symbol_replace(symbol):
... |
990,210 | 5ff53f2d59085c7e937e07fef4b256f0ac78d888 |
__author__ = 'Ловягин Даниил Анатольевич'
# Задача-1: Ввести ваше имя и возраст в отдельные переменные,
# вычесть из возраста 18 и вывести на экран в следующем виде:
# "Василий на 2 года/лет больше 18"
# по желанию сделать адаптивный вывод, то есть "на 5 лет больше", "на 3 года меньше" и.т.д.
# TODO: код пишем тут...
... |
990,211 | e5928fc7f8aafaaa490e6996df9e918898bef24b | # -*- coding: utf-8 -*-
'''
'''
class Json(object):
pass |
990,212 | 6be1d9db7a19f27de362a10d02bf0914718aa585 | #!/usr/bin/env python
from ast import *
import ast, md5
import sys
import nodeTransformer
import os.path, os
import zipfile
from nodeTransformer import str2ast, AstVariable
from pyModule import *
from script2script.tools import echo
#TODO don't forget the With ast stuff
#TODO for the future, add a list of import t... |
990,213 | 77f50205e818787a7d55bb461e3b837dea6e42c3 | class Employee:
def __init__(self, username=""):
self.username = username
def json(self):
return {
"username": self.username,
}
def __repr__(self):
return str(self.json())
@staticmethod
def json_parse(json):
employee = Employee()
employe... |
990,214 | 7e6443b35948109196a32bc78c27a1f419ff3270 | cube = np.array([0.01, 0.01, 0.01]) |
990,215 | d3edc0ebaaf5f58d3280c5651a67e788967d6bac | from inventory import Inventory
class Player():
def __init__(self, name, room, score=0):
self.name = name
self.room = room
self.score = score
Inventory.__init__(self, self.name)
def changeRoom(self, direction):
next_room = self.room.getRoomInDirection(direction)
... |
990,216 | 6c43494e84d1ce80807a9565cd11a125218a0c5c | import unittest
import numpy as np
import torch
from numpy.testing import assert_equal
from attack import class_ensemble
class TestUtils(unittest.TestCase):
def test_class_ensemble(self):
a = torch.tensor([[3, 2, 1], [1, 2, 1], [3, 2, 2]])
a = a.numpy()
print(a.shape, a)
a = np.ar... |
990,217 | 2434f48368a348608edaf65da2d616bf96d025e8 | from collections import deque
import sys
input = sys.stdin.readline
for _ in range(int(input())):
n,m=map(int,input().split())
nodes=[[] for _ in range(n)]
for _ in range(m):
a,b=map(int,input().split())
nodes[a-1].append(b-1)
nodes[b-1].append(a-1)
q = deque([0])
vstd=[False... |
990,218 | 2ac1a5d9aa2346538268065b138c8d854502d4b4 | from sklearn.metrics import mean_squared_error
from math import sqrt
class RMSEEvaluator:
def __init__(self, decoratee=None):
self._decoratee = decoratee
def evaluate(self, matrixA, matrixB):
# for i, el in enumerate(matrixA):
# print("{0:.2f}|{1:.2f}".format(el, matrixB[i]))
... |
990,219 | d220eb94d502800f072588376bd2dc069773eaf9 | #!/usr/bin/env python2
# -*- coding: utf8 -*-
#
# Copyright (c) 2017 unfoldingWord
# http://creativecommons.org/licenses/MIT/
# See LICENSE file for details.
#
# Contributors:
# Jesse Griffin <jesse@unfoldingword.org>
"""
This script was used to convert the MD tN files to TSV format.
Ran on 2018-05-31, see https:... |
990,220 | cbadc1a84fbb808c7ae3757be3d2cf81df35cd54 | list1 = [1, 2, 5, 14, 20, 30, 12, 200, 69, 83]
list1.sort()
for num in list1:
if num % 2 == 0:
print(num, end = ", ")
|
990,221 | 25a75c6dd732264cf646f6045ce4e9df30140062 | from flask import Flask, render_template, request
app = Flask(__name__)
@app.route('/')
def index():
return render_template('inicio.html')
@app.route('/contacto')
def contacto():
return render_template('contacto.html')
@app.route('/nutriologa')
def nutriologa():
return render_template('nutriologaexperie... |
990,222 | b00fd8f489db75003b45ee393989a5aec8cb6158 | # Generated by Django 3.2.6 on 2021-08-12 06:22
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("lists", "0001_initial"),
]
operations = [
migrations.AlterModelTable(
name="item",
table=None,
),
]
|
990,223 | 6c6ae3d061766754ecde4f0ada127e39ec64853d | import autofit as af
import autolens as al
from test_autolens.integration.tests.interferometer import runner
test_type = "lens__source"
test_name = "lens_light_mass__source__hyper_bg"
data_name = "lens_light__source_smooth"
instrument = "sma"
def make_pipeline(name, folders, real_space_mask, search=af.DynestyStatic(... |
990,224 | 7fac9762f26a47d0af72998999710da13dbdf67d | import random
numbers = random.sample(range(100), 10)
print(numbers)
numbers_filtered = list(filter(lambda x: x % 2 != 0, numbers))
print('Numbers after filter(x % 2 != 0) : ', numbers_filtered)
numbers_squares = map(lambda x: x ** 2, numbers_filtered)
print('Squares of filter numbers : ', list(numbers_squares))
|
990,225 | 1e43d8d117c67f97d1ec2abcdd621dea44acd8ae |
def isAsendingOrder(n):
str_n = str(n)
l = len(str_n)
v = [int(str_n[i]) for i in xrange(0, l)]
for i in xrange(0, l-1):
if(v[i] > v[i+1]):
return False
return True
def minimize(n):
while(True):
str_n = str(n)
l = len(str_n)
v = [int(str_n[i]) for i in xrange(0, l)]
split_idx = ... |
990,226 | 3b22bb8b491b8e484902b785dd29f4f754441fd4 | import base64
import random
from PositionSpiderProject.conf.user_agent import USER_AGENT_LIST
class RandomUserAgent(object):
def process_request(self, request, spider):
request.headers['User-Agent'] = random.choice(USER_AGENT_LIST)
class IPProxyOpenDownloadMiddleware(object):
"""
芝麻代理:http://h... |
990,227 | 751dc91de36dac49958e9c9302cf377d74066d9b | /media/swaggyp1985/SSD1T/Software/miniconda3/lib/python3.7/ntpath.py |
990,228 | 8cd5bd927e13843aa4398354c7db324107b6f1c0 | # Generated by Django 3.1.5 on 2021-01-27 02:11
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('users', '0001_initial'),
]
operations = [
migrations.RenameField(
model_name='master',
old_name='master_payment',
... |
990,229 | ad4d327d3790928fca1208ea803c4532b3eef1e4 | ../../../../micropython-lib/urequests/urequests.py |
990,230 | 9fbd6ac358769bce7664576240cd1ee4d9d12bd9 | from django.apps import AppConfig
class ShowcenterConfig(AppConfig):
name = 'showcenter'
|
990,231 | a4a04fb7f9824cebc64a88f25688ccf4d1b1899f | #given a string of ascii characters, write a function that returns True if all the characters are unique, and false if they are not
# don't use any built in python functions
def is_unique(word):
if not word:
return None
chars_dict = {}
for char in word:
if char in chars_dict:
return False
chars_dict[cha... |
990,232 | b8360a6914e1ca964e76d5a2b3a82406744149ea | #!/usr/bin/python
import MySQLdb
# connect
#db = MySQLdb.connect(host="10.201.148.115", user="root", passwd="em7admin",db="master")
myDB = MySQLdb.connect(host="10.201.148.115",port=7706,user="root",passwd="em7admin",db="master")
cHandler = myDB.cursor()
cHandler.execute("SHOW DATABASES")
results = cHandler.fetchall(... |
990,233 | 119b57fde556da4e3acee140e30009d710eb945a | from fastapi import FastAPI, Header, HTTPException
from pydantic import BaseModel
import uvicorn
import requests
from datetime import datetime
import sqlite3
import json
class SkatUser(BaseModel):
UserId: int
class SkatYear(BaseModel):
label : str
startDate: datetime
endDate: datetime
class Tax(BaseModel):
Use... |
990,234 | f9aa88c7a0bed94ee5b8c7aa5728faf161f5fad5 | """
Основной скрипт который запускает тесты и сохраняет графики
"""
from test import kernel_test, single_core_fibonacci
from grafic_test import grafic
from throttling import trottling
print("Start testing")
RESULT_FIBONACCI_TEST = single_core_fibonacci()
grafic(RESULT_FIBONACCI_TEST[1], "TEST_FIBONACCI")
trottling(RE... |
990,235 | 69cab3d0e190970b53d88450d20465d4112bb828 | from django.conf.urls import url
from apps.hobbygroups.dashboard import views
urlpatterns = [url(r"^.*$", views.index, name="hobbies_dashboard_index")]
|
990,236 | 5a52a4edcfd38cae62b0745cad7c982875d56949 | #!/usr/bin/env python
'''
This module computes weekly midday vapour pressure deficit (VPD) values
and thermal time from DWD (German Weather Service - http://www.dwd.de)
XML data
'''
import sys
import os
import re
import math
import datetime
from collections import defaultdict
import numpy as np
from lxml import etre... |
990,237 | 480850b4837fef829a89da5eb347b3e3625bd861 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Adapted from:
# https://github.com/youtube/api-samples/blob/master/python/my_uploads.py
# https://github.com/youtube/api-samples/blob/master/python/upload_video.py
import httplib2
import os
import logging
from googleapiclient.http import MediaFileUpload
from google... |
990,238 | 729e625d07bbabc59c6fbb00b3cf1c0acc0c390e | import nonebot
from nonebot import logger
from nalomu.commands import ImageCommand, method_command
def chunks(l, n):
"""Yield successive n-sized chunks from l."""
for i in range(0, len(l), n):
yield l[i:i + n]
class UsageCommands(ImageCommand):
@method_command('usage', aliases=['使用帮助', '帮助', '... |
990,239 | 96e348fb1c14a768752c1a669293c20efcae4ca8 | #encoding: utf-8
# desc: 此文件用于存放常用的sql语句,达到解耦的目的 |
990,240 | 68ca4670e5a320177c95fde37b249ed0f94adf0e | # empty blanks
blanks = ["___1___", "___2___", "___3___", "___4___"]
# Game level
# Easy
easy_level = '''A ___1___ is created with the def keyword. You specify the inputs
a ___1___ takes by adding ___2___ separated by commas between the parentheses.
___1___s by default return ___3___ if you don't specify the value to ... |
990,241 | 0dacc15fba989a567e992b065833569ac9ea5003 | #! /usr/bin/python
# -*- coding: utf-8 -*-
import pymongo
db_name = 'nlp100_pizzaboi'
def bigram(sentence):
bigrams = []
sentence_uni = unicode(sentence)
for i in xrange(len(sentence_uni) - 1):
bigrams.append(sentence_uni[i:i+2])
return bigrams
def tweet2dict(t):
names = ('url','data','user','name','body','r... |
990,242 | 0db5903aee64b08c9d426a45cba1a2c0fee2a341 | input("It is working if it pauses for input!")
|
990,243 | d64c330e8c60076df836f517e84d32c530008cb5 | # -*- coding: utf-8 -*-
"""
Created on Thu Oct 24 11:32:44 2019
@author: LocalAdmin
DMM module for the Keithley 2110 5 1/2 Digit Multimeter
"""
# Standard libraries
import pyvisa as visa
import time
import datetime
import numpy as np
import matplotlib.pyplot as plt
import pickle as pkl
import os
# Custom libraries
... |
990,244 | 9685ab273ff045d83cdcf18fc257aff4008f3419 | import pandas as pd
from matplotlib import pyplot as plt
data = pd.read_csv('matplotlib5.csv')
ages = data['Age']
dev_salaries = data['All_Devs']
py_salaries = data['Python']
js_salaries = data['JavaScript']
# creating two regular line graphs
plt.plot(ages, dev_salaries, color='#444444',
linestyle='--', labe... |
990,245 | 4ec01fc81ae581310f432db1f41e14c4922300ff | # read the three newest input files
# grab the uptime duration and compare it to the last known value stored in separate file
# if time increased, up
# else down
import sys
infile = sys.argv[1]
reffile = sys.argv[2]
strg1Read = open(infile,"r")
strg1Ref = open(reffile,"r")
refTimeStr = ""
for line in strg1Ref:
if... |
990,246 | ef5cd9bf188dc207c35f4cb9cefcca8f0353b150 | import os
from google.cloud import datastore
from google.cloud import storage
# os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = r'./etc/dbauthen.json'
# os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = os.path.join(
# os.path.dirname(os.path.realpath(__file__)), 'etc', 'dbauthen.json')
datastore_client = dat... |
990,247 | f4305adb064094df8849c6f08db0e3b9d19055d1 | # Released under the MIT License. See LICENSE for details.
#
# This file was automatically generated from "the_pad.ma"
# pylint: disable=all
points = {}
# noinspection PyDictCreation
boxes = {}
boxes['area_of_interest_bounds'] = (
(0.3544110667, 4.493562578, -2.518391331)
+ (0.0, 0.0, 0.0)
+ (16.64754831, ... |
990,248 | 3118c95b21d8ae6d6939ff37b3a4429c1303e02f | # -*- coding: utf-8 -*-
import scrapy
from scrapy import FormRequest,Request
from ..items import NewscrawlItem
from configparser import ConfigParser
import os
class avcjSpider(scrapy.Spider):
name = "avcj"
allowed_domains = ["www.avcj.com"]
start_urls = ['https://www.avcj.com/type/news']
login_url = ... |
990,249 | 030f7286275839982fae4f4e5a0f2bcba857046f |
def variable_valid(var):
var = var.lower()
if not 'a' <= var[0] <= 'z':
return False
return all([c.isalnum() or c == '_' for c in var])
|
990,250 | e1cc5815d1a61d2b15869fc74e5220f3523e7f27 | # -*- coding:utf-8 -*-
# 创建时间:2019-03-25 11:47:32
# 创建人: Dekiven
import os
from TkToolsD.CommonWidgets import *
from TkToolsD.ConfigEditor import ConfigEditor
tk, ttk = getTk()
# help(tk.Event)
class ConfigEditWindow(tk.Toplevel) :
'''ConfigEditWindow
'''
def __init__(self, *args, **dArgs) :
tk.... |
990,251 | 8a4971b00cdfe2932d801f18003463ff9c1423d0 | #!/usr/bin/python
# -*- coding: utf-8 -*-
import os, sys
import time
# add ../../Sources to the PYTHONPATH
sys.path.append(os.path.join("..", "..", "Sources"))
from yocto_api import *
from yocto_power import *
#Idea: Make function to write to file and then have another fuction to
#draw out the graph as it is appende... |
990,252 | c5245b1333f3e47ed5bb8a1169c18c49eea6dd2d | """
Given a list of non negative integers, arrange them such that they form the largest number.
For example:
Given [3, 30, 34, 5, 9], the largest formed number is 9534330.
Note: The result may be very large, so you need to return a string instead of an integer.
"""
class K:
def __init__(self, obj, *args):
... |
990,253 | ec36ae2d726c7bdbadad37551ee104c711871b7b | """
Application fixtures to easily create app instances
Examples:
$ python -m pytest
$ coverage run -m pytest
$ coverage report
$ coverage html
"""
import pytest
from starlette.testclient import TestClient
from app import ApplicationFactory
@pytest.fixture
def app():
"""debug application fixture... |
990,254 | 4ebd08d3798a0caa82b1572787115276878d5185 | import pickle
import os
import pandas as pd
from morphoclass import MorphoToken
def quartilecounter(dataset):
segment = []
for doc in dataset:
for sent in doc:
segment.append(len([token.form for token in sent if token.category == 'word']))
segment.sort()
if segment:
mean = ... |
990,255 | 7678c108c899d700c10b0fd74849685bae37f0b1 | import sys
from fenics import *
import mshr
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.tri as tri
def solve0(variant):
cur_var = int(variant)
alpha = 1
if(cur_var==1):
u_D = Expression('3 + 2*x[0]*x[0] + 3*x[1]*x[1]',degree=2)
g = Expression('(4*sqrt(x[0]*x[0]+x[1... |
990,256 | da90085e2d934ecf704ea275e18be0c8713be308 | # -*- coding: utf-8 -*-
from flask import Flask, request, session, g, redirect, url_for, render_template
from contextlib import closing
import sqlite3
# configuration
DATABASE = '/tmp/flaskr.db'
SECRET_KEY = "excuses_key"
app = Flask(__name__)
app.config.from_object(__name__)
class Excuse(object):
up_text = u... |
990,257 | 158d4bd0e35b3da867b68770914f2906e6418826 | import os
import sys
import boto3
import time
NAMESPACE = os.getenv('NAMESPACE', 'default')
class Metrics:
def init_metrics(self, app_name, component=""):
self.metrics = {}
self.app_name = app_name
self.dimensions = [{
'Name': 'namespace',
'Value': NAMESPACE
... |
990,258 | 8be4516cfab835a6aff3b1c6faf132fcd7d5e557 | from boardgamegeek import BGGClient
from django import forms
from django import forms
class SearchForm(forms.Form):
query = forms.CharField(label="query")
|
990,259 | 3d7c48e749de0b328af2d425aadf69f8a266081a | def content():
user_dict = {"Profile": [["Name", "#"], ["Date of Birth", "#"], ["Blood Group", "#"],
["Age", "#"], ["Update Details", "/update/"]],
"Home": ["Donate", "Your Contributions", "People"],
"Contact": ["sritejakittu777@gmail.com", "chinnichara... |
990,260 | ba85f3bb4b1b80f445ad3d936bc65c2e7a746710 | import numpy as np
from math import comb # Technically cheating by using a non standard library but I am NOT going to code in an nCr function.
file = open('day_10_data.txt')
data = np.empty((0,0), dtype = int)
for line in file:
data = np.append(data, int(line))
data = np.append(data, max(data)+3)
data = np.... |
990,261 | 11a0f683deb5835df2f4d3795b3fdc4b4f824848 | import telebot
bot = telebot.TeleBot( "917002472:AAGiOuSM_t0NzDgd3VQYmZecfI7TjYRZiZk" )
class Some_Info():
var_01 = None
gollum = Some_Info()
print(gollum.var_01)
@bot.message_handler(commands=['start', 'help'])
def send_welcome(message):
bot.reply_to( message, "Зря ты сюда зашел" )
@bot.message_handler( conte... |
990,262 | 133640b0ce38a1f81679f8b3f808aef8be42c5b9 | from core.exceptions import BaseNotExistsException
class OrderDoesNotExists(BaseNotExistsException):
pass
class OrderObjectiveNotExists(BaseNotExistsException):
pass
|
990,263 | 4871bfb5356f88b5833c9e42ce9f73f5f9e76916 | import PyPDF2
import re
import sys
import os
def main(args):
string = ''.join(args)
output = PyPDF2.PdfFileWriter()
pages = 0
# change these to whatever folders you want
slides_location = "put_pdfs_here"
output_location = "search_results"
for file_name in os.listdir(slides_location):
if "pdf" not i... |
990,264 | 5c408ef6fe61c75f68253af195386b3d051a0132 | """
Contains functions for creating a list of values that can be used to feed a generator.
See doc/11-expander for details.
"""
import pytweening
from melodomatic import consts
from melodomatic.util import *
# The master dictionary of known expander functions.
EXPANDERS = {}
# The same keys as in EXPANDERS, but sort... |
990,265 | ec7fbe5525783794c3b82c036193441e17cbe5c6 | senha = 2002
x = int(input())
while x != senha:
print('Senha Invalida')
x = int(input())
print('Acesso Permitido') |
990,266 | 855df6f8188e44cf891d36218c1ce96b128b7ac6 | import datetime
from flask import url_for
from app import db
class Users(db.Model):
__tablename__ = 'users'
__table_args__ = {'extend_existing': True}
id = db.Column(db.Integer, primary_key=True)
email = db.Column(db.String(120), unique=True)
password = db.Column(db.String(120))
projects = d... |
990,267 | 9567e6e1ec3c623c6c5af8fbf33f130159e7df74 | #-*- coding:utf-8 -*-
'''
author:niuniuniuniuniu
github:https://github.com/niuniuniuniuniu
'''
import requests
import re
import sys
import time
import json
from bs4 import BeautifulSoup as bsp
def get_token(urllogin,header):
try:res=requests.get(urllogin,header)
except:
print u"获取token失败"
sys.ex... |
990,268 | 59af0d986f21efd4b759b13d1d1f3a384b56de1e | def two_sum(lis):
m = { i:True for i in lis }
for i in lis:
if 2020 - i in m:
return (2020 - i) * i
return -1
def three_sum(lis):
seen = { i:True for i in lis }
for i,m in enumerate(lis):
for j,n in enumerate(lis):
if i >= j:
continue
... |
990,269 | 18425c4127be56a5198f64c28e7ee0664fa4fb32 | with open("input_1.txt") as f:
a = [int(l) for l in f]
for i in a:
for j in a:
for k in a:
if i + j + k == 2020:
print(i * j * k)
exit() |
990,270 | eb963086fc28c67950a45b081289cb7c8d47ce00 | class Solution:
"""
@param n: An integer
@param m: An integer
@param i: A bit position
@param j: A bit position
@return: An integer
"""
def updateBits(self, n, m, i, j):
# Java
# ((~((((-1) << (31 - j)) >>> (31 - j + i)) << i)) & n) | (m << i)
tmp = ((~((((-1) << ... |
990,271 | 65cb377d3f488033ec00ef46880029642d917e8b | import socket
import time
delay = 3
def fail(msg):
print("TEST FAILED: ",msg)
exit()
de1_address = "192.168.1.123"
de1_port = 41234
receiver = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
receiver.bind(("0.0.0.0",8082));
sender = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
#################... |
990,272 | 763ec5a1457236616bc23c620f5884bef397159a | from django.db import models
from Core.models import Location
class Equipment(models.Model):
tableTennisTables = models.IntegerField(default=0)
poolHoist = models.IntegerField(default=0)
bowlingMachine = models.IntegerField(default=0)
trampolines = models.IntegerField(default=0)
parallelBars = mo... |
990,273 | bfe331e593ad87c0946c532cc747a4c9bcc228e7 | from django.contrib import admin
from models import Page, Revision
admin.site.register(Page)
admin.site.register(Revision)
|
990,274 | e3033f31d54461020e1e466487f46d08b7cc1231 | from django.urls import path
from . import views
app_name = 'telegram_bot'
urlpatterns = [
path('callback/<str:bottoken>/', views.callback, name='callback'),
path('cities/NL/', views.cities, name='citiesNL'),
] |
990,275 | 33acd8a6bf521e0bbce64007c8787c7ed782beda | import sys
from datetime import datetime
log_class = None
class Log:
def __init__(self, file_name):
self.log_file = open(file_name, 'w')
def log(self, message):
msg = str(datetime.now().time()) + ": " + str(message) + '\n'
self.log_file.write(msg)
self.log_file.flush()
... |
990,276 | 77003941d261023e208d3f96e4da2f7eb7500931 | import webbrowser
import socket
import random
import requests
import sys
from server import Server
import os
HOST = '127.0.0.1' # Standard loopback interface address (localhost)
PORT = 4440 # Port to listen on (non-privileged ports are > 1023)
SERVERS_PORTS = [4441,4442,4443,4444,4445,4446,4447]
SERVERS = []
# c... |
990,277 | e2402c758ca3d2c9b85a8509e30275483143844f | #!/usr/bin/env python
# coding=utf-8
# Date: 2018-07-18
"""
https://leetcode.com/problems/prime-number-of-set-bits-in-binary-representation/description/
762. Prime Number of Set Bits in Binary Representation
Given two integers L and R, find the count of numbers in the range [L, R] (inclusive) having a prime number o... |
990,278 | bb736f62be745d283d35e0a57a51fe263ab2016d | #!/usr/bin/evn python
# coding=utf-8
import unittest
from common import db_helper
from config import db_config
class DbHelperTest(unittest.TestCase):
"""数据库操作包测试类"""
def setUp(self):
"""初始化测试环境"""
print('------ini------')
def tearDown(self):
"""清理测试环境"""
print('------clea... |
990,279 | fd48f7c8be7a5cabf2ed8e0630863279964c9bd9 | a=1
1123
#i went back to change1
#i was changed in dev branch
#edit in master and dev
|
990,280 | a79ace427a105cb6ee07f3c2a923f35ef5c6bac5 | #! /usr/bin/python
from matplotlib import use
use('agg')
import pymultinest
from sbms.engine import engine
from sbms.marginals import marginals
from sbms.io_sbms import read_ini
import json
import optparse
import numpy as np
from jinja2 import Environment, PackageLoader
"""
This is an example script that runs the analy... |
990,281 | bbbffc06e5e3ab2b43dd4bb8db39060069ce1cbd | #WAP to accept 2 strings from user and check if 2nd string is right rotation of 1st eg: 1st: manager 2: germana
str1 = input("Enter a 1st sting: ")
str2 = input("Enter a 2nd string: ")
'''
res=str1[len(str1)-3:] + str1[0:str1(len)-3]
res in str2
'''
print str2 in (str1+str1) |
990,282 | 3fd446451fa19610eb3a50b7eb04011f43e78ce0 | names = ['dejan', 'marko', 'cika', 'ivce']
print(names[0])
print(names[1])
print(names[2])
print(names[3]) |
990,283 | 92421343b461f8b3dee61e2e8397fcee86cee911 | from typing import List, Optional
from allennlp.common.util import JsonDict
from allennlp.data import Instance
from allennlp.data.dataset_readers import DatasetReader
from allennlp.data.tokenizers.spacy_tokenizer import SpacyTokenizer
from allennlp.models import Model
from allennlp.predictors.predictor import Predicto... |
990,284 | cd6124d1eab77349e7fa10ca4ee9b16855ed79cb | import random
from tkinter import *
from tkinter import filedialog as fd
from tkinter import messagebox as mb
from DrawScheme import *
use_els = ["resister", "switch", "lamp", "motor", "button", "bell", "condensator"]
def make_field(sch):
min_x = float("INF")
min_y = float("INF")
max_x = -float("INF")
... |
990,285 | 9bf983d79432a80518d8bb6d2e9ab4d008a0280e | from django.conf.urls import patterns, url, include
from rest_framework.routers import SimpleRouter
from api import views as api_views
router = SimpleRouter(trailing_slash=False)
router.register('children', api_views.ChildViewSet)
router.register('parents', api_views.ParentViewSet)
router.register('sitters', api_views... |
990,286 | 7fbcf8d11b07bd73edb4a0715d4ef7a706a07149 | # MIT License Copyright (c) 2019-2023 rootVIII
from boto3.session import Session
class S3:
def __init__(self):
self.session = Session()
class S3Client(S3):
def __init__(self):
S3.__init__(self)
self.session_client = self.session.client('s3')
def upload_s3(self, file_path: str, b... |
990,287 | ba61892d0a61ad2f8ae2488370c6222d9f5f92e4 | import random
import pyowm
from pyowm import OWM
import vk_api
from vk_api.longpoll import VkLongPoll, VkEventType
def write_msg(user_id, message):
vk.method('messages.send', {'user_id': user_id, 'message': message, 'random_id': random.randint(0, 2048)})
# API-keys
owm = pyowm.OWM('OWM Token...', language=... |
990,288 | d66524893673d706b889cc177a0d3fa38d084a17 | import asyncio
from pyppeteer import launch
async def main():
# ブラウザ起動
browser = await launch(headless=False)
# タブを開く
page = await browser.newPage()
# URLのページを開く
asyncio.gather(
page.goto('https://www.yahoo.co.jp/'), # URLのページを開く
page.waitForNavigation() # ペー... |
990,289 | 550ea2f76483cd4ec4f50b502ec76a4c2edb2264 | from invisibleroads.scripts import launch
CONFIGURATION_TEXT = '''\
[app:main]
use = egg:pyramid
data.folder = %(here)s/data
'''
class TestInitializePostsScript(object):
def test_run(self, mocker, tmp_path):
data_folder = tmp_path / 'data'
assert not data_folder.exists()
for function_n... |
990,290 | 59eaade0867ae71fc6e28e06044ad8f670d2da72 | import itertools
class Solution(object):
def countAndSay(self, n):
"""
:type n: int
:rtype: str
"""
res = "1"
for i in range(n-1):
res = ''.join([str(len(list(group))) + digit for digit, group in itertools.groupby(res)])
return res
foo =Solutio... |
990,291 | 67b57d73998c3d554dbc033fd3644dc8bcc91980 | print('Nilai kecocokan menu: ', valueMenu) |
990,292 | a21987b8efd0bf6a2fe96c5a28baa18e59d1c01f | import unittest
from unittest import mock
from pythonforandroid.build import run_pymodules_install
class TestBuildBasic(unittest.TestCase):
def test_run_pymodules_install_optional_project_dir(self):
"""
Makes sure the `run_pymodules_install()` doesn't crash when the
`project_dir` optiona... |
990,293 | 8ec09e94feb40bb9cf051476a5b9704cd2f7cab3 | import unittest
from core.lexer import Position, Lexer, Token, TokenKind
from core.vartypes import VarTypes
class TestLexer(unittest.TestCase):
maxDiff = None
def _assert_toks(self, toks, kinds):
"""Assert that the list of toks has the given kinds."""
self.assertEqual([t.kind.name for t in t... |
990,294 | 9ac76abdd8c9686e59ee13f1ed8d49ad7226aefc | def MTC(time):
times = time.split(":")
hours = int(times[0])
minutes = int(times[1])
total = hours*60
total = total + minutes
return total
def toMTC(time):
minutes = time%60
hours = (time-minutes)/60
hours = int(hours)
hours = str(hours)
minutes = int(minutes)
minutes = ... |
990,295 | e58b4889e02a9e625176b3a55c49923b9e6bfb33 | puzzle = open('puzzle').read().splitlines()
puzzle = [i.split() for i in puzzle]
def RepresentsInt(s):
try:
int(s)
return True
except ValueError:
return False
registers1 = {str(i[1]): 0 for i in puzzle if not RepresentsInt(i[1])}
registers1['p'] = 0
registers1['que'] = []
idx1 = 0
re... |
990,296 | 111606ca41fa45c3d2a2db502056748b32da6bd4 | from app.crawlers.intelius.intelius_results import IntelliusResults
from app.web_automation.elements.div import Div
from app.web_automation.page_objects.page import Page, which_page_loads
class IntelliusSearching(Page):
"""
Interface to the intelius.com page displayed when a search is in progress.
"""
... |
990,297 | bab83cbca52cf3e67841d1096d466896308007ee | #!../../software/pyhail.sh
import hail
from hail.representation import Interval
hc = hail.HailContext(log = 'log/08_test_rs6857.log', tmp_dir = 'tmp/hail')
vds = hc.read('../MGRB.phase2.SNPtier12.match.vqsr.minrep.locusannot.WGStier12.unrelated.tgp.hrc.gnomad.dbsnp.clinvar.cato.eigen.vep.vds')
(vds
.filter_inte... |
990,298 | 2a35835f50dae2e71b97eb6604726cfdb1f78bff | # Generated by Django 3.2.7 on 2021-09-02 02:20
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
ope... |
990,299 | 0064cb720568c05c4daeeee804da74aaa4a761b2 | from account.models import User
from knox.models import AuthToken
from rest_framework import generics, permissions
from rest_framework.response import Response
from .serializers import SponsorSerializer, RegisterSponsorSerializer, LoginSponsorSerializer
class RegisterSponsor(generics.GenericAPIView):
serializer_cl... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.