index int64 0 1,000k | blob_id stringlengths 40 40 | code stringlengths 7 10.4M |
|---|---|---|
998,700 | b4954fb541d37afec720c46c6379e47dd576a595 | # Copyright (c) 2014 Metaswitch Networks
# 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/LICENSE-2.0
#
# Unless r... |
998,701 | 0ae88923b501abbc5401b439f26914a702b34f6f | import argparse
import os
import shutil
import subprocess
import sys
import tempfile
import threading
import unittest
def parse_arguments():
parser = argparse.ArgumentParser(description='Test gRPC server/client')
parser.add_argument('--ip', default='localhost', help='server and client IP')
parser.add_argu... |
998,702 | 5fd6ce9d05c363c546d944f7f859efce62e6e530 |
from multiprocessing.context import Process
import RobotActions
import numpy as np
import cv2
# from keras.preprocessing import image
import time
import multiprocessing as mp
import RPi.GPIO as GPIO
from enum import Enum
import picar
import time
from RobotActions import NeuralNetWorkRead
from keras.models import load... |
998,703 | e2e555e8762a7f8f903f5fdb75369ca9f124ac0a | from django.db import models
from django.db.models.signals import post_save
from django.dispatch import receiver
from django.conf import settings
# Create your models here.
class Carrera(models.Model):
carrera = models.CharField(max_length=60, blank=True)
def __str__(self):
return self.carrera
class ... |
998,704 | 9d8b4888022d5d5e4fa7f63eb57d78c8f4a5111c | #Author: Avery Cordle
def decimal_to_binary():
num = int(input("Enter decimal number: "))
answerChain = ""
one = "1"
zero = "0"
while num>=1:
remainder = num%2
num//=2
for i in range(1):
if remainder %2 ==0:
answerChain = zero + answer... |
998,705 | a5c734d6c83c601ead899b51c8a1b95a8bad21f1 | import requests
from bs4 import BeautifulSoup
nist_url = "https://webbook.nist.gov/cgi/cbook.cgi?Name={}"
def get_info(name):
resp = requests.get(nist_url.format(name))
resp_soup = BeautifulSoup(resp.text, 'html.parser')
info = {}
formula_a_text = "Formula"
formula_text = str(resp_soup.find('a',... |
998,706 | 37f77c42e2116ef13678d1fadf72ea04aedb16e8 | from __future__ import annotations
from typing import TYPE_CHECKING
import pytest
from tox.config.cli.parse import get_options
from tox.config.loader.api import Override
if TYPE_CHECKING:
from tox.pytest import CaptureFixture
@pytest.mark.parametrize("flag", ["-x", "--override"])
def test_override_incorrect(f... |
998,707 | 473be0bda91eae497fd6a3dbf01438c2569bcee7 | from django.conf.urls.defaults import *
from django.contrib import admin
from django.conf import settings
from gazjango.articles.feeds import MainFeed, LatestStoriesFeed, SectionFeed
from gazjango.articles.feeds import SectionLatestFeed, TameFeed
from gazjango.announcements.feeds import Announceme... |
998,708 | 64c981b50f2b48c9abb13fe8a846a5e7a8aa713d | from fastapi import Depends
from fastapi.security import OAuth2PasswordBearer
from src.core.settings import settings
from src.utils.security import VerifyAccessToken
oauth2_bearer = OAuth2PasswordBearer(
tokenUrl=f"{settings.API_V1_STR}/users/login"
)
def authorization(access_token: str = Depends(oauth2_bearer)... |
998,709 | 7699dfe44bb98e8402ca2fe3b5815f96db7d7608 | name = input("Enter file:")
if len(name) < 1 : name = "mbox-short.txt"
handle = open(name)
hr = dict()
lst = []
for line in handle:
if line.startswith('From '):
line = line.split()
hours = line[5].split(':')[0]
lst.append(hours)
for hour in lst:
hr[hour] = hr.get(hour, 0) + 1
for key,val... |
998,710 | 2fbe30b3918e66862fc24fcd27f638e584a3978b | import json
terrains = {
"sea": [1, 18, 9],
"field": [3, 15, 19, 21],
"mountain": [2, 7, 10, 20],
"swamp": [4, 6, 8, 13],
"plain": [5, 12, 16, 22],
"forest": [11, 14, 17, 23]
}
markers = {
"magic": [4, 11, 15, 19],
"mine": [2, 14, 10, 6],
"cave": [2, 5, 13, 22]
}
indigens = [3, 4, 5, 11, 13, 16, 17, 19, 22]
no... |
998,711 | 53b70007c3ad041fb230bdbeef8a57f260f2950e | import numpy as np
import pandas as pd
from sklearn.cluster import KMeans
from sklearn.preprocessing import LabelEncoder
import matplotlib.pyplot as plt
data = pd.read_csv("part-r-00000.csv",header=None)
lbmake =LabelEncoder()
data["numerical"]=lbmake.fit_transform(data[0])+1
print(data)
kmeans=KMeans(n_clusters=2)
x=d... |
998,712 | 37f0ac027d7c79209387f2ab845f37c8897ac7b4 | #%%
alpha = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','a','b']
encrytped = list("g fmnc wms bgblr rpylqjyrc gr zw fylb. rfyrq ufyr amknsrcpq ypc dmp. bmgle gr gl zw fylb gq glcddgagclr ylb rfyr'q ufw rfgq rcvr gq qm jmle. sqgle qrpgle.kyicrpylq() gq pcamkk... |
998,713 | db4d7def4b9400b43c9920dfe137ff23ed78a7c6 |
Imports="""
import os
import numpy as np
from mtuq import read, open_db, download_greens_tensors
from mtuq.event import Origin
from mtuq.graphics import plot_data_greens2, plot_beachball, plot_misfit_dc
from mtuq.grid import DoubleCoupleGridRegular
from mtuq.grid_search import grid_search
from mtuq.misfit import Mis... |
998,714 | fda9c4d612e793968dc58693409b0c282053d362 | #------------------------------------------------------#
# Import librairies
#------------------------------------------------------#
import datetime
import hashlib
import os
import time
import urllib
import io
import cv2 as cv
import numpy as np
import pafy
import pandas as pd
import streamlit as st
import wget
impor... |
998,715 | 081b2d3a1c2a141b0699f438e33e0b09cfe3ce7c | from django.db import models
class Servicio(models.Model):
id_servicio=models.AutoField(primary_key=True)
nombre=models.CharField(max_length=25)
descripcion=models.CharField(max_length=50)
imagen = models.ImageField(upload_to="images", blank=True, null=True)
def getAll():
servicios=Servicio.ob... |
998,716 | f00021617958023dd02b55cba610b2f428a6c58e | from sklearn import svm
import cv2
import matplotlib.pyplot as plt
import numpy as np
import os
import pickle
from sklearn.pipeline import Pipeline
import copy
import os
from math import log
# make my classifier
svm_clf = svm.LinearSVC(max_iter=10000, class_weight='balanced')
# get preprocessed data(hog... |
998,717 | b5d8cd666a06e4c510f3c846160a713812ec6b85 | """ Implementation of graph convolution operation, modified slightly from the implementation used in
Protein Interface Prediction using Graph Convolutional Networks
https://github.com/fouticus/pipgcn
available under the MIT License, Copyright 2020 Alex Fout """
import numpy as np
import tensorflow as tf
d... |
998,718 | 2f899c020dbbbc318d11355081eeb851932cd43e | import datetime
from src.mining import collector, matcher
from src.utility import file_management
from src.utility import helpers
# Get projects to collect PR data for
projects = file_management.get_projects_to_mine()
# Get token for GitHub API
token = file_management.get_token()
# Get the GraphQL parameters, conta... |
998,719 | 145072d702a1a8745877dfadbe223daa77fb4291 | def addition(a ,b):
return(a+b)
def soustraction(a, b):
return(a-b)
|
998,720 | 7c576c75b7274c5b5414fc5cec412d1df77dd9e1 | #!/usr/bin/env python3
import sys
from os.path import abspath
from os.path import dirname
from app import app
sys.path.insert(0, abspath(dirname(__file__)))
application = app
"""
建立一个软连接
ln -s /var/www/movie/movie.conf /etc/supervisor/conf.d/movie.conf
ln -s /var/www/movie/movie.nginx /etc/nginx/sites-enabled/movi... |
998,721 | be4da861ade371bd5e61137dcd70405f9bac9f89 | from django.test import TestCase
# Create youfdjdjgf
|
998,722 | 165c7e04db32aa7e473d99b80d4b900df56c9ea2 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from urllib import request
import json
# with request.urlopen('https://api.github.com/') as f:
# print(f.status, f.reason)
# for k, v in f.getheaders():
# print(k, ':', v)
# req = request.Request('https://api.github.com/')
# req.add_header('User-Agent',
... |
998,723 | 7bf60140e3323539924c0916fb6d26b337ccb393 | import rasterio
from scipy import ndimage as ndi
from scipy.ndimage import gaussian_filter
from scipy import misc
import matplotlib.pyplot as plt
import numpy as np
from osgeo import gdal
import pygeoprocessing
class GeoTiff:
"""
Object representing data from a GeoTIFF image.
"""
def __init__(self):
... |
998,724 | d40a79d3a345c384d0074c0dff52f90d3ceaa693 | import numpy as np
import time
def std(m):
n = np.zeros(len(m))
maxm,minm = max(m),min(m)
#print(maxm,minm)
for i in range(len(m)):
dt = maxm - minm
n[i] = (m[i] - minm)/dt
if n[i] > 1 or n[i] < 0:
print("NO",m[i])
return n
def poisson_noise(image):
'''
... |
998,725 | ac52644ec4536708918d5ec601be2d921b5a0725 | """
1) replace zeros with half min detection limit
2) calculate Z-scores - in array of same format as compiled_mammals
a) Within each metal calculate mean
b) within each metal caclulate SD
c) for each value calculate (value - mean)/SD
3) Generate CSVs with the following outputs for each location for each sp... |
998,726 | 5741d9bb38b4354e5d283d62e1569753b5b2a6d2 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2017-05-29 13:27
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('mysite', '0008_auto_20170529_1539'),
]
operations = [
migrations.AddField(
... |
998,727 | 982a9490b64f864ccc1d725efe5f702137815dc3 | import time
from model.Chance import Chance
from model.InviteCode import InviteCode
def getInvitationCode(db):
print(int(time.time()))
code=InviteCode.query.filter(InviteCode.endtime>int(time.time()),InviteCode.status==1).first()
return code.code
def hasChance(openid):
ret = Chance.query.filter_by(ope... |
998,728 | e436e4198e7505bc12929f493b5bcb4aba40fd33 | N=int(input())
S=list()
for i in range(N):
S.append(input())
M=int(input())
T=list()
for i in range(M):
T.append(input())
ans=0
for i in S:
v=S.count(i)-T.count(i)
if v>ans:
ans=v
print(ans) |
998,729 | 7ab55a4e5913a79987879025e21ef6d084e552de | import os
import shutil
import tempfile
try:
from toil.lib.docker import apiDockerCall
except ImportError:
apiDockerCall = None
import subprocess
maxcluster_path = os.path.dirname(os.path.dirname(subprocess.check_output(["which", "maxcluster"])))
def run_maxcluster(*args, **kwds):
work_dir = kwds.... |
998,730 | ddf5fb820ff730d2fdf9e87281f1105a6b2ddcd3 | import pytest
from module_one.tests.conftest import matrix_string
from module_one._03_strmatrix import StrMatrix, StringParseError
def test_matrix_parser_works_as_expected(matrix_string):
result = StrMatrix._parse(StrMatrix, matrix_string)
assert result == [[1,2,3], [4,5,6], [7,8,9]]
def test_matrix_p... |
998,731 | 26e716c2e3a204ea598d2b6bc430251e4e985881 | from scapy.all import *
from scapy.fields import *
from scapy.layers.inet import IP,TCP
from CPPM import *
import re as regex
class Service():
def __init__(self, tcp_ip=None, tcp_dport = 5005, buffer_size = 1024):
self.TCP_IP = tcp_ip
self.TCP_DPORT = tcp_dport
self.BUFFER_SIZE = buff... |
998,732 | a07f4d559078c15c36b25fd466689f34703205ea | from flask import jsonify, Blueprint, abort
from flask_restful import Resource, Api, reqparse, fields, marshal, marshal_with
import models
message_fields = {
'id' : fields.Integer,
'content' : fields.String,
'published_at' : fields.String,
}
def get_or_abort(id):
try:
msg = models.Message.get... |
998,733 | 99b081f50c54d9fd480db6fe0816f5fbfe1cc8b8 | from django.db import models
class Coordinate(models.Model):
code = models.CharField(max_length=150)
def __str__(self):
return self.code
class Profiles(models.Model):
geocode=models.CharField(max_length=200)
country=models.CharField(max_length=500)
city=models.CharField(max_length=500)
... |
998,734 | 6058a414d6e9804068ddbe87fdac644eb13c6e8e | #!/usr/bin/env python
# coding: utf-8
# In[2]:
from tkinter import *
import tkinter.messagebox as Messagebox
import mysql.connector
# In[15]:
root=Tk()
root.title('LOGIN AND REGISTRATION')
text=Label(root,text='LOGIN AND REGISTRATION',font='verdana 20 bold')
text.grid(row=0,column=0)
def registration():
... |
998,735 | 6df7e8330ee6d95af6db850bd97d475bde3bd2a7 | from PyQt4.QtCore import *
from PyQt4.QtGui import *
COL_NAME = 0
COL_PROBABILITY = 1
COL_SREL_PROBABILITY = 2
COL_OBS_PROBABILITY = 3
COL_INDEX = 4
COL_LOCATION = 5
class Entry:
def __init__(self, m4du, i, L_mat, SR_mat, num_topologies, iSloc, iEloc):
self.L_mat = L_mat
self.SR_mat = SR_mat
... |
998,736 | bbf540b77be0b844b6b09c1631ba65d3a389b9b6 | from __future__ import print_function
import datetime
import os.path
import argparse
from googleapiclient.discovery import build
from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.transport.requests import Request
import requests, json
from google.oauth2.credentials import Credentials
from datetime... |
998,737 | 384fcf11682ba2ff913b193520d4d16cf40735bc | from menu import Menu
from coffee_maker import CoffeeMaker
from money_machine import MoneyMachine
menu = Menu()
coffee_maker = CoffeeMaker()
money_machine = MoneyMachine()
is_coffee_machine_on = True
while is_coffee_machine_on:
user_choice = input(f"What would you like? ({menu.get_items()}): ").lower()
if us... |
998,738 | 4cb1b661b7a8010dd69378b6e73716852bc4355a | ######################################################################################################################################################################
#REQUIREMENTS for the model:
# Should be able to distinguish safe and unsafe behaviour given the requirements:
# - Look at the number of RSSI pings withi... |
998,739 | 2c8cae0c7e86b0fb61ef8bf9f8337ef12304c69a | a=100
print("Hello World")
print("It's Leonard")
print("branch bug1") |
998,740 | 4e708c51e38764f23b9cd20f659752998906d33c | #!/usr/bin/env python
# coding=utf-8
""" inject.py:
Created by b1ueshad0w on 26/12/2016.
"""
import os
import time
import logging
from lib.common import TempDir, extract_app_from_ipa, get_app_executable_path, safe_check_call, PackageType, app2ipa
import shutil
import pkg_resources
import settings
logger = logging.... |
998,741 | 8ea12f6cef7b9ad15d533d04af5f7b9e988cd03b | import pygame
import numpy as np
from warcaby_kolory import kolory
win_szer, win_dl = 1200, 800
szach_szer, szach_dl = 800, 800
win = pygame.display.set_mode((win_szer,win_dl))
wiersze = kolumny = 8
pole_rozmiar = szach_szer//wiersze
class Szachownica():
def __init__(self):
self.szachownica_uklad = np.z... |
998,742 | 67829fe53ea74f05f8d8f0534f01fa189e760c06 | from collections import defaultdict
from Crazy import isprime
from eulertools import primes, big_primes
def g(n):
if n % 16 == 0:
m = n // 16
if m == 1 or isprime(m):
return True
else:
return False
elif n % 4 == 0:
m = n // 4
if m =... |
998,743 | c2f2e76b021033c61eb0c8652a40330a29498915 |
from singleton import Singleton
from util import group_into
from itertools import takewhile
class Symbol:
"""
A crude symbol class designed simply to distinguish between symbols and straight strings.
Following the Common Lisp precedent, symbols are always converted to uppercase when
constructed.
"... |
998,744 | a30794ff2038105b875d7bb34bbe23a1dfcdda3d | #!/usr/bin/env python3
"""Module containing the MakeNdx class and the command line interface."""
import os
import argparse
from pathlib import Path
from biobb_common.generic.biobb_object import BiobbObject
from biobb_common.configuration import settings
from biobb_common.tools import file_utils as fu
from biobb_common... |
998,745 | e8f550c0204981613901fb12751e98513978bd9a | from django.urls import path
from . import views
# /user_center/
urlpatterns = [
path('', views.user_info, name='user_info'),
path('new_article/', views.user_write_article, name='write_article'),
path('article_commit', views.article_commit, name='article_commit'),
]
|
998,746 | a8338e29cf5b2d517ac87845994efa672691fc9d | import gui
class titleScreen:
def __init__(self):
self.textAnimationPosition = 0
self.buttonOpacity = 0
def drawTitleScreen(self, screen, font, inGame):
if self.textAnimationPosition != 50:
self.textAnimationPosition = self.textAnimationPosition + 2
text = font.render('Commercium', True, (255,255,255))
... |
998,747 | 2f55a046ee15d11b05654c2006dde23de5244bcc | import os
import subprocess
import pandas as pd
vcftools="/Users/bowcock_lab/Desktop/Analysis_Softwares/vcftools-master/src/cpp/vcftools"
try:
def _hwe_cal_(main_dir,file_extension):
if file_extension == ".vcf.gz":
file = os.listdir(main_dir)
for f in file:
if f.en... |
998,748 | ded67b9873da0708012c9687b26e82aad56e6278 | import matplotlib.pyplot as plt
import wfdb
from wfdb import processing
import numpy as np
#使用gqrs定位算法矫正峰值位置
def peaks_hr(sig, peak_inds, fs, title, figsize=(20,10), saveto=None):
#这个函数是用来画出信号峰值和心律
#计算心律
hrs=processing.compute_hr(sig_len=sig.shape[0], qrs_inds=peak_inds, fs=fs)
N=sig.shape[... |
998,749 | cf7f53e5254a9636c09a5dfb7367c393aa5ba56c | import logging
import os
from django.conf import settings
from django.contrib.auth.models import Group, User
from django.contrib.auth.signals import user_logged_in
from django.core.cache import cache
from django.db.models.signals import post_save, pre_save
from django.dispatch.dispatcher import receiver
from eventkit... |
998,750 | 7667335d86ae823781a2a99da9ed085424d626bf | import sys
# input file
f = open('input.txt', 'r')
sys.stdin = f
l = int(input())
n = int(input())
x = input().split()
a_min = 0
a_max = 0
for i in x:
a_min = max(a_min, min(int(i), l-int(i)))
a_max = max(a_max, max(int(i), l-int(i)))
print(a_min)
print(a_max)
|
998,751 | 0e1287ad650e7da70c8e4fe78b3ab4539f2ff5b4 | import numpy as np
import sys
import pdb
from MapReader import MapReader
from MotionModel import MotionModel
from SensorModel import SensorModel
from Resampling import Resampling
from matplotlib import pyplot as plt
from matplotlib import figure as fig
import time
def visualize_map(occupancy_map):
fig = plt.figu... |
998,752 | dbe7110b0573d183fd66ae16f867978a35e7daae | # pylint: disable=consider-using-with
import getpass
import grp
import logging
import os
import subprocess
from contextlib import contextmanager
import sys
from retry import retry
from skipper import utils
def get_default_net():
# The host networking driver only works on Linux hosts, and is not supported on Docke... |
998,753 | 7d7710fbe04764ff2a88c3f796becb9ec137bf50 | #!/usr/bin/env python
import socket,traceback
host='0.0.0.0'
port = 12345
if __name__ == '__main__':
ret = True
s = socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
s.setsockopt(socket.SOL_SOCKET,socket.SO_REUSEADDR,1)
s.setsockopt(socket.SOL_SOCKET,socket.SO_BROADCAST,1)
s.bind((host,port))
tr... |
998,754 | f30596fc7ec4f11eaa0f6cc790dc6b4b48529ee3 | import ConfigParser, os, sys
config = ConfigParser.ConfigParser()
config.read(['buildout.cfg'])
config.set('django', 'settings', sys.argv[1])
with open('buildout.cfg', 'wb') as of:
config.write(of)
|
998,755 | f2a6b5d20b935da935ad95c54258e5e0e8a311d1 | #!/usr/bin/env python
import sys,os,re
import copy
import fnmatch
from myfnmatch import re_parts, interleave #, format2re
from myformatter import fmt,fstring,template_replace,template_replace_all,template_fields,format2re
import numpy as np
from glob import glob
from mds import Metadata
from mslice import MSlice
import... |
998,756 | 4127e206e9a8e8c8465ed97a3d3140cb4417d11a | file_name=input('Enter the file name:')
if len(file_name)<1:
handle=open('mbox-short.txt')
else:
handle=open(file_name)
horas=dict()
for line in handle:
line=line.rstrip()
if line.startswith('From'):
words=line.split()
if len (words)>3:
#print(words[5])
horas[word... |
998,757 | 8e024d3e20aed1dde0c82ba5c0003a8b3c98f337 | #https://programmers.co.kr/learn/courses/30/lessons/42842
def solution(brown, yellow):
xy = yellow+brown
array = []
for i in range(1,(brown+1)//2):
if xy%i==0:
a = max(xy//i,i)
b = min(xy//i,i)
array.append((a,b))
answer = []
for a,b in array:
... |
998,758 | cff25f62e89799f6971b667bc71f371eaf7f0d4e | # -*- coding: utf-8 -*-
"""
Created on Thu Nov 8 07:02:29 2018
@author: Abhishek
"""
import pandas as pd
from mlxtend.plotting import plot_learning_curves
import matplotlib.pyplot as plt
from sklearn.model_selection import learning_curve
import numpy as np
dataset = pd.read_table( r'C:\Users\Abhishek\Desktop\Mac... |
998,759 | b856320b332f37f2ea38accd0578b6a324536b2c | # -*- coding: utf-8 -*-
import scrapy
from DoubanMovieComment.items import DoubanmoviecommentItem
import re
class DoubanmovieSpider(scrapy.Spider):
name = 'doubanMovie' #哪吒-魔童降世短评爬虫
allowed_domains = ['douban.com'] #站点
start_urls = ['https://movie.douban.com/subject/26794435/comments?start=0&limit=20&sort=... |
998,760 | 02ca0bd1dab278230efee1d402618c35b1780996 | # import random
# from random import randint
#
# print("Відгадайте число від 0 - 100 використовуючи підказки")
# unknown = int(input("Ведіть число для відгадування: "))
# a = random.randint(0, 100)
#
# count = 0
#
#
# while a != unknown:
#
# count += 1
# if unknown > a:
# print("Введене число більше з... |
998,761 | 8923be1ce04816eb0df949624b0a15e9f4dbfa3f | import pygame, math
from pygame.locals import *
# Here everything related to the game aspect happens
clock = pygame.time.Clock()
timer = pygame.time.get_ticks
timeout = 2000 # milliseconds
deadline = timer() + timeout
landed = False
boom = False
out_map = False
launched = False
def logic(ground, rocket_pos, lz_of... |
998,762 | 9830cd2a2359b497cdacf0b88354958d5a1bbc58 | import os
from utils import max_rewards
PATH = 'out/MineRLObtainDiamondVectorObf-v0/100000'
def main():
files = os.listdir(PATH)
files.sort()
for file in files:
d = {}
with open(os.path.join(PATH, file)) as txt:
txt.readline()
for line in txt.readlin... |
998,763 | 13e9cd5cacbb08434059f7b0db2954bfcf518ea1 | #!/usr/bin/env python
"""
mapper that processes lines passed to it in stdin to produce a k-v pair for each word in the form of (upper,1) if the word is upper case and (lower,1) otherwise.
INPUT:
Lines of text passed to stdin, where individual words are separated by spaces.
Example:
The quick Brown fox jum... |
998,764 | 94b0105e535a8089f1d16663cef0bc822c33b1ef | # Generated by Django 2.0.6 on 2019-05-30 22:43
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('passionApp', '0004_auto_20190530_2218'),
]
operations = [
migrations.AlterField(
model_name='upcomingeventsentrymodel',
... |
998,765 | a56ffcd5216211f194f6bc2efce8101347ad704f | import logging
"""
DEBUG
INFO
WARNING
ERROR
CRITICAL
"""
def log_info(message, filename):
""" This method used to save log message """
logging.basicConfig(
filename=filename,
filemode='a',
format='%(asctime)s,%(msecs)d %(name)s %(levelname)s %(message)s',
datefmt='%H:%M:%S',
... |
998,766 | 7789f77741d3db1b8d533c7aeb172da3c78abba6 | import streamlit as st
import cv2
import numpy as np
from PIL import Image
import imutils
st.title('Application')
st.write("Number Plate Recognition App")
file = st.file_uploader("Please upload an image file", type=["jpg", "png"])
def number_Plate_Recognition(image):
# Convert image into numpy arr... |
998,767 | 6481b90515bab83349e16dddc3bf93802545d390 | # Ler um número pelo teclado e informar o fatorial do número lido.
def fatorial(n):
num = n
fat = 1
while n > 0:
fat *= n
n -= 1
return num, fat
print("O fatorial de %d é %d." % fatorial(5))
|
998,768 | 920c1f573fff85c5d5d55d5b0ea5c9f121a2f956 | # глобална променлива
port = 3306
def show():
global port
port = 22
print(f'show port = {port}')
if __name__ == '__main__':
print(f'before port = {port}')
show()
print(f'after port = {port}')
print('---')
|
998,769 | 0c58fd36cfae88ed6c2371ce6e9b4d8558abd67f | import os
import json
import time
import copy
import numpy as np
from baseGenerator import BaseGenerator
from ..helper.terminalHelper import find_terminal_view
from ..common.commonUtil import CommonUtil
from ..common.imageUtil import generate_crop_data
from ..common.imageUtil import crop_images
from ..common.imageUtil ... |
998,770 | 2b7a4f3a99319dc5f04997a7775e9abb45da9515 | import torch
import torch.nn as nn
from torch.distributions import constraints
import torch.nn.functional as F
from pyro.distributions.torch_transform import TransformModule
from pyro.distributions.util import copy_docs_from
@copy_docs_from(TransformModule)
class BatchNormTransform(TransformModule):
"""
A ty... |
998,771 | 94ab8de17189cd8e39b8e30923371c9f8c2c912a | import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
class VAE_trainer(nn.Module):
def __init__(self, model, objective, optimizer, cuda):
super(VAE_trainer, self).__init__()
self.model = model
self.objective = objective
... |
998,772 | 77157413a675a2e00fd31106dc3474af8b1243b6 | class Node:
def __init__(self,data):
self.data=data
root.left=None
root.right=None
def conversion(self,llist):
rootInd=int(len(llist)/2)
root=Node(llist[rootInd])
# print(root)
llist.pop(rootInd)
return (root,llist)
def construction(self,root,llist):
for x in llist:... |
998,773 | 3c9feef40642645830308107913d0ddd0957b93c | n = int(input())
MAP = [input() for _ in range(n)]
sizes = [0]*(n+1)
for size in range(1, n+1):
for r in range(n-size+1):
for c in range(n-size+1):
valid = 0
for i in range(size):
if MAP[r+i][c:c+size].count("0"):
break
else:
... |
998,774 | c7acaf0185bfa6e6dbdf0ec0e3b67c86503a42b0 | import matplotlib.pyplot as pyplot
import numpy as np
x = np.linspace(0,20,100)
plt.plot(x, np.sin(x))
plt.show
|
998,775 | b6fee951a3167df66d76142ec58fdd09289de1c5 |
from django.contrib.auth.models import User
from userdb.models import Team, Region
from openstack.client import OpenstackClient, get_admin_credentials
from openstack.models import Tenant
from scripts.set_quotas import set_quota
def setup_network(client, region, tenant_id):
neutron = client.get_neutron()
netw... |
998,776 | 7264fad5004a7cec61bfb35b6c2c386b3577247a | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 19 20:57:43 2019
..
@author: martin
"""
import fileinput
def GetSubKeys(key):
Permuted_Key = permut ([2,4,1,6,3,9,0,8,7,5], key)
#split in half
key_half_1 = Permuted_Key[:5]
key_half_2 = Permuted_Key[5:]
#generate subk... |
998,777 | a3c5fd07eb0cf03340229ba81b1a8bd2eb93cc8f | import asyncio
import logging
from six import string_types
from typing import (
List,
Dict,
Optional,
Any,
)
from hummingbot.core.utils.wallet_setup import (
create_and_save_wallet,
import_and_save_wallet,
list_wallets,
unlock_wallet
)
from hummingbot.client.config.config_var import Con... |
998,778 | 29f3365ae705cc6eb09ae1be0b7bdb9ffa7e4d6f | import pickle
import sys
import csv
from infoboxes_list import *
from dump import *
def get_coarse_type(f_type):
if f_type != None:
if f_type in Person_infoboxes:
return 'Person'
elif f_type in Location_infoboxes:
return 'Location'
elif f_type in Organization_infoboxes:
return 'Organization'
#elif f... |
998,779 | 26ed51f2a9457314260eca479d984b368135a2bf | import os
import pandas
from tqdm import tqdm
from source1.classes.Tool import Tool
path = "F:\\projects\\python projects\\moiveinfo\\html_source"
header = ["排名", "电影名称", "总票房(美元)", "上映时间"]
def main():
files = os.listdir(path)
result = []
for file in tqdm(files):
with open(path + "\\" + file, "r"... |
998,780 | 325fdd4c3f9c726d37c55ef3714f52bdd03ebda0 | import time
import pytest
from h2_conf import HttpdConf
class TestEncoding:
EXP_AH10244_ERRS = 0
@pytest.fixture(autouse=True, scope='class')
def _class_scope(self, env):
extras = {
'base': f"""
<Directory "{env.gen_dir}">
AllowOverride None
Options ... |
998,781 | 74b4570fbed9d547cd9750df8beaa843c92dc8ab | '''
Copyright (C) 2022 CG Cookie
http://cgcookie.com
hello@cgcookie.com
Created by Jonathan Denning, Jonathan Williamson
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 ... |
998,782 | bab1e403d63f5ad2571f198991b6571bb2f10266 | # -*- coding: utf-8 -*-
'''
Created on 2018年4月8日
@author: zwp
'''
import numpy as np;
def normal(X):
rk = np.ndim(X);
if rk == 1:
X = np.reshape(X,[-1,X.shape[0]]);
max_xs = np.reshape(np.max(X,axis=1),[-1,1]);
min_xs = np.reshape(np.min(X,axis=1),[-1,1]);
X = (X - min_xs) / (max_xs-min_... |
998,783 | c847e7131d3c378389993e1202a3b1570e7dd17c | import pandas as pd
# df = pd.read_csv("avg_county.csv", header = 0)
import numpy as np
# print df.head(5)
# df_co = df[df.Pollutant == "SO2"]
# # df_co.to_scv("avg_county_CO.csv", sep='\t', encoding='utf-8')
# # with open("avg_county_CO.csv", 'a') as f:
# # df_co.to_csv(f)
# with open("avg_county_SO2.csv", 'a') ... |
998,784 | 15bcd17b5d3796b85c72cd12864e0ef6773c55f5 | #!/usr/bin/env python
# TODO: Free energy of external confinement for poseBPMFs
import os
import cPickle as pickle
import gzip
import copy
from AlGDock.IO import load_pkl_gz
from AlGDock.IO import write_pkl_gz
from AlGDock.logger import NullDevice
import sys
import time
import numpy as np
from collections import O... |
998,785 | d7b4ef489c689641527cf0de695799c143050d6a | from datetime import datetime
from blocku import Blocku
import players
def main():
stateCount = 0
dataSetSize = 500000
while True:
game = Blocku(players.SmartPlayer(5))
startTime = datetime.now()
results = game.run()
stateCount += results["moves"]
print("Final s... |
998,786 | 9d79d039f47ffb248b8e5e57aa2a2af637a9b476 | # 914000210
sm.killMobs()
sm.removeSkill(20000016)
sm.giveSkill(20000016)
sm.warp(914000220, 1) |
998,787 | 74ba1929ca8dc8c78f38b2bc90ce47e9d64506ed | # -*- coding: utf-8 -*-
# Author: eNovance developers <dev@enovance.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... |
998,788 | 33ad4402512dee51654a51e13e2e6df120b989fa | import shared_buffer
from shared_buffer import *
import sys
import os
import threading
import logger
from logger import Logger
from defines import *
import socket
import Queue
from datetime import datetime
class basicNetworkServiceLayer(threading.Thread) :
def __init__(self,hostID,logFile,hostID_To_IP) :
threadi... |
998,789 | 047140339341fa4c5eecab8dc6d8202117d272aa | from decimal import *
from django.contrib.auth.models import User
from django.shortcuts import render
from .forms import CsvModelForm
from .models import Csv
from cadastros.models import Nota, Cotacao, Proventos
import csv
# Create your views here.
def upload_files_view(request):
form = CsvModelForm(request.POST o... |
998,790 | 3af1f8b8bf0fa1444ee4fe7e5114417cd9bd4771 | import random
STATUS_ALIVE = 'alive'
STATUS_DEAD = 'dead'
class Dragon:
def __init__(self, name, position_x=0, position_y=0, texture='dragon.png'):
self.name = name
self.hit_points = random.randint(50, 100)
self.position_x = position_x
self.position_y = position_y
self.te... |
998,791 | 694d491f11505a5715698aa5cd88dbfef8ea3760 | import argparse
import os
import cv2
import json
import natsort
import time
import logging
from ticket_scan.scanner import slicer
from ticket_scan.scanner.ocr import extract_text_from_image
from ticket_scan.scanner.helpers import setup_logging
DEFAULT_OEM = 1
DEFAULT_PSM = 7
DEFAULT_SIDE_MARGIN = 5
logger = logging.... |
998,792 | f011a60576493dcd5e914ad8fdd2b7867dca93a6 | import os
T = 100
print T
for k in xrange(T):
n = 20
print n
foo = int(os.urandom(4).encode('hex'), 16)
row = ''
for i in xrange(n):
if len(row)>0:
row += ' '
if (foo&(1<<i))!=0:
row += '1'
else:
row += '0'
print row
|
998,793 | 8bc207db9d6e7ac1b78a5c313c3026f09f793d05 | import tweepy
import json
import csv
class JSONEncoder(json.JSONEncoder):
"""Allows ObjectId to be JSON encoded."""
def default(self, o):
if isinstance(o, ObjectId):
return str(o)
return json.JSONEncoder.default(self, o)
def read_twitter_json(f):
"""Read twitter JSON file.
... |
998,794 | bf994521f9025c85ad14c1e959ebf9701baf954b | class Test002:
def test001(self):
print('\n--test002') |
998,795 | 057fbdb9557545be10d1cf37881a839399942e86 | import settings
import equations
import time
import tkinter as tk
from threading import Thread
INTERVAL = 1
class MainPanel:
def __init__(self):
pass
def start(self):
self.root = tk.Tk()
self.root.geometry('1000x1000')
self.root.title('Penny')
self.ad... |
998,796 | c1d59ef99bc57a73b89ac7d0771b9293f86417e7 | # Generated by Django 3.1 on 2020-12-03 09:10
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('game', '0004_myteam'),
]
operations = [
migrations.AlterField(
model_name='myteam',
name='D',
field=models... |
998,797 | 8128a1c2fc2b531248b95b8f30367798787df8a0 | '''
Created on Jun 25, 2015
@author: Edmundo Cossio
'''
from selenium.webdriver.support import expected_conditions as EC
from robot.libraries.BuiltIn import BuiltIn
from selenium.webdriver.common.by import By
from Singleton.DriverManager import DriverManager
from Singleton.GlobalVar import HomePageURL
class CreateA... |
998,798 | 9bd3b778974b7b399bb262609fa7340d0002610f | # pylint: disable=unused-variable
from dataclasses import dataclass, is_dataclass
from datafiles import decorators
def describe_datafile():
def it_turns_normal_class_into_dataclass(expect):
class Normal:
pass
cls = decorators.datafile("<pattern>")(Normal)
expect(is_dataclas... |
998,799 | ebdf5dbd0cbbadf5028929d1abe289a3af691820 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('TaskAndFlow', '0018_flowtemplatestep_sequence'),
]
operations = [
migrations.AlterModelOptions(
name='eventstepo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.