index int64 0 1,000k | blob_id stringlengths 40 40 | code stringlengths 7 10.4M |
|---|---|---|
998,400 | 76995da8a2afef9be7423b16d89f971eff1bd9a5 | import os
from typing import NamedTuple, Optional
from jsonschema import validate
# ------------------------------
# Fail Faster
# ------------------------------
_CONFIG_SCHEMA = {
"type": "object",
"properties": {
"BATCH_ACCOUNT_NAME": {"type": "string"},
"BATCH_ACCOUNT_KEY": {"type": "string"... |
998,401 | cea0801b2efcdb817869d44cacab85622a05c87a | def is_empty(data_structure):
if data_structure:
#print("No está vacía")
return False
else:
#print("Está vacía")
return True |
998,402 | 0a3c624838c70bba9e1538243e80ca9c43cdbcf7 | #backward elimination regression
import pandas as pd
from sklearn.preprocessing import LabelEncoder
from sklearn.model_selection import train_test_split
import numpy as np
from sklearn.linear_model import LogisticRegression
dataset = pd.read_csv('Churn.csv')
dataset = dataset[dataset['TotalCharges']!=' ']
... |
998,403 | d758126f80ae04297642060d440280cce80fb75d | # import requests module
import json
import warnings
warnings.filterwarnings("ignore")
from time import sleep
from bitbucket_resource import Bitbucket
from doc360_resource import Project_Api, Category, Article,Teams,Reader_Group
def run_process():
"""Required External Data"""
workspace = "sample_work... |
998,404 | 1a20cb487e65dc716990fbcb9f89b8923bd91107 | from flask import Blueprint
# 创建蓝图对象
profile_blue= Blueprint("profile",__name__,url_prefix="/user")
# 装饰视图函数
from . import views
|
998,405 | 98f097be7a383ae4920558c575373ce36558f8cd | import xml.etree.ElementTree as ET
import sys
def reduceExpression(terminalXml,depth):
variations = []
terminalXmlText = ''
if terminalXml.text == None:
terminalXmlText = ' '
else:
terminalXmlText = terminalXml.text
if terminalXml.tag == 'mo':
tempString = '<'+terminalXml.tag+'>'
if terminalXml.text.s... |
998,406 | dcac86405454d4be6c0b87b8e721e6762cdbf8cb | #!/usr/bin/env python
# encoding: utf-8
import xadmin
from .models import Singers
class SingersAdmin(object):
list_display = ["name", "singer_id", "birthday", "gender", "desc", "country", "add_time"]
search_fields = ['name', ]
list_filter = ["name", "singer_id", "birthday", "gender", "desc", "country", "a... |
998,407 | c86a5c059d103f30dcc4898b259098001589a532 | user_input=int(input())
list_of_values=input()
list_of_values1=set(map(int,list_of_values.split(" ")))
for i in range(int(input())):
user_input_commands=input().split(" ")
if("pop"==user_input_commands[0]):
list_of_values1.pop()
if("remove"==user_input_commands[0]):
if int(user_input_command... |
998,408 | a059029265c2ac2a0a0176170f224e172eca392e | # Authors: Sebastian Szyller, Buse Gul Atli
# Copyright 2020 Secure Systems Group, Aalto University, https://ssg.aalto.fi
# 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... |
998,409 | eea0ac05a8267f32eec32c54a986553269ec3d03 | from .cov_hos_form_collection import *
from .province_form_collection import *
from .internal_affairs_form_collection import *
from .chief_minister_form_collection import *
from .local_level_form_collection import *
from .collection_six import *
|
998,410 | 0aa15e5dc56ab52cb0f05ee74016930022bafd76 | n=int(input())
temp=n
am=0
while n!=0:
rem=int(n%10)
am=am+rem**3
n=int(n/10)
if temp == am:
print("yes")
else:
print("no")
|
998,411 | 484674f95777b61ceadcbdb13308a661a15e4866 | #!/usr/bin/env python3
import sys
import os
def get_main_c_app():
contents = ""
contents += "\n"
contents += "#include <stdio.h>\n"
contents += "\n"
contents += "int main(int argc, char *argv[]){\n"
contents += "\n"
contents += " (void)argc; (void)argv;\n"
contents += " printf(... |
998,412 | b2f0315175822a883a9f74f9ab697f5b5a8c7765 | '''
@Description:
@Author: 妄想
@Date: 2020-06-25 14:01:59
@LastEditTime: 2020-06-25 16:16:22
@LastEditors: 妄想
'''
class Config:
ip = "xxx"
REDIS_PORT = 6379
REDIS_PASSWORD = "xxx"
SQLALCHEMY_DATABASE_URI = 'xxx'
SQLALCHEMY_TRACK_MODIFICATIONS = True |
998,413 | ae105300f5c25b5953b59dced4396239cdb9e896 | import cv2
input_path = "--PATH--"
output_path = "--PATH--"
num = 10000
for i in range(0, num):
try:
name = input_path + "/" + str(i) + ".jpg"
frame = cv2.imread(name)
roi = frame[80:560, 0:480]
roi = cv2.resize(roi, (300, 300))
name = output_path + "/" + str(i) +... |
998,414 | b1efdfc5e58138dad61de746f82779be79a2894b | # -*- coding: utf-8 -*-
#
# Copyright 2018-2019 Botswana Harvard Partnership (BHP)
from Products.CMFCore.permissions import View
from archetypes.schemaextender.interfaces import IBrowserLayerAwareExtender
from archetypes.schemaextender.interfaces import ISchemaExtender
from bhp.lims.content import ExtUIDReferenceField... |
998,415 | f40fc2e7727bd7ce4553ebf869a7b18554ddea23 | from flask import Flask, render_template, send_from_directory, request
import util
import os
app = Flask(__name__)
app_path = os.path.dirname(os.path.abspath(__file__))
@app.route('/')
def index():
util.exec_apache_spark_scala()
return render_template('index.html')
@app.route('/api/get_result')
def get_result_data... |
998,416 | 77ac30fa4cad2e9413a87f04fa7c0060953d94ee | class Solution:
def levelOrder(self, root: TreeNode) -> List[List[int]]:
result = []
if root == None:
return result
max_depth = 0
def dfs(root: TreeNode, child: TreeNode, depth: int):
if child != None:
print(child.val, depth, len(resul... |
998,417 | 73006f84572d1a3a6092a9ff035f8b81c8f9c265 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
...
Created on Mon Nov 26 17:35:38 2018
@author: Simon Schmitt
"""
import numpy as np
from GETINT import getint
from SHAPE import shape
def field(fid2, Px, Py, FREC, NNODE, NELEM, KIND, NODE, X, Y, TEMP, DTDN,
Exterior, VINF, PhiI):
PhiP = np.zeros(F... |
998,418 | 36c95bf2272d02398339c07e84e406198860e3d5 | import sys
import numpy as np
from matplotlib import pyplot as plt
import matplotlib.ticker
import seaborn as sns
import conic_parameters
plotfile = sys.argv[0].replace('.py', '.pdf')
sns.set_style('white')
fig, axes = plt.subplots(3, 3, figsize=(9, 9), sharex=True, sharey=True)
incs_deg = 10.0*np.arange(9)
nbeta =... |
998,419 | 9ead53a4b04b5918c895b1977d2047a657a6353d | import bmesh
import bpy
from bpy.types import Armature
from .data import *
from ..helpers import *
class PskInputObjects(object):
def __init__(self):
self.mesh_objects = []
self.armature_object = None
class PskBuildOptions(object):
def __init__(self):
self.bone_filter_mode = 'ALL'
... |
998,420 | 1c6a1c95d24baf6599043c7a68250ae360353704 | '''
Using the module random and time in python generate a random date between given start and end
dates.
'''
from datetime import timedelta
import random
date1 = input("Enter start date: ")
date2 = input("Enter end date: ")
d_format = "%m/%d/%Y"
d0 = datetime.strptime(date1, d_format)
d1 = datetime.strpti... |
998,421 | c8bbd172b54191d0bd8069e5387c1efe1f242f34 | import wagtail.core.blocks as blocks
from wagtail.images.blocks import ImageChooserBlock
from events.models import EventListPage
class PageLinkBlock(blocks.StructBlock):
page = blocks.PageChooserBlock()
class Meta:
icon = "user"
template = "home/blocks/page_link_block.html"
class PageLinksB... |
998,422 | ecc7ab0260371c18e1a0330b43fc690826e79ad1 | #------------------Bombermans Team---------------------------------#
#Author : B3mB4m
#Concat : b3mb4m@protonmail.com
#Project : https://github.com/b3mb4m/Shellsploit
#LICENSE : https://github.com/b3mb4m/Shellsploit/blob/master/LICENSE
#------------------------------------------------------------------#
#Greetz : K... |
998,423 | dd42ba4d4ce6e3041dab33683fbdb50e67a331e2 | from minepy.minefield import Minefield
''' Класс контроллера '''
class MinepyGame():
def __init__(self, minefield):
self.minefield = minefield
self.startNewGame()
# инициализирует старт игры
def startNewGame(self):
self.minefield.startGame()
# обработка события от нажатия ЛКМ
... |
998,424 | 0005564fd8e5db8c9776268340c9cecbeb0e21d4 | import sys
for a in range(1,500):
for b in range(a,500):
c = 1000-a-b
if (a**2+b**2==c**2) and (a+b+c==1000):
sys.exit(str(a*b*c)) |
998,425 | 8bac66053729789408b45431ad0a3db42234e2df | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
998,426 | 95a33dee2ae93972cff18d0748c75d35cb751b9c | import cv2
import numpy as np
from lanes.image_debugtools import log, LOG_LEVEL_ERROR, LOG_LEVEL_WARNING
"""
Class that process & analyses a road image in
order to identify the lanes that appear in it
and to compute the offset distance that separates
the driver to the center of the lane.
The image of the road can r... |
998,427 | fdba015f1cce0262da992e91430c24260773fdf9 | # -*- coding: utf-8 -*-
'''
单元测试:
作用:用来对一个函数、一个类或者一个模块来进行正确性校验工作
结果:
1.单元测试通过,说明我们测试的函数功能正常
2.单元测试不通过,说明函数功能有BUG,要么测试条件输入有误
'''
def mySum(x,y):
return x + y
def mySub(x,y):
return x - y
|
998,428 | 5775a6ed5ca27786fa571593a536c3ce0d45cb82 | #!/usr/bin/env python2
# -*- coding: utf-8
import datetime
from functions import eventfunc
import config
startDate = datetime.date(year=2015, month=05, day=17)
endDate = startDate + datetime.timedelta(days=1)
eventfunc(startDate, endDate, "Test", 'test@gmail.com')
|
998,429 | de0f489241815498bce86a1c9e6cf4a9da89024d | from tkinter import *
import sqlite3
import tkinter.messagebox
class Professor:
def __init__(self,prof_window):
connection_newDB = sqlite3.connect('SCHOOL_DATABASE.db')
# create cursor
cursor_newDB = connection_newDB.cursor()
# create table for student database
c... |
998,430 | 08b9da32570c1a122b4ff7676bfab74892428004 | from django.views.generic.list import ListView
from .models import Course
from django.core.urlresolvers import reverse_lazy
from django.views.generic.edit import CreateView, UpdateView, \
DeleteView
from braces.views import LoginRequiredMixin, \
Permissio... |
998,431 | 7eb5461884c979c8055ab549363f378d3f456770 | from src.tally import Tally
from src.suffix_array import SuffixArray
class FmIndex():
''' O(m) size FM Index, where checkpoints and suffix array samples are
spaced O(1) elements apart. Queries like count() and range() are
O(n) where n is the length of the query. Finding all k
occurrences... |
998,432 | bb367cbe95990dc093caa49d2ce94ba8a5f99a16 | #!/usr/bin/env python
import cv2
import numpy as np
import sys
import os
import time
#get the root path for model inputing
current_path = os.path.dirname(os.path.abspath(__file__))
root_path = os.path.dirname(current_path)
sys.path.append(root_path)
from Driver.RealsenseController import RealsenseController
DEBUG = ... |
998,433 | 2cd3cba62e645e8eb095b4627ccef7aab768b7f9 | from __future__ import print_function
from flask import Flask, jsonify, request
from flask import Flask, request, redirect, url_for, render_template, send_from_directory
from werkzeug.utils import secure_filename
import numpy as np
#from sklearn.externals import joblib
import pandas as pd
import numpy as np
from tens... |
998,434 | 7d34b95a4a93890e96367cdc0052344abfe95026 | from requests import get
import socket
from main_application.connect_to_asterisk.asterisk_manager import ConnectAsteriskManager
import os
import sys
# Changing SIP Trunk settings
class SettingsToPjsip:
def __init__(self, config_location, pjsip_port, provider_address, provider_port, provider_ip_addresses):
... |
998,435 | 8b4670ea7919cd353ccfebcdc26afff48522b76b | import pytest
import mkl
from qiskit import *
from qiskit.compiler import transpile, assemble
mkl.set_num_threads(1)
backend = Aer.get_backend('statevector_simulator')
def run_bench(benchmark, nqubits, gate, locs=(1, )):
if qiskit.__qiskit_version__['qiskit-terra'] == '0.9.0':
run_bench_new(benchmark, nqu... |
998,436 | 445e136be0e44744df5802a847c11aaa2b5a44c7 | # -*- coding: utf-8 -*-
N = int(input())
A = int(input())
val = N*N-A
if(val >= 0):
print(N*N-A)
else:
print(0)
|
998,437 | 29f1d94cbca249e566ef29dd5330681eeaa7f914 | ###---------Imports---------###
import math
from kivy.app import App
from kivy.clock import Clock
from kivy.config import Config
from kivy.graphics import Color, Ellipse
from kivy.uix.label import Label
from kivy.uix.popup import Popup
from kivy.core.window import Window
from Pretty_quatre.RBF import *
from kivy.uix.b... |
998,438 | 76653fbcb71db8db83202b1d05d88efffd824ce4 | #!/usr/bin/env python3
from time import sleep
from notify_engine import (
NotifyManager, EventLoop, CommonEvent
)
def handler(event):
print(event.message)
print(event.__dict__)
print(event.serialize())
def start_task(task, event):
task(event)
def nm_factory():
evl = EventLoop('redis://lo... |
998,439 | 2082c813b56bd910d9210e6aa12d93d9f5cc41c3 | # Generated by Django 2.1.7 on 2019-03-10 07:04
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('trxs', '0004_auto_20190310_0628'),
]
operations = [
migrations.AddField(
model_name='trxs',
name='sale_dollars',
... |
998,440 | 9e6dcf9bb1290d3f44d83f4920b6e16dfc970139 | import time
from uuid import uuid4
import os
def PathAndRename(path):
def wrapper(instance, filename):
ext = filename.split('.')[-1]
# get filename
TimeStr = time.strftime('%y-%j')
if instance.pk:
filename = '{}-{}.{}'.format(instance.pk, uuid4().hex, ext)
else:
... |
998,441 | 6d0aa4257a69fb6b3f3debe1393f973b86eb54ad | # Ejerecicio nro 05
# Introducir dos numeros donde la suma de sus resultados sean perfectas
num1=int(input("Introduce un numero:"))
num2=int(input("Introduce un numero:"))
for i in range(num1,num2+1):
suma=0
for j in range(1,(i//2)+1):
if(i%j==0):
suma+=j
if(suma==i):
#Fin_if
#Fin_F... |
998,442 | 894257dac871085ba6b17966f058e3f82f43ed61 | import time
import sys
import heapq
# Get max price of items in bag
def get_max_bag_price(items: list, bag: int) -> float:
# Add part price for each item
# We use -price / col to reverse 2n priority order with min in top and make -max in top
items = [(-price / col, col) for price, col in items]
# Cr... |
998,443 | 45cc856b9823d753b78e5b94bbfd6b8aa7c1f17e | class Animal:
name=''
def Eat(self):
print("Ням-ням");
def setName(self,newName):
self.name=newName
def getName(self):
return self.name
def makeNoize(self):
print(self.name+' говорит Гррр')
def __init__(self,newName):
self.name=newName... |
998,444 | 170a92c5d63bcd1ab884e448fa527cd8c9769503 | #!/usr/bin/env python
# Command:
# ./rele_turn.py pin on/off rpiv
#
# where:
# - pin is the GPIO pin number
# - on and off means normally closed and opened (because cables
# were mounted to be normally closed as default)
# - rpiv is the last 8-bit IP number (e.g. 36 for parents)
#
# Example:
# rele_turn.py ... |
998,445 | ea32f1979644a9d825bdd4864d5637fa275bf1ad | """
Uncipher Cisco type 7 ciphered passwords
Usage: python uncipher.py <pass> where <pass> is the text of the type 7 password
Example:
$ python uncipher.py 094F4F1D1A0403
catcat
"""
import fileinput
import sys
global key
key = [0x64, 0x73, 0x66, 0x64, 0x3b, 0x6b, 0x66, 0x6f, 0x41,
0x2c, 0x2e, 0x69, 0x79, 0x65, 0x77,... |
998,446 | 9c03329ef135b754cda99f86fd66331524f5deb0 | from django.db import models
from django.core.urlresolvers import reverse
from apps.visualizations.models import Visualization
from apps.dashboards.models import Dashboard
from apps.accounts.models import User
import uuid
class SharedVisualization(models.Model):
created_at = models.DateTimeField(auto_now_add=T... |
998,447 | 9c5c937a671489014c28a10928b056c45b43be9d | # for module compile
Import('env')
Import('RTT_ROOT')
Import('rtconfig')
# build each components
objs = ''
objs += SConscript(RTT_ROOT + '/drivers/SConscript')
if rtconfig.CROSS_TOOL == 'gcc':
rtconfig.RT_USING_MINILIBC = True
objs = objs + SConscript('minilibc/SConscript')
if 'RT_USING_SPI' in dir(rtconfig) a... |
998,448 | 7b5e0b849db8cbd2c1865042926023ddc256d8de | import logging
logger = logging.getLogger(__name__)
def func():
logging.error("aaaaaaaaaa")
logger.info("a2_aaaaaaaaaaaaaa") |
998,449 | 89f12a326c81154cee7f0b126647acf2b78e3b96 | from requests_html import HTMLSession
import time
import datetime
s = HTMLSession()
headers = {
'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
'accept-encoding': 'gzip, deflate, br',
'accept-la... |
998,450 | 40adc18a8e2bb587c7be206d2101b20f5e1efaa0 | import ee
import geemap
# Create a map centered at (lat, lon).
Map = geemap.Map(center=[40, -100], zoom=4)
# Load a Landsat 8 collection.
collection = ee.ImageCollection('LANDSAT/LC08/C01/T1') \
.filterBounds(ee.Geometry.Point(-122.262, 37.8719)) \
.filterDate('2014-01-01', '2014-12-31') \
.sort('CLOUD_CO... |
998,451 | c09e5aae89e97e73aadcaf4b9720c60389daa408 | import numpy as np
from random import randint
from src import data
xtrain, xtest, ytrain, ytest = data.load_spambase_test_train()
# In the final version of this module we shouldn't be tightly coupled to the
# features of the classifier that we are attacking. The decoupling would
# require an invertible mapping betwe... |
998,452 | a0209c444ba14442e40acc7df905fa5a1f86f4cc | n, x = map(int, input().split())
l = list(map(int,input().split()))
count = 1
d = 0
for lx in l:
d += lx
if d <= x:
count += 1
else: break
print(count) |
998,453 | 6efd46dda40a0c11dd04d0457bfba54002b65007 | #!/usr/bin/env python3
import json,requests
import pandas as pd
url_gainers_nifty50 = "https://www.nseindia.com/live_market/dynaContent/live_analysis/gainers/niftyGainers1.json"
url_gainers_nifty_next50 = "https://www.nseindia.com/live_market/dynaContent/live_analysis/gainers/jrNiftyGainers1.json"
url_fno_gainers = "h... |
998,454 | a4b90a381a7dbe2f37a6abd8880e8c9c116aa6c4 | import logging
from typing import Optional
from datetime import datetime, timedelta
import uuid
from fastapi import APIRouter, HTTPException, Depends, status
from fastapi.security import OAuth2PasswordBearer, OAuth2PasswordRequestForm
from jose import JWTError, jwt
from pydantic import BaseModel
from api.conf import co... |
998,455 | c74bab0c8b272c36a6ba3af45f29a3aa0f2b4c1c | j=list(input())
j.sort()
for d in j:
print(d,end="")
|
998,456 | fb86fc48d16b33686083b5b6fb38b8200d076412 | import logging
from colab_ssh._command import run_command as _run_command
import os
import sys
import importlib
import requests
from .get_tunnel_config import get_tunnel_config
import re
from urllib.parse import quote
from .utils import show_hint_message
from colab_ssh.utils.logger import get_logger
logger= get_logger... |
998,457 | bd2fa77a9520ba81c96e54ff9293ec6086ad3d90 | '''
print('第一题')
def mysum(*args):
return sum(args)
print(mysum(1,3,36,3))
'''
print('第二题')
#方法一
def mymax(*args):
if len(args) == 1:
l = list(*args)
l.sort()
return l[-1]
#return max(args[0])
return max(args)
#方法二
def mymax2(a,*args):
if len(args) == 0:
m =... |
998,458 | d81541f0bfae3d2a5323f517300afa9501bdf685 | import math
def troco(T):
moedas = {
1: 0,
5: 0,
10: 0,
25: 0,
50: 0,
100: 0
}
while(T > 0): # Criterio guloso: escolher maior moeda possivel. Colocar quantas der dela
if T >= 100:
moedas[100] = int(math.floor(T/100))
T = T % ... |
998,459 | 394b0ed71ca4595080fbe9e5da79eec56527f1b4 | import zmq
import time
import pickle
def serve():
'''
'''
context = zmq.Context()
socket = context.socket(zmq.REP)
socket.bind('tcp://*:5555')
while True:
message = socket.recv()
print pickle.loads(message)['foo']
socket.send("world")
if __name__ == '__main__':
ser... |
998,460 | 698f0a391873d54323796003131e28e3d6fb588f | from .ArangodServer import ArangodServer
class DBServer(ArangodServer):
def __init__(self, environment):
super().__init__(environment)
environment.register_dbserver(self)
def collect_parameters(self, param):
self._environment.insert_cluster_agency_endpoints(param)
param["--clus... |
998,461 | ded94b0e1248a8d4ecf96b5f403d06e7a31e9f80 | # Copyright 2013-2018 Adam Karpierz
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# <AK> added
#
from __future__ import absolute_import
from . import common
from jpype import JPackage, JClass, JClassUtil
class JClassUtilTestCase(common.JPypeTestCase):
def testI... |
998,462 | 2b2ee63a6595c6ab63edb8aa997ca7d47e4b402d | from __future__ import print_function
import midi
import sys
from music_model import MusicModel
import random
from math import log
import numpy as np
import data
from util import compose
from util import play_midi
from util import plot_midi
from os import listdir, mkdir
import matplotlib.pyplot as plt
def read_pitc... |
998,463 | 70edf6c4f1877f42db88615ad48c0a105a44861b | a, p = map(int, input().split())
print(int((int((3*a)+p)/2)))
|
998,464 | 7cd62f499de4394322d6a2e5dd15e7618301fff0 | import plotly.graph_objects as go
import plotly.express as px
import numpy as np
from random_walk import RandomWalk
rw = RandomWalk()
rw.fill_walk()
fig = go.Figure(data= go.Scatter(
x=rw.x_values,
y=rw.y_values,
mode = 'markers',
name = 'Random Walk',
marker = dict(color=np.arange(rw... |
998,465 | 5a7d79fa6fcf9dc1eee829fb6639422b57a87dbb | listapesos = []
for c in range(1, 6):
peso = float(input(f'Informe o peso da {c}° pessoa: '))
listapesos.append(peso)
print(f'O menor peso informado foi {min(listapesos)}kg')
print(f'O maior peso informado foi {max(listapesos)}kg')
|
998,466 | 9b917dbbd95a33e2f2d1f6ef10a1aaef28508cdf | import json
from enum import Enum
from typing import Any, Type
from core.domain import ConsumerLifestageType, GenderType, ProductCategory
from scraping.spiders._base import SETTINGS
def enum_has_value(enum: Type[Enum], value: Any) -> bool:
try:
enum(value)
except ValueError:
return False
... |
998,467 | 0d577d7874709ab946d138ed134bb264ce3833a5 | banner = """\u001b[36;1m
█████▄ ██▀███ ▄▄▄ ▄████ ▒█████ ███▄ ▄███ ▄███ ▓▓▄ █
▒██ ██▌▓██ ▒ ██▒▒████▄ ██▒ ▀█▒▒██ ██▒ ██▒▀█▀█ █ ▒██ ██ ▄ ██ ▀█ █
░██ █▌▓██ ▄█ ▒▒██ ▀█▄ ▒██░▄▄▄░▒██░ ██ ▓██ ▓██▒ ██ ▀█▄▓ ██ ▀█ ██▒
░▓█▄ ▌▒██▀▀█▄ ░██▄▄▄▄██ ░▓█ ██▓▒██ ██░▒██ ▒██ ░██▄▄▄▄██... |
998,468 | f33cc78b8e1cc2eef2b440ef2c39253bde1e6953 | # Generated by Django 2.2.7 on 2020-02-27 16:13
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('homepage', '0003_auto_20200113_1928'),
]
operations = [
migrations.AlterField(
model_name='scholarship',
name='docum... |
998,469 | 03d016e739a9bca9d3690473b34a1b712dda0e5c | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'tweetifier.ui'
#
# Created by: PyQt5 UI code generator 5.5.1
#
# WARNING! All changes made in this file will be lost!
import sys
from classifier import Classify
from preprocessed_tweets import first_level
from fetch_tweet import TweetFetch
f... |
998,470 | 8583e174d5651a30952a04c2f4b7f6097e7f4789 | from helpers.read_input import *
import copy
def parse_input(lines):
# idx is the location, val is if it's been visited
visited = []
for i, l in enumerate(lines):
instruct, arg = l.split(' ')
instructions = {
'instruct':instruct,
'arg': int(arg),
'seen'... |
998,471 | a4635e31239839b936a6ad3572c654f5d1b8fd3a | # Copyright (C) 2020 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""Mixins for entities."""
# pylint: disable=too-few-public-methods
class Reviewable(object):
"""A mixin for reviewable objects."""
def update_review(self, new_review):
"""Update obj review dict an... |
998,472 | 1ba650b9e35b3eb1e10707e2b3b475b16c6ad614 | #!/usr/bin/env python3
import fileinput
R = 6
C = 50
screen = [[False] * C for _ in range(R)]
def print_():
print('\n'.join(''.join('#' if b else '.' for b in r) for r in screen))
print()
def rect(A, B):
for x in range(A):
for y in range(B):
screen[y][x] = True
def rotate_row(A, B):... |
998,473 | 80933852d4db3533a085dcde57dc436d5180acbc | import random
from typing import Tuple
import numpy as np
import pytest
from fleet import astar
from fleet.serializable import Map
@pytest.mark.parametrize(
argnames=("from_pos", "to_pos", "expected_n_moves", "obstacles",
"obstructed"),
argvalues=(
# Test single obstacles
... |
998,474 | 898096bf09e8dcd6eed490a1e0726e5d9bfce5b2 | # Copyright (C) 2022 CVAT.ai Corporation
#
# SPDX-License-Identifier: MIT
from __future__ import annotations
import json
from time import sleep
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from cvat_sdk.core.client import Client
def create_git_repo(
client: Client,
*,
task_id: int,
repo_u... |
998,475 | 71c67db0c7a5d29a4c6618cf7262aa42a326846d | import ship, game_board, sprites
from random import randint
import time
from typing import List, Tuple, Optional
class Computer:
""" A computer player"""
def __init__(self):
# list of ship objects
self._my_ships: List[ship.Ship] = []
# list of (row,col) coordinates
self._my_m... |
998,476 | 018ba1b46497a9866925fb958e626a41fa29487e | import aoi
from libs.conversions import discord_number_emojis as dne
class Game:
def __init__(self, ctx: aoi.AoiContext):
self.ctx = ctx
async def play(self):
raise NotImplementedError()
def score(self, aoi_score: int, player_score: int):
return f":person_red_hair: {dne(player_sc... |
998,477 | 119e87cd39cbd5e6f715856cc9e7f8eafd05fa19 |
def find_duplicates(my_list):
returned_list=[]
for i in range(len(my_list)):
for j in range(i+1,len(my_list)):
if my_list[i]==my_list[j] and my_list[i] not in returned_list:
returned_list.append(my_list[i])
return returned_list
my_test_list =['f','a','b','c','b','d'... |
998,478 | eda3ca3df3c54a9f0f2511580590857b0e3e93dd | from heapq import heappush, heappop
from collections import namedtuple, defaultdict
from .nearest import BruteForceNeighbors, KDNeighbors
from .primitives import default_weights, get_embed_fn, get_distance_fn
from .utils import INF, elapsed_time, get_pairs, default_selector, irange, \
merge_dicts, compute_path_cos... |
998,479 | c27c96edc47bb00a910e53c89c43af124689891f | """empty message
Revision ID: 0257_letter_branding_migration
Revises: 0256_set_postage_tmplt_hstr
"""
# revision identifiers, used by Alembic.
revision = "0257_letter_branding_migration"
down_revision = "0256_set_postage_tmplt_hstr"
from alembic import op
def upgrade():
op.execute(
"""INSERT INTO lett... |
998,480 | 4d2b5ae31a1268bf267ba70697f8c983190d9fee | # !/usr/bin/env python
# -*- coding:utf-8 -*-
"""
Copyright 2020 Tianshu AI Platform. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICEN... |
998,481 | d23d5387c590f52b5f1d0989d9d0f25a1428fa29 | # Generated by Django 3.1.2 on 2021-04-01 05:46
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('gallery', '0004_dummypost_activedummy'),
]
operations = [
migrations.AddField(
model_name='user',
name='contactgmail... |
998,482 | 4200fcd543e7b325a9d12e509398d848f314d4b9 | from django.urls import path, include
from .views import search, get_remaining, OpenAiEndpoint
from .routers import router, collection_router
from django.conf.urls import url
urlpatterns = [
path('search/', search),
path('get-remaining/', get_remaining),
path('', include(router.urls)),
path('', inc... |
998,483 | d8dc50a5d4fc79d29a946c4fbdf05bb179b30634 | from django.urls import path
from . import views
urlpatterns = [
path('posts/', views.posts, name='posts'),
path('post/', views.create_post, name='create_post'),
path('<int:pk>', views.update_post, name='update_post'),
path('upload/<int:pk>', views.upload_file, name='upload'),
path('', vi... |
998,484 | d0c15881ee838de157666ce8f6c9f8b84d159eca | import peewee
from Peewee import Peewee
# create the database
database = Peewee().create_database("Database.db")
# create the class Example with fields id and level
class Example(peewee.Model):
id,level=Peewee().fields()["autofield"](),Peewee().fields()["int"]()
class Meta:
database = database
# initiate the... |
998,485 | 10c07f4ddcb1dd73e7771464a488761aa0d23815 | import os.path
import time
import magic
from io import SEEK_END
from flask import request, jsonify, abort
from .. import app
from ..helpers import verify_token, gen_hash
from ..models import UploadedFile
@app.route('/api/1/upload/check', methods={'POST'})
def check_uploaded():
user = verify_token()
if not us... |
998,486 | c8d65985804fa6e90747b602fd2a53f53e95f0a2 | try:
from jsonpath_ng.ext import parse # noqa: F401
from redis.commands.json.path import Path # noqa: F401
from ._json_mixin import JSONCommandsMixin, JSONObject # noqa: F401
except ImportError as e:
if e.name == "fakeredis.stack._json_mixin":
raise e
class JSONCommandsMixin: # type: ig... |
998,487 | 13a3e3adfc50ee722c03d98f2369d545bff6c424 | #!/usr/bin/env python
# 箱ひげ図の見方 データの分布を「箱」と「ひげ」で表したグラフで、データがどのあたりの値に集中しているかをひと目で捉えることができます。
# 参考 https://bellcurve.jp/statistics/course/5220.html
import matplotlib.pyplot as plt
def boxPlot(numList):
# 箱ひげ図
fig, ax = plt.subplots()
bp = ax.boxplot(numList)
# ax.set_xticklabels(['math', 'litera... |
998,488 | 1c030f2518fbb3b5a98a12c0b0ac18792920540a | __all__ = ['animedreaming', 'animeflavor', 'animehaven', 'dubcrazy',
'dubbedcrazy', 'hentai2w', 'hentaicraving', 'hentaiseriesonline',
'jamo', 'javon', 'kiss', 'lovemyanime', 'myhentai',
'watchhentaistream']
|
998,489 | 2e526062b456be8e4396044eb3fdb6420e416a8d | #%% Sampling std
import numpy as np
n = 100
std=5.6
sampling_std=std/np.sqrt(n)
#%%
#Tüm olası örneklem ortalamasının (Ẋ) %68’i ±1 z skor aralığındadır.
#Tüm olası örneklem ortalamasının (Ẋ) %95’i ±2 z skor aralığındadır.
#Tüm olası örneklem ortalamasının (Ẋ) %99’u ±3 z skor aralığındadır.
# confidence interval two t... |
998,490 | a194baca305478a625a27ee3e028cf661214ec00 | for i in range (2000 , 3200):
if i % 7 ==0 and i %5 != 0:
print("Requested Numbers are : " , i) |
998,491 | fb362127c4830ffe196d91f7818e310d22b0e96a | from django.apps import AppConfig
class ClinicaProfissionalConfig(AppConfig):
name = 'clinica_profissional'
|
998,492 | 74a9871e5f40e0095b4c504da2e8f2003a82e0eb | from linebot.models import (
TextSendMessage, CarouselTemplate , BubbleContainer,
BoxComponent, TextComponent, FlexSendMessage, ImageComponent,
ButtonComponent, MessageAction, CarouselContainer, SeparatorComponent, IconComponent
)
# 食物清單
def food():
mes = BubbleContainer(
header = BoxComponent(
lay... |
998,493 | 0026d918c60eecb2ae4ec1b952a7373bceab533d | import pymysql
db=pymysql.connect("localhost","root","root","attendance")
cursor=db.cursor()
sid=int(raw_input("Enter id"))
sname=raw_input("Enter student name")
email=raw_input("Enter email_id")
mobile=int(raw_input("Enter contact number"))
address =raw_input("Enter address")
sql="insert into students values(%d,'%s',... |
998,494 | b26a12fbc91f15173a3c673f188262efbe887db2 | import numpy as np
from scipy.io import wavfile
def wave_to_file(wav, wav2=None, fname="temp.wav", amp=0.1, sample_rate=44100):
wav = np.array(wav)
wav = np.int16(wav * amp * (2**15 - 1))
if wav2 is not None:
wav2 = np.array(wav2)
wav2 = np.int16(wav2 * amp * (2 ** 15 - 1))
wav... |
998,495 | 4e9eb151ec136e900752b8101884c7b4ee97836c | # Imports the monkeyrunner modules used by this program
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice
# sets a variable with the apk name
apk='/home/nour/APKS/App_Lambda_App.apk'
# sets a variable with the name of an Activity in the package
activity ='com.core.lambdaapp.MainActivity'
#set the package... |
998,496 | 86180b563db183fb6c3c05195d02690177d36e78 | # for cascade rcnn
import torch
from icecream import ic
model_name = "../pretrained/faster_rcnn_r50_fpn_2x_coco_bbox_mAP-0.384_20200504_210434-a5d8aa15.pth"
model = torch.load(model_name)
# weight
num_classes = 15 + 1
# for faster model
model["state_dict"]["roi_head.bbox_head.fc_cls.weight"] = model["stat... |
998,497 | 31864975bad0bd0fb6f4397900357aa1052db9c5 | keerdaf=input()
print(keerdaf.title())
|
998,498 | 4bccbb2b0eb7e4d7a2c0e33173d8569448ac2c15 | print('Hello World')
file_in = open('C:\\Richard\\RichardMinorTextFiles\\TestFile2.txt', 'r')
file_out = open('C:\\Richard\\RichardMinorTextFiles2\\TestFile2New.txt', 'w')
hold = []
hold2 = []
line1 = ''
asterik = '*'
fullname = ''
streetaddr = ''
cityaddr = ''
staddr = ''
zipaddr = ''
for line in file_in:
hold = ... |
998,499 | ad5199421e384e866a45d9bf60fe7993d7f56c18 | __author__ = 'alex'
STATUS_LOCK_ID = 'status_lock_id' |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.