index int64 0 1,000k | blob_id stringlengths 40 40 | code stringlengths 7 10.4M |
|---|---|---|
984,900 | a2969c9795560c37863f5ccd46a783736dffdad8 | #!/usr/bin/env python3
from __future__ import print_function
import platform
import sys
print(platform.python_version())
python_version = sys.version_info.major
print("version is %s"%python_version)
def main():
# arrLen = int(input("Please input arrLen : "))
# rotation = int(input("Please input rotation : "))
... |
984,901 | 7e8db926f6e3608cca8116734a404903042364c3 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-06-17 21:58
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('home', '0002_auto_20170609_0544'),
]
operations = [
migrations.RemoveField(... |
984,902 | 182cd289e6c2b7abd3fb43047f48da36fd1a2e55 | from .tensor import Tensor
from .modules import Module
# 几类优化器的实现
class Optim(object):
def __init__(self, module, lr):
self.module = module
self.lr = lr
def step(self):
self._step_module(self.module)
def _step_module(self, module):
# TODO Traverse the attributes of `self... |
984,903 | 14f85f19b4ea29b2d115e567336d8948733f40b3 | # coding=gb18030
import serial # 导入serial包
import time # 导入time包
import pymysql # 导入pymysql包
log = 0 # 设一个log变量用于记录单次接收次数
s = serial.Serial('com1', 9600, timeout=2) # 打开串口,配置串口
db = pymysql.connect("localhost", "root", "jinhao", "zigbees") # 打开数据库,配置数据库
cursor = db.cursor() # 数据库操作
while True: # 无限循环读取数据
... |
984,904 | ac01abb0a9bae4a0b39160899dd90df1ebdec13c | from typing import List
class Solution:
@staticmethod
def dump(v):
print(', '.join([f'{k}: {v}' for k, v in v.items() if k != 'self']))
def movesToMakeZigzag(self, nums: List[int]) -> int:
# 2 cases (start up->down) or (start down->up)
start_up_down = 0
start_down_up = 0
... |
984,905 | 4bb1bb941ac913b2f56437a7460d8090a920c682 | from django.conf.urls import patterns, include, url
from django.views.generic import TemplateView
from django.contrib import admin
admin.autodiscover()
from posts.views import PostArchiveIndexView, PostArchiveMonthView, PostArchiveYearIndex, PostDetailView, PostListView, PostTagListView, sitemaps
from posts.feeds imp... |
984,906 | 13c56f189d43308af1c39aa501e224c35ac67bc6 | #!/usr/bin/python3
import json
import sys
import getopt
import requests
import hashlib
import json
import os
import gnupg
class backmeup():
def __init__(self,serverurl,name,key):
self.endpoint=serverurl
self.key=key
self.name=name
self.gpg = gnupg.GPG(gnupghome='.')
def fileback... |
984,907 | 9987e9604e56c44e3c8e066deecaddebea62eec5 | ST_s_photon_ID_ = [ 1.02619, 1.02181, 1.02215, 1.0292, 1.02855, 1.0189]
ST_s_electron_ID_ = [ 1.00389, 1.00624, 1.00682, 1.00309, 1.15322, 1.00433]
ST_s_electron_Reco_ = [ 1.00092, 1.00116, 1.00123, 1.00024, 1.00076, 1.00091]
ST_s_electron_HLT_ = [ 1.00106, 1.00154, 1.00316, 1.00059, 1.00218, 1.00151]
ST_s_muon_ID_... |
984,908 | b131e2a01d99dd8280afc8706997eec689e7b19b |
possibles = [(x,y,z) for x in xrange(500) for y in xrange(500) for z in xrange(500) if x**2 + y**2 == z**2 and x+y+z == 1000]
answer = reduce(lambda x,y: x*y, possibles[0])
print answer
|
984,909 | 820c81f962b15a750d2578eaf8c1846590a25e76 | #MenuTitle: Storm
# -*- coding: utf-8 -*-
__doc__="""
Storm
"""
import GlyphsApp
from NaNGFGraphikshared import *
from NaNGFNoise import *
from NaNFilter import NaNFilter
class Storm(NaNFilter):
gridsize = 30
minsize, maxsize = 30, 80
def setup(self):
self.stormcomponent = CreateShapeComponent(self.font, self.m... |
984,910 | 629f6b13052e1d4dfbbdd61440e59ec80f2dfd4a |
# unit test case
import unittest
import collections
import sys
f = open("AdamFarid.ged", "r")
nameArr = []
birthDate = []
for line in f:
names = line.split(" ")
if "NAME" in line:
ans = " ".join(names[2:])
nameArr.append(ans)
if "DATE" in line:
dates = " ".join(names[2:])
... |
984,911 | 2ca66949858005a655113026421fc9a074593469 | '''
Collection of little pythonic tools. Might need to organize this better in the future.
@author: danielhernandez
'''
import datetime
import string
def addDateTime(s = ""):
"""
Adds the current date and time at the end of a string.
Inputs:
s -> string
Output:
S = s_Dyymmdd_HHMM
... |
984,912 | b9a71becbf1728edca7c6cd703c7e09d09ffeccf | from selenium import webdriver
import time
#------| Code used to login wit user : user and password : password#
def login(driver,user,password):
try:
element=driver.find_element_by_xpath("//li[@id='login']//a[text()='Login']")
element.click()
time.sleep(2)
element=driver.find_eleme... |
984,913 | bd0010d35d3476de727f0ed6ffd4ffcf93d435cb | # Script to run shiftx2 on the test set of protein structures
# Can't use batch mode because they may have different pH and temperatures
import nmrstarlib
import collections
from os import system
import pandas as pd
from pathlib import Path
path = Path("/Users/aph516/GitHub/NAPS/")
# Get table which links BMRBs to P... |
984,914 | 3390c7f1c4dc46cb37ed1ace3bd34f37105b6ae6 | class Node(object):
def __init__(self, v):
self.val = v
self.next = None
def play(x, p2=False):
x = [int(i) for i in x]
if p2:
x += [i for i in range(10, 1_000_000 + 1)]
s = Node(x[0])
d = {s.val: s}
for i, v in enumerate(x[1:]):
d[v] = Node(v)
d[x[i]].ne... |
984,915 | 9f36f1e2e8a2e1fcafb7fa6e5682d1aa182a78f7 | #Solving a 4x4 gridworld using Monte Carlo Every-visit On Policy method (epsilon-greedy).
#The policy pi_(a|s) takes 4 actions equiprobably: Left, Right, Up, Down. Thus pi_(a|s) = 0.25 for all states
#The agent is transferred deterministically, hence p(s',r|s,a) = 1 for all states
import random
import numpy as np
from... |
984,916 | 9ee3228f924269e0884da81532e00b6d60a8eace | from django.contrib.auth.models import User
from django.db.models import Q
from django.shortcuts import render, redirect, get_object_or_404
from django.views.generic import ListView, DetailView
from django.contrib.auth.decorators import login_required
from django.contrib.auth.mixins import LoginRequiredMixin
from .mod... |
984,917 | ce1b55c0815b50c65df06204b739eab275e6c243 | import os
import time
from lambdatrader.constants import M5
MINUTE_SECONDS = 60
HOUR_SECONDS = 60 * MINUTE_SECONDS
DAY_SECONDS = 24 * HOUR_SECONDS
WEEK_SECONDS = 7 * DAY_SECONDS
MONTH_SECONDS = 30 * DAY_SECONDS
YEAR_SECONDS = 365 * DAY_SECONDS
def pair_from(first_currency, second_currency):
return first_curren... |
984,918 | 9e98c3c99d6ed690edfce6674403a9e6c44ffb3d | from django.http import HttpResponse
import json
from django.db import connections
from datetime import date, datetime,time
import math
def dictfetchall(cursor):
desc = cursor.description
return [
dict(zip([col[0] for col in desc], row))
for row in cursor.fetchall()
]
def json_serial(obj):
"""JSON... |
984,919 | 664fabd9ed01de098edd3b9faf81d80081d3be95 | # -*- coding: utf-8 -*-
"""
Created on Fri Aug 4 21:07:45 2017
@author: Renuka L K
This is the code to implement Logistic Regression algorithm from scratch in Python
This code expects the user to give data inputs
"""
import math
def Sigmoid(z):
return float(1.0/float(1.0 + math.exp(-1.0*z)))
def Hypothesis(theta... |
984,920 | 2731006c1c1e258ebac1789360fc61903f6a297d | #!/usr/bin/env python
# script to grab mate after subsetting somehow
# Matthew J. Neave 27.7.2017 <matthewjneave1@gmail.com>
# library imports
import sys
import argparse
from Bio.SeqIO.QualityIO import FastqGeneralIterator # requires Biopython
# use argparse to grab command line arguments
parser = argparse.Argumen... |
984,921 | 79126310a0e13af08d00c572d8c2d02bf19e5ac4 | import os
import time
import sqlite3
from pprint import pformat, pprint
from dir_file import GenericFile
from markup import Frame
import global_user_settings as settings
class Loader():
def __init__(self, f, aggregate_duplicate_varnames=False):
self.queue = []
self.add(f)
self._aggregate_... |
984,922 | d6a0cbc166b59f20aea78c59194cbb3ada6ea827 | # -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# d$
#
# This program is free software: you can redistribute it and/or modify
... |
984,923 | 59bf3317f36689ca8263a31fe23919485cf51af2 | import numpy as np
from scipy.interpolate import interp2d
import cv2
import os
from data_helper import Load_Data
def BiInterpn(x, y, img, H, W, C, img_mask = None):
tmp_img = np.zeros((H, W, C), dtype = np.int)
## ramove all the illegal points
img_h, img_w = img.shape[:2]
mask = (x < 0) | (x >= img_w -... |
984,924 | 9dd68ace2406cbd33461f9b5d27b918e9fb19cd3 | import sys
from PyQt5.QtWidgets import QApplication, QWidget, QLabel
#from PyQt5.QtGui import QIcon
#from PyQt5.QtCore import pyqtSlot
from SimpleGame.Scene import Scene
from SimpleGame.Sprite import Sprite
from SimpleGame.Block import Block
from SimpleGame.Background import Background
from enum import Enum
import ran... |
984,925 | e537504c2615ad0fd1cc7203adea61583d00978d | import os
import io
import torch
import PIL.Image
import numpy as np
import scipy.signal
import matplotlib.pyplot as plt
from torchvision.transforms import ToTensor
import iirnet.signal as signal
def plot_response_grid(
pred_coefs,
target_coefs=None,
target_mags=None,
num_points=512,
num_filters=... |
984,926 | d2527b6aba7186c50fc586cb1b7f7333408a7f15 | from django import forms
from website.models import Propriedade
class InserePropriedadeForm(forms.ModelForm):
class Meta:
model = Propriedade
fields = [
'nome_produtor',
'data',
'municipio',
'lote',
'area_total',
'talhao',
'area_talhao',
'matricula_lote',
... |
984,927 | 2facd5458d23d3c3d621aee394b231665b8dbc2c |
# test
print("init")
print("hello")
print("check")
print("final test")
|
984,928 | 78f238c735e17bcdddfec86a6943b3750d60632c | m = int(input("Informe o valor em metros: "))
conversao = m * 100
print("A conversão de {} metros é {} centimetros.".format(m, conversao))
|
984,929 | a3192017a31049ffb22857aab054fe956a2e7f3e | #!/usr/bin/env python
import base
import vault
import requests
import json
import sys
from termcolor import colored
ENABLED = True
class style:
BOLD = '\033[1m'
END = '\033[0m'
def banner():
print colored(style.BOLD + '[+] Searching in Shodan' + style.END)
def main(ip):
shodan_api = vault.get_ke... |
984,930 | ece41b07d6a1a3f4cc33796a765fa69668f5062d | from django.urls import include, path
from . import views
urlpatterns = [
path('',
views.UserListView.as_view(),
name='user-list'),
path('<int:pk>',
views.UserDetailView.as_view(),
name='customuser-detail'),
path('GetMyUser',
views.GetMyUser.as_view(),
name=... |
984,931 | 931a4d91627721c10d3f47ccd7e8c1cb30ce961f | L = int(input())
x = L / 3
V = x ** 3
print(V) |
984,932 | 1a9afc1f95113b7d8dedcf8c5d7ad9b58cd8f19f | from typing import Union
from disnake import ApplicationCommandInteraction
from disnake.ext.commands import (
bot_has_permissions,
BucketType,
Cog,
command,
Context,
guild_only,
max_concurrency,
slash_command,
)
from data import Utils
class Dj(Cog, name="dj.skip"):
def __init__(s... |
984,933 | dfb7a6bc5d820998c3bf50dd10b32d583d8cfd5e | import boto3
import argparse
from get_instances import get_instances
import pprint
ec2 = boto3.resource('ec2')
ec2_client = boto3.client('ec2')
pp = pprint.PrettyPrinter(indent=4)
name = None
def lambda_handler(event, context):
instances = get_instances()
if name:
instance_id = instances[name][0]['i... |
984,934 | b372e928fe7777896b866052874da65747134a2e | # Import base library modules - From Bluetooth symbolic link to /base_lib
from base_lib.v1_00_Config_Logger \
import v1_00_Config_Logger
#
# SuperClass.
# ----------------------------------------------------------------------------
class Config_Logger(v1_00_Config_Logger):
def __init__(self, control=None, modu... |
984,935 | d5ad6d7c22d647be13c4d019c1289512ae3c728a | # OR157.LRU Cache
# 题目描述
# 设计一个数据结构,实现LRU Cache的功能(Least Recently Used – 最近最少使用缓存)。它支持如下2个操作: get 和 put。
# int get(int key) – 如果key已存在,则返回key对应的值value(始终大于0);如果key不存在,则返回-1。
# void put(int key, int value) – 如果key不存在,将value插入;如果key已存在,则使用value替换原先已经存在的值。如果容量达到了限制,LRU Cache需要在插入新元素之前,将最近最少使用的元素删除。
# 请特别注意“使用”的定义:新插入... |
984,936 | 4ed99b6fb20376ce0e98fe6f3c3b5e353ba1c5dd | #-*-coding:utf-8 -*-
from django.contrib import admin
from models import Artigo
admin.site.register(Artigo) |
984,937 | e8b89ec89e14f8ea9e35c6c21db86b0c05679e9e | A,B,T= map(int, input().split())
print(T//A*B) |
984,938 | 849a3b347359507f8cb97b1568b40c339c3136d9 | #!/usr/bin/python3
"""0-rectangle
"""
class Rectangle:
"""Rectangle
"""
def __init__(self):
"""init-self
"""
pass
|
984,939 | a74845d74af389c3c49bb36f6842c1c3e8d79698 | import copy
import sys
A_COMMAND = 'A'
L_COMMAND = 'L'
C_COMMAND = 'C'
SYMBOL_TABLE = {'SP':0,'LCL':1,'ARG':2,'THIS':3,'THAT':4,'SCREEN':16384,'KBD': 24576} #R0-15 added in Parser
JUMP_DICT = {None:'000','JGT':'001','JEQ':'010','JGE':'011','JLT':'100','JNE':'101','JLE':'110','JMP':'111'}
DEST_DICT = {None:'000','M':'00... |
984,940 | 0ee9e0104a1616349d61c7e49c4b03d66747a65e | import requests
import os
from pyquery import PyQuery
from urllib.parse import urlparse, urljoin
import posixpath
import zipfile
USER_AGENT = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.98 Safari/537.36 Vivaldi/1.6.689.46'
VIVALDI_COM_URL = 'https://vivaldi.com/download/'
L... |
984,941 | 2af548bbe5a7cb273a85b1f7ed79e3f593801b14 | '''
Created on Dec 1, 2013
@author: KevinVillela
'''
def getBaseURL(startDate):
return "http://www.latimes.com/search/dispatcher.front?Query=finance&target=adv_article&date=" + startDate.strftime("%m/%d/%Y-%m/%d/%Y") + "&sortby=contentrankprof"
def sentimentToNumber(sentiment):
if (sentiment == "neutral"):
... |
984,942 | 98fe1916ab86c07e4d4228fae3c6e63a6642e1cf | from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "I Made Website With Python + Flask + Linux + Apache2!"
@app.route("/returnsHTML")
def secondEndPoint():
return """
<html>
<body>
<h1>What I learned about sed</h1>
<p><a h... |
984,943 | 92874c6849f2d326ca3c0471eb0923cf86652022 | # This file contains the loss calculation function that is specified in the paper
from itertools import product
import tensorflow as tf
import tensorflow.keras as keras
import tensorflow.keras.backend as K
import numpy as np
from tensorflow.keras.losses import KLDivergence
from tensorflow.math import divide_no_nan
fro... |
984,944 | a3976b4c40dbdb8e7c573efdf4d8bd06d34730b6 | #!/usr/local/bin/python
# -*- coding: utf-8 -*-
#System import
import os
# Django import
from django.core.exceptions import ObjectDoesNotExist
#Billing import
from default_periodic import settings
from probill.nas.models import *
from probill.billing.models import PeriodicLog,Account
from settings import *
def mai... |
984,945 | 7a21008be471e3925187dfc7cdca72eeacb4497b | from django.test import TestCase, Client
from django.urls import reverse
from django.contrib.auth.models import User
from profiles.forms import UserProfileForm
class TestUserViews(TestCase):
def setUp(self):
self.client = Client()
self.user = User.objects.create_user(
username='testuse... |
984,946 | 56f3af60a61979b02b11c095578618c1aa269c55 | def print_name(name):
print('Hello '+name)
print_name('Rajesh')
|
984,947 | 11b860d71608b8e0caed1e06a8db0ed97534864a | import numpy as np
import numpy.random as nprng
import theano
import theano.tensor as T
from theano_utils import floatX
class LogReg:
def __init__(self, inp, shape, act=T.nnet.sigmoid):
self.shape = shape
print(shape)
self.W = theano.shared(
value=floatX(nprng.randn(shape[0],... |
984,948 | 8cc9ae53f0ee8dbde98e7bc09975822d09f22ac5 | from aiounittest import AsyncTestCase
from robot.collector.shortcut import *
class FlatCollectorTest(AsyncTestCase):
async def test_flat(self):
item = [
[0, 1, 2, 3],
[4, 5],
(6, 7,),
[8],
(9,),
]
expected = list(range(10))
... |
984,949 | 281d1ea7990beea595437e93576c7d169d495e9f | """
This program maps out the config file to be ordered in the form of (r,g,b)
it remaps the original scheme to instead have it so that
each slot in the matrix to be arranged as such:
R
G B
it then takes the settings in rgbvalues.in and writes it into config.in
this loses purpose if other LED's are used.
"""... |
984,950 | e8ee6f603bf60dd2430a34aefcc78c6207abfcb8 | import logging
logger = logging.getLogger(__name__)
from abc import abstractmethod, ABCMeta
import game
from gcc_utils import deep_unmarshal, lto_to_cons, is_cons, cons_to_list, cons_to_mat
class InterpreterException(Exception):
pass
class GCCInterface(object):
__metaclass__ = ABCMeta
@abstractmethod... |
984,951 | 733f7137822c35ff69b0d0c877436e8eea9c5684 | from sys import maxsize
from Node import Node
from ChessBoard import ChessBoard
##======================================================================================================================
## Game Implementation
def Check(chessboard):
""" Check if anyone wins the game.
@param ChessBoard chessboar... |
984,952 | cfc9eb5896176b06bbcbdefd6dea681c29d0e2a6 | __author__ = 'zhangxa'
from tornado import gen
from tornado.ioloop import IOLoop
@gen.coroutine
def cor(n,str):
for i in range(n):
print(str,n)
yield gen.sleep(1)
return str
@gen.coroutine
def main():
a = cor(3,"first")
b = cor(3,"second")
print(a,b)
IOLoop.instance().run_sync(m... |
984,953 | fde63862332d28273792b646730156ccf84e1a1d | """A dictionary is a python data structure that matches KEYS with VALUES.
You can look up a value using its key. KEYS must be unique,
but values can be the same."""
"""Example is the English Dictionary. Key = the word
value = the definition."""
#Declare a dictionary with known VALUES
spanish_english = {
... |
984,954 | 662ef9c33080257fdf685daf71af8eadd4d3dfb6 | from datetime import datetime
from unittest import TestCase
from Budget import Budget
from BudgetManager import BudgetManager
from Period import Period
class TestBudgetManager(TestCase):
def test_no_period(self):
bm = BudgetManager
bm.get_budgets(Budget("201703", 31))
self.assertEqual(bm.a... |
984,955 | 7b9e517c7e4598ea0e99ef8ef3ee835cbc176f80 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from qubayes_tools import *
from network_setup import *
def get_probabilities(node):
############################################
# USE THIS FUNCTION TO FIND THE PROBABILITIES FOR AN INDIVIDUAL NODE IN THE NETWORK
### INPUT ###
... |
984,956 | 36cf9137ce62f11f7560f5b102aef1f9c4632d68 | # Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#! /usr/bin/env python3
import pandas as pd
import sys
import json
import numpy as np
import mmh3
import binascii
def compute_hash(url, text):
if url is None:
url = ''
if text is None:
text = ''
t... |
984,957 | 13d505d558f20b6eb9ae2d3f6307d46fa02552b2 | #-*- coding:utf-8 -*-
#'''
# Created on 19-7-16 下午2:16
#
# @Author: Greg Gao(laygin)
#'''
from .std_vgg16 import StdVGG16
__all__ = ['StdVGG16']
|
984,958 | 2962f48dde414b1f94683c4b8d847713430c0619 | """Solves the maze using A* algorithm"""
#****************************************Imports********************************
#****************************************Classes********************************
class Node(object) :
def __init__(self, coords, goal_coords, current_path_length) :
"""Sets the ... |
984,959 | fb982e38be9856f62c6a77c0ce1b09465bc30f59 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created 24.05.19 09:56
@author: mvb
"""
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Apr 5 09:11:42 2019
@author: mvb
"""
from multiprocessing.connection import Client
import numpy as np
import os
import pickle
import pandas as pd
import matplo... |
984,960 | 46447f4113a099fac0021077b137c1b2f9ea8dc7 | import uvicorn
from fastapi import FastAPI
from joker.controller import joke_controller
app = FastAPI(
title="The Joker API",
description="Handle (really) funny jokes",
version="0.1beta"
)
app.include_router(joke_controller.router, tags=["jokes"])
if __name__ == "__main__":
uvicorn.run(app)
|
984,961 | f45c30beccda61e48aa61bb0acc1825a00995f4a | import svgwrite
from xml.dom import minidom
import math
def distanceBetweenPoints(x1, y1, x2, y2):
distance = math.sqrt(((x1 - x2)**2) + ((y1 - y2)**2))
return distance
class Element:
def __init__(self, xcoordinates, ycoordinates, tag):
self.xcoordinates = xcoordinates
self.ycoo... |
984,962 | 002a23f49c418f303aa4f4f41e88cfb0573a538d | import os
def url_user_img(instance, filename):
return 'users/%d/profile/%s'%(instance.user.pk, filename.encode('utf-8'))
def url_gallery_img(instance, filename):
return 'gallery/users/%d/uploads/%s'%(instance.user.pk, filename.encode('utf-8'))
def url_gallery_thumbnail(instance, filename):
return 'galle... |
984,963 | 82b5e6dbb4b2fce722c43b791c0987bf9093a7ba | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 25 11:36:41 2018
@author: jorge
"""
import pandas as pd
import numpy as np
from sklearn.preprocessing import MinMaxScaler
class VenuesReader():
"""
it receives a filename to get the scores
"""
def __init__(self, filename, eps):
... |
984,964 | 628cda49ce747fde8a84abfe9909c8da463c15ec | import pygame, events
from events import event_maker
deadzone = 0.15
pygame.joystick.init()
# this method is supposed to be called early on in the main method. It will check all available joysticks, hopefully
# initialize them, and return them to main.
def prepare_joysticks():
joysticks = [pygame.joystick.Joysti... |
984,965 | be66c6e5b5c4c55a95bf0c7c12b9d3c2033d02e6 | import sys
import os
import os.path as osp
import datetime
from MDRSREID.utils.may_make_dirs import may_make_dirs
class ReDirectSTD(object):
"""Modified from Tong Xiao's `Logger` in open-reid.
This class overwrites sys.stdout or sys.stderr, so that console logs can
also be written to file.
Args:
... |
984,966 | cf3f54a46322bb1c1860d19dadb128a5e5885681 | import tkinter as tk
import os
import requests
from bs4 import BeautifulSoup
from tkinter.filedialog import askdirectory
def selectPath():
path_ = askdirectory()
path.set(path_)
def check_null():
#获取输入值
save_path = path.get()
img_path_a = img_path.get()
#判断输入是否为空
if save_path.strip() =="" ... |
984,967 | 19a296804ee1aab43987e65671b660423e7ee970 | #!/usr/bin/python3
# 1024.py
# Brennan D Baraban <375@holbertonschool.com>
"""Hodor with my Holberton ID 1024 times."""
import requests
from bs4 import BeautifulSoup
php = "http://158.69.76.135/level2.php"
user_agent = ("Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:64.0) "
"Gecko/20100101 Firefox/64.0")
... |
984,968 | d15b1e0ebcaad40d1e63f86516f9ea693408e80b | # Copyright ETH-VAW / Glaciology
#
# Module : Scripts.RadarDataLibrary.RadarData.DataDataShapefileWriter
#
# Created by: yvow
# Created on: 04.05.2015
# Imports
import os
import re
import abc
from RadarDataWriter import RadarDataWriter
class RadarDataShapefileWriter(RadarDataWriter):
__metac... |
984,969 | 4c3954893a86cb4634b1608d2020cfcf87f71376 | # Time Complexity : O(N)
# Space Complexity : O(N)
# Did this code successfully run on Leetcode : YES
# Any problem you faced while coding this : NO
"""
# Definition for Employee.
class Employee:
def __init__(self, id: int, importance: int, subordinates: List[int]):
self.id = id
self.importance... |
984,970 | f6d0424db5b202bdf125396f60731d956f9e7986 | # coding: utf-8
from __future__ import absolute_import
from datetime import date, datetime # noqa: F401
from typing import List, Dict # noqa: F401
from swagger_server.models.base_model_ import Model
from swagger_server import util
class Story(Model):
"""NOTE: This class is auto generated by the swagger code ... |
984,971 | b395a12224fe52cfa097f945a5886f6b0dbcc02d | import unittest
from unittest.mock import MagicMock
import unittest.mock
class Airport:
def __init__ (self):
self.planes = []
def land(self,plane):
self.planes.append(plane)
plane.landed(self)
class TestingAirport(unittest.TestCase):
def test_land(self):
airport = Airpor... |
984,972 | 14d7db11f6b67b3f8007e969cc8e0cf1816c27f1 | from django.shortcuts import render
from django.http import HttpResponse
# Create your views here.
'''
视图函数需要一个参数,类型 应该是HttpResquest
'''
def do_normalmap(request):
print("In do normalmap")
return HttpResponse("This is normalmap")
def withparam(request,year,month):
return HttpResponse('This is with param{0},{1}'.for... |
984,973 | 228309ceea72cb87375073dcbddc919b3191e94d | def solution(phone_number):
answer = ''
for i in phone_number[:-4]:
answer += '*'
answer += phone_number[-4:]
return answer
phone_number1 = "01033334444"
phone_number2 = "027778888"
solution(phone_number1)
solution(phone_number2)
# phone_number return
# 01033334444 *******4444
# 027778888 **... |
984,974 | 8e31ad26c3b61d4179dfa7b2897b5aa38e3e44af | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('auth', '0001_initial'),
]
operations = [
migrations.CreateMode... |
984,975 | 9f908e66584ef62e6ef9f9d75df7430f403a8c0c | import os
import pytest
ROOT = '/'.join(os.path.dirname(__file__).split('/')[:-3])
COVER_PACKAGE = '.'.join(__package__.split('.')[:-1])
def suite(*args):
source = [ROOT, '--cov={}'.format(COVER_PACKAGE)]
for arg in args:
source.append(arg)
pytest.main(source)
|
984,976 | cefbbec787c005b656b0562878248a4342b87c5c | from django.shortcuts import render
from django.contrib.auth.models import User
from django.contrib.auth import authenticate
from rest_framework.decorators import api_view
from rest_framework.response import Response
from rest_framework import status
from owner.models import Player, News, Own, Tournament
from .serial... |
984,977 | 68072761cb1f50f751cb67db990545f14f89cd32 | # Generated by Django 2.2.16 on 2020-09-28 06:12
from django.db import migrations, models
import django.db.models.deletion
import uuid
class Migration(migrations.Migration):
dependencies = [
('front', '0027_auto_20200928_0807'),
]
operations = [
migrations.AlterField(
model_... |
984,978 | bc4192b1cd779f9b5172754c43e07d84a9a38c62 | from player import Player
# from board import Board
import random
class IA(Player):
name = "Berlin"
gameSize = 5
no_win = 0
color = ["black", "white"]
DEPTH = 1
turn = 0
#declared here to prevent from initialization at each method calls
corners = ((0,0), (0,4), (4,0), (4,4))
... |
984,979 | 701c24a5c1e29f8eedf25c396a08d40b8f4c3874 | from memory_profiler import profile
import numpy as np
import time
import sys
src2index = dict()
index2src = dict()
def get_index(data_file):
"""获得原始data <-> index之间的映射
src2index 原始编号 =》现有编号
index2src 现有编号 =》原始编号
"""
nodes = set()
with open(data_file, 'r', encoding='utf-8') as f:
for... |
984,980 | 552ccbf042245d16155ad4fc57a9967dbfa433b0 | import requests as req
import json
from requests.auth import HTTPBasicAuth
import base64
from cryptography.fernet import Fernet
url = "http://localhost:8083/login"
'''
filepath = input("Enter the file name:")
url = url+filepath
response = req.post(url)
#print("File: ",response.json())
print("Response: ",response.tex... |
984,981 | 41544b61fa5f5f4a0f91f31d5a5fd403890455f7 | '''
--- Directions
Write a program that returns a list of all
primes up to a designated max.
--- Example
PrimeCounter(25)
[2, 3, 5, 7, 11, 13, 17, 19, 23]
PrimeCounter(11)
[2, 3, 5, 7, 11]
PrimeCounter(1)
[]
'''
def PrimeCounter(max_val):
if max_val < 2:
return []
primes = [2]
... |
984,982 | d17cdeff04c06e2217540f7386c3ecb822610b8b | #! /usr/bin/env python
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
984,983 | 06996c6a3dca6f1838d85ee336564c2906a70736 | import sys
from antlr4 import *
from JeleniepLexer import JeleniepLexer
from JeleniepParser import JeleniepParser
from JeleniepListener import JeleniepListener
def main(argv):
input_stream = FileStream(argv[1])
lexer = JeleniepLexer(input_stream)
stream = CommonTokenStream(lexer)
parser = JeleniepPars... |
984,984 | 1b1fd7e5c891e0ebb76af2a107d715f1e92d0292 | #coding=utf-8
# Import the converted model's class
from VOC0712Plus.VOC0712Plus import VOC0712Plus
import tensorflow as tf
from utils.nms_wrapper import nms
from jade import *
from layers.transformed_layer import transformed_image_tf
import argparse
class Refinedet512Model():
def __init__(self,args):
self.m... |
984,985 | a539f36745ccab2cb88c098c3e8f259f6a750196 | import sys
def is_tidy(n):
last = 0
for c in str(n):
if int(c) < last:
return False
last = int(c)
return True
def last_tidy(n):
str_n = str(n)
last = str_n[0]
# for i in range(1, len(str_n)):
# if str_n[i] == last and str_n[i:] != last * (len(str_n[i:])):
... |
984,986 | 051b665eeae501467103dd83f1637e34d10eba30 | # -*- coding: utf-8 -*-
import os
import pandas as pd
import nltk
from tools import proc_text, split_train_test, get_word_list_from_data, extract_feat_from_data, cal_acc
from nltk.text import TextCollection
from sklearn.naive_bayes import GaussianNB
from wordcloud import WordCloud
import matplotlib.pyplot as ... |
984,987 | 0c8ff3250c3a441ec815af1b96763e35d8583a27 | n = int(input())
p = list(map(int, input().split()))
minp = 2*10**5
ans = 0
for i in range(n):
if minp >= p[i]:
minp = p[i]
ans += 1
print(ans) |
984,988 | 740a8297ebd8671c5b8a915146592620400ded56 | from django.contrib import admin
from django.urls import path, include
from . import views
urlpatterns = [
path('pythonprojects/', views.pythonprojects, name='pythonprojects'),
path('webdevprojects/', views.webdev, name='webdev'),
path('mlprojects/', views.mlprojects, name='mlprojects'),
path('... |
984,989 | 4b15c0642fbf6c8797c13f0ed2114acf9bc0d19e | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import copy
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import _ut... |
984,990 | 32b6bdfbf93d9de828ce3a9997cc4cc2b7089745 | import numpy as np
from django.http import JsonResponse
from django.shortcuts import HttpResponse
def login(request):
a = np.array([[1,2,3],[4,5,6]])
return HttpResponse(a) |
984,991 | b406b7dd407831e76624c8a1a97dd7ec3c4a745f | import csv
from abc import ABC, ABCMeta, abstractmethod
from typing import Union
class ZajSpectr():
def __init__(self, filename:str = '', data: list = None, channel: list = None, exposition: int = 0, time: int = 0):
self._filename = filename
self._data = data
self._channel = chann... |
984,992 | cc53efbdb029be59446ffb600befe38e2498251e |
b=pow(2,2)
print1(b*2)
|
984,993 | 6f910c3342474214071d3c49f05a92ba3d3b2098 | from django.db import models
from apps.utils.models import Timestamps
class Certificate(Timestamps, models.Model):
name = models.CharField(max_length=100)
description = models.TextField()
|
984,994 | 2567e6902ba853491b9f558859cc7fc1e247482f | # -*- coding: utf-8 -*-
# @Time : 2019/7/1 10:11
# @Author : Mr.Li
|
984,995 | 2f8f80eb860376e837024ee44e5b476af4493e51 |
# coding: utf-8
# In[68]:
# import modules
import pickle
import pandas as pd
from pathlib import Path
from pull_data import get_url_csv
from pull_data import train
from pull_data import test
import numpy as np
from matplotlib import pyplot as plt
from sklearn.base import TransformerMixin, BaseEstimator
from sklearn... |
984,996 | fa24b6a8eea3e0fdb3f529ad107f9da1382c0243 | from pytube import YouTube
import argparse
parser = argparse.ArgumentParser(description='Process some integers.')
parser.add_argument("link",type=str,help='give URL of vedio to br download')
parser.add_argument("resolution",type=str,nargs='?',help="Resolution of vedio to be download ('High','Medium','Low')",default="H... |
984,997 | 03b8f9b216aeb8ee5282ce36dd590a588d53ba56 | sw_xss = [
['innerhtml', 'a', 0],
['script', 'a', 0],
['svg', 'a', 0],
['contenteditable', 'a', 0],
['x', 'a', 0],
['src', 'a', 0],
['iframe', 'a', 0],
['javascript', 'a', 0],
['embed', 'a', 0],
['math', 'a', 0],
['brute', 'a', 0],
['href', 'a', 0],
['form', 'a', 0],
['action',... |
984,998 | f6cf440f9453e24d9525269e9787c4202400578d | import numpy as np
import matplotlib.pyplot as plt
class investment:
def __init__(self, positions, num_trials):
""" class inputs constructor """
self.positions = positions
self.num_trials = num_trials
def stimulate(self, position_values, num_t... |
984,999 | bb01ee5b8f17559bcbe4d8e1ce324698b4a0a524 | name = input("Cual es tu nombre? ")
apellido = input("cual es tu apellido? ")
print(f"hola {name} {apellido} buen dia :) ") |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.