index int64 0 1,000k | blob_id stringlengths 40 40 | code stringlengths 7 10.4M |
|---|---|---|
997,000 | 30b017f9421b3e487e5d25f4b8acd6906ddd0e78 | class Ponto:
def __init__(self, x, y):
self._x = x
self._y = y
def getX(self):
return self._x
def getY(self):
return self._y
def setX(self, x):
self._x = x
def setY(self, y):
self._y = y
def qualQuadrante(self):
if(self.getX() > 0... |
997,001 | fdb61ad4a468b05c2a57d2340328c9293d8fdea4 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
li = []
with open("D:\coding\python\project\python-upgrade\day05\\test05.txt",'r') as f:
with open("D:\coding\python\project\python-upgrade\day05\\test05_new.txt",'w') as g:
for line in f:
print(line)
if line not in li:
l... |
997,002 | 63e2605c1babc8114c89457d8154576a27fff54f | '''
leetcode 1047 删除字符串中相邻重复的字符
给定由小写字母组成的字符串,相邻重复字符删除会选择两个相邻且重复的字符并删除它们。在字符串上反复执行删除操作,知道无法继续删除,返回删除后的结果。
思路:使用栈来完成删除操作。遍历字符串,若栈不为空且当前字符与栈顶字符相同的栈顶字符出栈,否则当前字符入栈。遍历完成后将栈中的字符拼接起来即为删除后的结果。时间复杂度O(N),空间复杂度为O(N)。
'''
class Solution:
def removeDuplicates(self, S: str) -> str:
stack = []
for char in S:
... |
997,003 | bd13cf83262f6d219857ed05860e33d7255e2210 | from tkinter import *
from tkinter import filedialog
from over_temps import go_time
from under_temps import go_time2
wo_num = wo_num2 = wo_num3 = wo_num4 = wo_num5 = wo_num6 = wo_num7 = wo_num8 = wo_num9 = wo_num10 = [''] * 10
total_wo = [wo_num, wo_num2, wo_num3, wo_num4, wo_num5, wo_num6, wo_num7, wo_num8, wo_... |
997,004 | 234282af56b2d04b73c7199b4670ca1749848dea | refresh = 5
version = 20160123.01
urls = ['http://www.radioalgerie.dz/news/ar/']
regex = [r'^https?:\/\/[^\/]*radioalgerie\.dz']
videoregex = []
liveregex = [] |
997,005 | 3bab32aa503de268a7992da8c3d825898f5e0909 | #!/usr/bin/python3
import cgi
import subprocess
import convertImage
print("content-type: text/html")
print()
mydata = cgi.FieldStorage()
name = mydata.getvalue("x")
reg = mydata.getvalue("y")
convertImage.convertImages(name, reg)
|
997,006 | fd0683582d27f2ff1c72ef99f54540cf7d83bf83 | from lichee import plugin
from lichee.representation import representation_base
@plugin.register_plugin(plugin.PluginType.REPRESENTATION, "pass_through")
class PassThroughRepresentation(representation_base.BaseRepresentation):
"""Pass through repr layer provides
Attributes
----------
features: torch.... |
997,007 | f9851e49b78cd2e194cce713b69bea0287d43dfd | """empty message
Revision ID: a634a2fa3ae8
Revises: 6481f0c7c406
Create Date: 2021-08-29 21:40:40.486700
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
# revision identifiers, used by Alembic.
revision = 'a634a2fa3ae8'
down_revision = '6481f0c7c406'
branch_labels = None
depe... |
997,008 | 724097ddad7dee94da5548c3afa5fd9c3de95e77 | # Problem No.: 25
# Solver: Jinmin Goh
# Date: 20191211
# URL: https://leetcode.com/problems/reverse-nodes-in-k-group/submissions/
import sys
# Definition for singly-linked list.
class ListNode(object):
def __init__(self, x):
self.val = x
self.next = None
class Solution(object):
d... |
997,009 | f36f6c110f29908e8b85c1fbee0996db53779b1e | from main import db
from time import sleep
from data.__all_models import Job, Player
def payday():
players = db.query(Player).all()
for player in players:
job_id = player.job
job = db.query(Job).filter(Job.id == job_id).first()
player.money += job.wage
db.commit()
print('payday... |
997,010 | 3feccc30ff4e0f9510c28101b07391b885dbd8ec | pi = 3.141592654
es_cierto = True
numero = 0
dividendo = 1
divisor = 3
print("pi :", round(pi, 6))
print("Progresion PI dividendo divisor")
print("------------- --------- -------")
while es_cierto:
numero += round(dividendo / divisor, 5)
print(" {:6.5f}".format(numero).ljust(1... |
997,011 | 7f9143c481ca3fc701b1fb22de6baba697b5d4af | from django.shortcuts import render
from django.contrib.auth.decorators import permission_required
from django.contrib import messages
import csv, io
from zipfile import ZipFile
from django.core.files.base import File
from django.contrib.auth.decorators import login_required
from teacherportal.models import Teacher, S... |
997,012 | 199ca5e172d559ad11bcc65aebbf2b985aa4b58e | import tkinter as tk
from num_guess_game import *
game = guess_num_game(0, 0)
game_made = False
game_over = False
def make_game():
global game_made, game
try:
num1 = int(entr_first.get())
num2 = int(entr_second.get())
except ValueError:
game_made = False
lbl_display2["text... |
997,013 | 9e890662241aadcb87edd9fd00fc0059d886278e | suite = {
"mxversion" : "5.199.0",
"name" : "graal-generator-tests",
"defaultLicense" : "GPLv2-CPE",
"versionConflictResolution": "latest",
"imports": {
"suites": [
{
"name": "compiler",
"subdir": True,
"version": "f2916dbcc8a1e0... |
997,014 | 472c9f28a197bbe459ae328d81a61c4e2609a8f9 | import pygame
from gameoflife import settings
class InfoText(pygame.sprite.DirtySprite):
def __init__(
self,
text,
size,
pos=(0, 0),
font=settings.TEXT_FONT,
color=settings.TEXT_COLOR,
alpha=False,
):
super().__init__()
self.color = colo... |
997,015 | ec054a5d68c497adbc701ad15d5cdce17a721263 | from random import randint
nlaunch = 1000
sucess = 0
for i in range(nlaunch)
if randint(1,6) + randint(1,6) == 7
sucess = sucess + 1
frequence = nlaunch / sucess
print(frequence)
|
997,016 | 4b932e78e493f83ac424abdeea8bd3f8cf10078d | from tests.conftests import _app
import json
from datetime import datetime
EMP_API_URL = '/api/employee/'
def test_employee_get(_app):
url_present_object = EMP_API_URL + '1'
url_missing_object = EMP_API_URL + '2'
response_p = _app.get(url_present_object)
response_m = _app.get(url_missing_object)
... |
997,017 | 790b24d3a1bca95141fee1272d8d0f13ef055061 | import os
import platform
import socket
from datetime import date
import asyncio
import psutil
import requests
from fake_useragent import UserAgent
from flask import Flask, render_template,request
from flask_socketio import SocketIO
import subprocess
import dns.resolver
from cprint import *
app = Flask(__name__)
app.c... |
997,018 | 33a9226c1ebf2a74084b64e608c18c4efaf2beb2 | # Base interface for spells. Includes methods for accessing crystals within the
# spell grid along and for accessing the total combined effects of a spell given
# the player's current layout.
import copy
import math
import random
from attackdata import *
from crystal import *
from hexgrid import *
from window import... |
997,019 | 15bf78986887e579784aa8a63dc58f1ba72f36ba | from game.component import EventComponent, Tag
from game.event import Event, EventType, ActionEventType, CaveEventType, CollisionEventType
from game.script.script import Script
class Exit(Script):
def start(self, entity, world):
self.entity = entity
self.world = world
self.event_bus = worl... |
997,020 | 8918acab02250ea507e8a4f9d3941783be304b0d | from flask_wtf import FlaskForm
from wtforms import StringField, BooleanField, SubmitField, PasswordField
from wtforms.validators import Length, DataRequired, EqualTo, Email
class RegistrationForm(FlaskForm):
username = StringField('Username', validators=[DataRequired(), Length(min=2, max=30)])
email = Stri... |
997,021 | b19eec09c2eb8b8b260f7c937c6e70db0ad387ee | from PIL import Image, ImageDraw
SIZE = 256
image = Image.new("L", (SIZE, SIZE))
d = ImageDraw.Draw(image)
for x in range(SIZE):
for y in range(SIZE):
d.point((x,y), x)
image.save('./gradiation1.jpg')
|
997,022 | 64ab276258569d43726b34c177a7052081626d36 | #----------------------------------------------
# -*- encoding=utf-8 -*- #
# __author__:'xiaojie' #
# CreateTime: #
# 2019/4/25 10:39 #
# #
# 天下风云出我辈, ... |
997,023 | 4d93eeb9cbb566c2bf24a6b5325d5981ae92e4d7 |
def perrin(n):
if n==0: return 3
elif n==1: return 0
elif n==2: return 2
else: return perrin(n-2)+perrin(n-3)
|
997,024 | 914270ea88bbb2fb6c795450eb7e0fe6c14bd30b | from django import forms
from models import User
class InvitationForm(forms.Form):
email = forms.CharField(widget=forms.TextInput(attrs={'size': 32,
'placeholder': 'Email Address of Friend to invite.',
'class':'form-control search-query'}))
class RegisterForm(forms.ModelForm):
password = forms.CharField(widget=... |
997,025 | 4ab0b784e2f594a78375aa5e9845955da797158d | from django.urls import path
# from django.contrib.auth import views as auth_views
from . import views
urlpatterns = [
path('login/', views.connection, name='login'),
path('logout/', views.deconnection, name='logout'),
]
|
997,026 | 8d4ea849353312ff345e4c40f54e173c5f70561c | from django import forms
from django.forms import ModelForm
from network.models import Post, Profile
class PostForm(ModelForm):
class Meta:
model = Post
fields = [
'body'
]
labels = {'body': "What's on your mind?"}
widgets = {
'body': forms... |
997,027 | 2093667afe3db2d47609cb5106465d1089f967d4 | Python 3.5.3 (default, Jan 19 2017, 14:11:04)
[GCC 6.3.0 20170124] on linux
Type "copyright", "credits" or "license()" for more information.
>>> #Aula 2/5 - Curso SESC Consolação 04/04/2018
>>> print('Aula 2/5')
Aula 2/5
>>> #Exercício slide 46
>>> animal='gatinho'
>>> animal=[0:6]
SyntaxError: invalid syntax
>>> anim... |
997,028 | 464a81033731520ac2ac8b7e4f8df71170bac682 | # coding:utf-8
import easyhistory
# from easyhistory.store import CSVStore
from easyhistory import store
mystore = store.use(export='csv', path='history', dtype='D')
# result = mystore.get_factors('150153', '2015-03-25')
result = mystore.get_factors('150153', '2015-03-25')
print result |
997,029 | 2f1e95bc9121eb565641f65fbddadd81b10a617f |
__all__ = [
'Status'
]
class Status(object):
LOGOUT = 0
ONLINE = 10
OFFLINE = 20
AWAY = 30
HIDDEN = 40
BUSY = 50
CALLME = 60
SLIENT = 70
class ErrorCode(object):
DB_EXEC_FAILED = -50
NOT_JSON_FORMAT = -30
#upload error code
UPLOAD_OV... |
997,030 | adc3ad189064b64bd48a885dd5a7b35528fb0364 | import neural_network.reader as reader
from neural_network.network2 import NeuralNetwork
from util.frame import progress
from sklearn.metrics import f1_score, classification_report, accuracy_score
from util.dump import dump_object, load_object
from sys import stdout
from util.timer import Timer
import numpy as np
impor... |
997,031 | 17a13eb2424018488de35415c3f66fe07288b45b | from nltk import Tree
def buildTree(token):
if token.n_lefts + token.n_rights > 0:
return Tree(token, [buildTree(child) for child in token.children])
else:
return buildTree(token) |
997,032 | cc4d7128763b072ab06647ac2b5169d353394505 | __version__ = '0.2.1'
__author__ = 'chenjiandongx'
|
997,033 | f69764bf45e2369bf3144d1de307601fe42ed240 | # x = 0
# while x < 10:
# print(x)
# # x += 1
# x = x + 1
# x = 0
# while True:
# print(x)
# if x == 10:
# break
# x += 1
x = 0
flag = True
while flag:
print(x)
if x == 10:
flag = False
x += 1
|
997,034 | a88de60a1be600b11be5e0d6879260f43a2c6b6a | # -*- coding: utf-8 -*-
#
# File: plugins/etc_proposals.py
# This file is part of the Portato-Project, a graphical portage-frontend.
#
# Copyright (C) 2006-2010 René 'Necoro' Neumann
# This is free software. You may redistribute copies of it under the terms of
# the GNU General Public License version 2.
# There is NO ... |
997,035 | c555e82e99fce486be44a3090307a508933a39f9 | # 注意:在开发时,应该把模块中的所有全局变量全局变量
# 定义在所有函数的上方,就可以保证所有的函数
# 都能正常的访问到每一个全局变量
num = 10
gl_title = "黑马程序员"
name = "小明"
def demo():
# 如果局部变量的名字和全局变量的名字相同
# pycharm会在局部变量下方显示一个灰色的虚线
num = 99
print("%d" % num)
print("%s" % gl_title)
# print("%s" % name)
# 在定义一个全局变量
demo()
# 在定义一个全局变量
|
997,036 | 9433188449d55e624006bb4ee413f9fb3e0b9e72 | #!/user/bin/env python
#-*- coding:utf-8 -*-
import urlparse
import urllib2
import random
import time
import socket
from datetime import datetime
DEFAULT_AGENT = 'wswp' #代理
DEFAULT_DELAY = 5 #延迟时间
DEFAULT_RETRIES = 2 #重复次数
DEFAULT_TIMEOUT = 20 #等待时间
class Downloader(object):
'''下载类,提供网页下载功能'''
d... |
997,037 | d7b2a48e404092726c2b130212fa81bc0bbe60d0 | class Solution:
def reverseStr(self, s: str, k: int) -> str:
l = list(s)
res = []
step = 2 * k
sub_l = [l[i:i + step] for i in range(0, len(l), step)]
for i in sub_l:
if len(i) < k:
res.extend(i[::-1])
else:
res.extend(i... |
997,038 | 8aad13f9c378234f81d886cd21a1cbc754f8efbc | from flask import Flask
from flask_cors import CORS, cross_origin
app = Flask(__name__)
cors = CORS(app)
app.config['CORS_HEADERS'] = 'Content-Type'
@app.route("/")
@cross_origin()
def helloWorld():
return "Hello, cross-origin-world!" |
997,039 | 8e31030b19f02c0ef47b2065fdcfa1fb7fc0b5a9 | V = int (input())
votes = input()
A = votes.count("A")
B = votes.count("B")
if A+B==V:
if A> B:
print("A")
else:
print("B") |
997,040 | 329376e813155819f621eb37f0d53ec2fc17ede5 | from django.shortcuts import render
from rest_framework import status
from rest_framework.response import Response
from rest_framework.decorators import api_view, renderer_classes
from rest_framework.renderers import JSONRenderer
import requests
import environ
from environ import Env
from main.models import CustomUser,... |
997,041 | 944f2ba1003a5f0ac4b017351c580fa7280af6f2 | # -*- coding: utf-8 -*-
"""
Unsupervised text keyphrase extraction and summarization utility.
Rasmus Heikkila, 2016
"""
from collections import Counter, defaultdict
import networkx
import spacy
import itertools as it
import math
default_sents = 3
default_kp = 5
nlp_pipeline = spacy.load('en')
def summarize_page... |
997,042 | 625c7a8f53c7f349dfe13ff82e29dab7271a1b24 | """ insertion_sort.py """
def insertion_sort(arr):
""" performs an insertion sort on the input """
arr_len = len(arr)
for i in range(1, arr_len):
last_index = i
for j in reversed(range(i)):
if arr[last_index] < arr[j]:
arr[last_index], arr[j] = arr[j], arr[last_in... |
997,043 | 82d8aa0497cd15fb3a9329b2f13d26094cf463c7 | # Имеется реализованная функция f(x), принимающая на вход целое число x, которая вычисляет некоторое целочисленое
# значение и возвращает его в качестве результата работы.
# Функция вычисляется достаточно долго, ничего не выводит на экран, не пишет в файлы и зависит только от переданного аргумента x.
#
# Напишите прогр... |
997,044 | f05d4da245b93b5437fde1e194897e1e09347d63 | from flask import Flask, render_template, json
from markupsafe import escape
import urllib.request
import os
from datetime import datetime
from jinja2 import ext
app = Flask(__name__)
with urllib.request.urlopen("http://apis.is/petrol/") as url:
data = json.loads(url.read().decode())
def format_time(data):
... |
997,045 | 38984eb61e851535c55d91c310b43c03f6f5fcbd | import math
N=int(input())
A=list(map(int,input().split()))
L=[0]*(N+1)
for i in range(N):
L[i+1]=math.gcd(L[i],A[i])
R=[0]*(N+1)
for i in range(N-1,-1,-1):
R[i]=math.gcd(R[i+1],A[i])
M=[]
for i in range(N):
M.append(math.gcd(L[i],R[i+1]))
print(max(M))
|
997,046 | ae2b18466862f389aacf4d8a9d7eb46645f994e5 | # -- Defining tuples --
short_tuple = "Rolf", "Bob"
a_bit_clearer = ("Rolf", "Bob")
not_a_tuple = "Rolf"
# -- Adding to a tuple --
friends = ("Rolf", "Bob", "Anne")
friends.append("Jen") # ERROR!
print(friends) # ["Rolf", "Bob", "Anne", "Jen"]
# -- Removing from a tuple --
friends.remove("Bob") # ERROR!
print... |
997,047 | a94c24c0dfac9a2c1fb729fac2209eee18ffd2d2 | import mrcfile
import numpy as np
import math
from datetime import datetime
from scipy.ndimage import gaussian_filter
# data structure holds voxel information
class Voxel(object):
def __init__(self, x, y, z, density, region_id=-1, nlist=None):
self.x_coordinate = x
self.y_coordinate = y
se... |
997,048 | cca1d5979c245d5220d0147081ef338280d86513 |
from xai.brain.wordbase.verbs._reconquer import _RECONQUER
#calss header
class _RECONQUERING(_RECONQUER, ):
def __init__(self,):
_RECONQUER.__init__(self)
self.name = "RECONQUERING"
self.specie = 'verbs'
self.basic = "reconquer"
self.jsondata = {}
|
997,049 | f6853e5e2d0806fa8f079571593f8044c5370c13 | def get_sandwiches(*toppings):
print("\nThis sandwiches include: ")
for topping in toppings:
print("-" + topping)
get_sandwiches('tomato', 'potato', 'fish')
get_sandwiches('tomato', 'cheese', 'potato', 'tuna fish')
|
997,050 | bacd2f9b75b713450e3ed769e9543b6a1c31a3c7 | #! /usr/bin/env python
import rfmath
import wireless_network
def main():
print'==============================================================='
print'option 1 Calculate dBm or mW'
print'option 2 Kismet.netxml file parse'
print''
opt=input('What would you like to do? ')
if opt==1:
rfmath.main_menu()
if op... |
997,051 | de10edccf705518b2bbc7ca2838129130d421448 | #!/usr/bin/env python
# -*- coding:Utf-8 -*-
from __future__ import division
from pylab import *
import scipy.linalg as LS
from gg_math import *
from solveU import ComputeS
from solveS import SolveS, ComputeEddington, TauGrid, ComputeVfromU
def SolveFeautrier():
nbang = 8
grid, tmp, deltgrid = TauGrid(decnb = 20)... |
997,052 | 8e3707038f9ac01de6e28507c85d7981b5d7310e | from data_generator import generate_post, fetch_post
import threading
from ApiClient import ApiClient
base_url = 'https://world-bulletin-board.uc.r.appspot.com'
username = 'test1'
password = 'test1234'
def retrieve_post():
api_client = ApiClient(base_url=base_url)
api_client.login(username, passwo... |
997,053 | 82de3649d7470fb026aac9a37c27ce91ffd429ec | # Generated by Django 3.0.8 on 2020-09-22 14:27
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Command',
fields=[
('id', mod... |
997,054 | fb540eaa0a2fbe991cd5556718d47312901820e6 | #Fonseca lab_01
#project 1
levels = int(input("How many levels is your pyramid? ")) #ask the user how many levels is your pyramid
for k in range(1,levels + 1): #pyramid starts at 1, and ends at whatever number you entered for levels + 1.
print("*" * k) #printing out half pyramid
#project 2
levels = int(inpu... |
997,055 | 185f32746f170951d412e80c2402120911efa8e2 | #我的代码
class Solution:
def findPeakElement(self, nums: List[int]) -> int:
if len(nums) == 1:
return 0
if nums[1]<nums[0]:
return 0
if nums[-1]>nums[-2]:
return len(nums)-1
score = {}
score[0] =0
c=0
for i in rang... |
997,056 | c0e4f4b386ef9ee1537611ae3687f0d339ffc229 | import datetime
import gym
import itertools
from agents.sac_agent import SAC_agent
from utils import *
import argparse
def get_args():
parser = argparse.ArgumentParser(description='PyTorch GAIL example')
parser.add_argument('--env-name', default="Hopper-v2",
help='name of the environme... |
997,057 | 7a6b82290802265eced8842438fbdf8e9e7a42d4 | import picamera
from picamera import PiCamera
import time
import cv2
import numpy as np
import glob
from tqdm import tqdm
from matplotlib import pyplot as plt
#=====================================
# Function declarations
#=====================================
#Function that Downsamples image x number (reduce_facto... |
997,058 | da677e138a2d6b34413536f27ec8d9cab2541611 | # This is a testing suite for a pseudo ARMv7 cpu made using logisim
import math
import random
tests = open("ARMv7.txt", 'w')
tests.write("This is a testing suite for a pseudo ARMv7 cpu made using logisim\n")
def test():
tests.close() |
997,059 | a4590da8cfc6bf61e0fecdf1b0117efe5812b7ba | # -*- coding: utf-8 -*-
"""Generate a default configuration-file section for rc_data_feed"""
from __future__ import print_function
def config_section_data():
"""Produce the default configuration section for app.config,
when called by `resilient-circuits config [-c|-u]`
"""
config_data = u"""[feed... |
997,060 | 3cf0e2e84f56a84a6ee7152426e19f17a598c3d7 | #-------------------------------------------------------------------------------
# Name: settings.py
# Purpose: To create a game for my cs FSE
#
# Author: Ikenna Uduh, 35300999
#
# Created: 15-12-2017
#-------------------------------------------------------------------------------
import pygame
fr... |
997,061 | 14b635ce04c8494799350b170a5d4fd9fa85a607 | from itertools import count
from itertools import product
from itertools import takewhile
from eutility.eusequence import Primes
from eutility.eumath import quadratic
from eutility.eutility import Biggest
from eutility.eumath import primes
def euler027(limit):
'''Quadratic primes
Euler discovered the rem... |
997,062 | 16ef094895a656922174e028cd945015f9701655 | from slack import *
import argparse
import sys
def send_messages(channel, message, attachments):
try:
Slack(channel).send(message, attachments)
except Exception as e:
print(str(e))
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument("-c", "--channel", help="Canal SLACK a rece... |
997,063 | 36dcc3a9a86198eb61e5be289e370fe6dfd81fc1 | # MIT License
#
# Copyright (c) 2017, Stefan Webb. All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to us... |
997,064 | 448d93f997f72011385abd2c3583e6cbc52f79f4 | from django.db import models
#supplier Model
class Supplier(models.Model):
supplier_name = models.CharField(max_length=100)
supplier_address = models.CharField(max_length=300)
supplier_phone = models.CharField(max_length=12)
gst_uin = models.CharField(max_length=30)
state_name = models.Cha... |
997,065 | 66837d602a0017ee05a0876c5b511bf683e24d16 | VERSION = (1, 0, 2)
__version__ = '.'.join(str(n) for n in VERSION)
|
997,066 | 731f9bfffd27f8e44f2b12f19bbf1cd39aa7b837 | def pos_arroba(x):
a = x.find('@')
return x[:a] |
997,067 | 4b6719d5611a3e021da5411250618368c5b2951b | from ncssl_api_client.console.parsers.abstract_parser import AbstractParser
from ncssl_api_client.api.commands.invoker import Invoker
from ncssl_api_client.api.enumerables.certificate_types import CertificateTypes
class ActivateParser(AbstractParser):
def __init__(self):
self.name = Invoker.COMMAND_NAME_... |
997,068 | 05db1e39bf7638824b2c8dba027eb767409ae346 | #!/usr/bin/env python
# coding: utf-8
# This blog is a tour through Inheritance in Python.
#
# This blog assumes no prior knowledge, and teaches the Reader from the ground up what Inheritance and how to use it in Python.
#
# For the Reader who already knows inheritance and is reading this blog in order to audit it (... |
997,069 | f0e66ed08997973fe3dc5ea0694206e277ce2402 | qnt = int(input())
if 2 <= qnt <= 99:
for i in range(qnt):
pergunta = input()
if '?' in pergunta:
print("gzuz") |
997,070 | 9589f3c9be14c57cd3f58056ff52f1b0f348e005 | from zops.anatomy.layers.tree import merge_dict
from collections import OrderedDict
class FeatureNotFound(KeyError):
pass
class FeatureAlreadyRegistered(KeyError):
pass
class AnatomyFeatureRegistry(object):
feature_registry = OrderedDict()
@classmethod
def clear(cls):
cls.feature_reg... |
997,071 | 755f0412c720a75742f62da16381bbd7649cfd25 | name = "Danny"
age = 15
student = {"name": name}
scores = [100, 99, 95]
location = ('123 Main', 'NY')
for item in (name, age, student, scores, location):
print(f"{type(item)!s: <15}| repr: {repr(item): <20}| str: {str(item)}")
class Student:
def __init__(self, name, age):
self.name = name
... |
997,072 | 6e21348855d3ccb8903f6081f5618f21b9254c06 | import torch
from torch.utils.data import Dataset, DataLoader, WeightedRandomSampler
from tqdm import tqdm
import torchvision
import cv2
import numpy as np
from os.path import join, basename, dirname, exists
import json
from utils import get_paths, get_files_paths_and_labels
from utils import get_validation_augmentatio... |
997,073 | dad50d730a2a52db569f905adb3921b6f8a8e246 | import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
def w(x):
""" weight """
w = np.exp(-x**2)/np.sqrt(np.pi)
return w
def next_chain_link(x, y):
""" checks whether y is accepted as next chain link """
gamma = np.random.rand()
alpha = w(y)/w(x)
return alpha >= gam... |
997,074 | cc57f5812a111a62a43a8e0554c3c3dad5e2177f | #!/usr/bin/env python
import base64
from Crypto.Cipher import AES
import os
import secrets
import shelve
import tempfile
import sys
key_var = 'GIT_SHELL_CREDENTIALS_KEY'
path_var = 'GIT_SHELL_CREDENTIALS_PATH'
iv456 = 'sixteencharacter'
def newKey():
return base64.b64encode(secrets.token_bytes()).decode('ascii')... |
997,075 | 7806a018718f6dc011f0de35e104ad1622b2d191 | import socket
import math
import sympy
import math
from Crypto import Random
from Crypto.Cipher import AES
from Crypto.Hash import SHA256
import hashlib
########################################
class Server(object):
"""docstring for Server"""
def __init__(self):
self.serv = socket.socket(socket.AF_INET, socket.SO... |
997,076 | 9a8a2190579df2d6cc615547a1e9685511704e1e | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: winston
"""
from keras.models import Model
from keras.layers import Dense, Input, Dropout
from keras.optimizers import Adam
from utils import cc_coef
def dense_network_MTL(num_nodes):
inputs = Input((6373,))
encode = Dense(num_nodes)(inputs)
enco... |
997,077 | 939d23afb4fabe24afafae4c555a046b79cb4b63 | file = open('zen.txt', 'r')
text_list = []
for line in file:
text_list.append(line)
file.close()
for line in text_list[::-1]:
print(line, end='')
# зачёт!
|
997,078 | 47955a078cf27e9a4256b1f33b91d010a00fcfe4 | from rest_framework import serializers
from .models import ExercisesDetails
from exercises.serializers import ExercisesSerializer
class ExercisesDetailsSerializer(serializers.HyperlinkedModelSerializer):
#exercise_id = serializers.CharField(read_only=True) #use if only want to display exercise name
#usesexerc... |
997,079 | 7b240dff45162ee19bd99293b0f08539da5d7d28 | import numpy as np
from scipy.integrate import quad
from scipy.special import jv
from scipy.optimize import brentq
from scipy.interpolate import interp1d
import os, subprocess,copy,copy_reg,types
from multiprocessing import Pool, Manager
import itertools
import matplotlib.pyplot as plt
# This file contains functions u... |
997,080 | ce5d6e1d3b99d3b0b1ff5e70b2e4987f72e7073b | from django.shortcuts import render,redirect
from django.views.generic import View
from django.urls import reverse
from .models import *
from django.contrib.auth.models import User
from django.contrib import messages
# Create your views here.
# def home(request):
# return render(request,'index.html')
class BaseView(... |
997,081 | fb9613b7ba8a046b14c848a27eb6587bb4aaade1 | import gspread
from oauth2client.service_account import ServiceAccountCredentials
import config
import telebot
scope = ['https://spreadsheets.google.com/feeds', 'https://www.googleapis.com/auth/drive']
creds = ServiceAccountCredentials.from_json_keyfile_name('client_secret.json', scope)
client = gspread... |
997,082 | d28def87be06685fca05c953f2f593b1a3c00fdd | import sys
sys.path.append("librerias")
from Adafruit_PWM_Servo_Driver import PWM
import time
from Tkinter import *
from PIL import Image
import threading
# Initialise the PWM device using the default address
pwm = PWM(0x40)
# Note if you'd like more debug output you can instead run:
#pwm = PWM(0x40, debug=True)
#s... |
997,083 | a657179e0a29bbb71e438c345733e96855762c1e | #09_switch.py
import RPi.GPIO as GPIO
import time
# Configure the Pi to use the BCM (Broadcom) pin names, rather than the pin pos$
GPIO.setmode(GPIO.BCM)
switch_pin = 23
GPIO.setup(switch_pin, GPIO.IN, pull_up_down=GPIO.PUD_UP)
while True:
if GPIO.input(switch_pin) == False:
print("Button Pressed")
... |
997,084 | b9c4ddef03f5ce4eb2a61bb3d78ef1ec6fcf0702 | ## pythonAES.py
#
# Example on two-way encryption/decryption in AES for python
# Kudos goes to: https://gist.github.com/sekondus/4322469
# Another good ref: http://eli.thegreenplace.net/2010/06/25/aes-encryption-of-files-in-python-with-pycrypto
#
# LU: 08/03/16
## NOTES:
# 1 - AES requires two different parameters ... |
997,085 | 481c1c79f29ec8e494e867283542c1ff0c0e4f40 | from api import app
from api.model.email import Email
from api.model.mailgun import Mailgun
from api.model.mandrill import Mandrill
import unittest
import json
class TestCase(unittest.TestCase):
def setUp(self):
self.app = app.test_client()
app.config['TESTING'] = True
self.test_email = ... |
997,086 | e8c1091a69a3a91e0fa30145888fc2d58e21d1d4 | import numpy as np
import random
import tensorflow as tf
from tensorpack import *
import math
import tflearn
import scipy
import scipy.io as sio
import time
from tensorflow.python.framework import ops
import warnings
import os
import threading
class GeneratorRunner(object):
"Custom runner that that runs an genera... |
997,087 | 817de196caedd7db281bf61b4fc3440fc3244920 | import util
class Node:
id = 0
def __init__(self, state, parent, action, pathcost):
self.state = state
self.parent = parent
self.action = action
self.pathcost = pathcost
self.id = Node.id
Node.id = Node.id + 1
def __eq__(self, other):
return self.id == other.i... |
997,088 | 3ee7ad159cd548a1fe8aab3808fd6c1c9ed6172c | from CsvReader import *
from Network import Network, get_rating
from random import shuffle
from NetworkCupy import NetworkCupy
import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
import time
def test_network_automatically(network):
wines = get_normalized_data('../data/winequality-red.csv')... |
997,089 | 6b4479bbdfbf2ff249a546f645fd241b905a5a27 | from django.urls import path
from . import views
app_name="shop"
urlpatterns=[
path("",views.index, name="index"),
path("buy/<int:value>", views.buy, name="buy"),
path("addtocart/<int:id>", views.addtocart, name="addtocart"),
path("removefromCart/<int:id>", views.removefromCart, name="removefromCart")... |
997,090 | 2fb45c5e366b8e19ce1efe7d7e61ef8173d08efa | import sys
import shutil
import re
import string
import os
from subprocess import Popen, PIPE
####
if len(sys.argv) != 5: #remember, the script name counts as an argument!
print 'runjob.py <xml template> <runtype> <run number> <fileNumber>'
print '<runtype> can be eviotolcio, recon, dqm, dst'
sys.exit()
#... |
997,091 | 18c045b888e690532cac8b70669dc1e286713800 | """
* Copyright 2019 OpenStack Foundation
* 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 or agreed to in ... |
997,092 | d45c46d5badc8dffa7e81ffdb6e1e5d29a950782 | """
2019-03-08 https://www.geeksforgeeks.org/exploratory-data-analysis-in-python/
2019-03-08 pip install pandas
"""
def dataAnalysis():
import pandas as pd
Df = pd.read_csv("https://vincentarelbundock.github.io/Rdatasets/csv/car/Chile.csv")
Df.describe()
if __name__ == '__main__':
dataAnalysis() |
997,093 | 60ae685acf1ff1b61ab5913c8954c82c8c65223c | # -*- coding, utf-8 -*-
from collections import OrderedDict
QUALITY_DICT = OrderedDict((
# chords consist of 2 notes
('5', (0, 7)),
('sus', (0, 7)),
# 3 notes
('', (0, 4, 7)),
('maj', (0, 4, 7)),
('m', (0, 3, 7)),
('min', (0, 3, 7)),
('dim', (0, 3, 6)),
('aug', (0, 4, 8)),
... |
997,094 | 709f5fcad66648da32db04f1ce6d87686b2c4321 | import csv
from matplotlib import pyplot as plt
import matplotlib
import random
class ResultReader():
def __init__(self):
with open('Results.csv') as csvfile:
readCSV = csv.reader(csvfile, delimiter=',')
rows_list = []
count = 0
for row in readCSV:
... |
997,095 | 039a63c0168e6db3603f82ba8893ba8295c37f19 | from django.contrib import admin
from models import User
# Register your models here.
admin.site.register(User) #Para que el User model este en el Django model |
997,096 | cefaba81e67017355b0fd9a3abf3fd64ec69532c | import rpyc
from rpyc.utils.server import ThreadedServer
from rpyc.utils.authenticators import TlsliteVdbAuthenticator
import thread, time
from nose.tools import raises
from nose import SkipTest
try:
from tlslite.api import TLSError
except ImportError:
raise SkipTest("tlslite not installed")
users = {
"fo... |
997,097 | 2f3513ad97718d79e658b5b63e82791352a040b5 | class AutoEncoder: FeedForwardNN
__encoding__
def __init__(self, encoding):
self.__model__ = tf.keras.Sequential()
self.__encoding__= encoding
def addLayer(self,layer_type):
if layer_type != 'encoding':
self.__model__.add(l)
self.__model__compile()
|
997,098 | b36f3e793a87fe09e6a4921be5d8aa233c96ba61 | from pprint import pprint
import requests
# Работа с ВК
class VkUser:
url = 'https://api.vk.com/method/'
def __init__(self, token, version):
self.params = {
'access_token': token,
'v': version
}
# Поиск id номера в случае, если его нет
def search_id(self, user_ids):
search_id_url = self... |
997,099 | 4f348eca3fe0fd0b2fc70986a8ed8527d6b7c172 | import numpy as np
import openmdao.api as om
import dymos as dm
import matplotlib.pyplot as plt
from infection import Infection
pop_total = 1.0
infected0 = 0.01
ns = 50
p = om.Problem(model=om.Group())
traj = dm.Trajectory()
p.model.add_subsystem('traj', subsys=traj)
phase = dm.Phase(ode_class=Infection,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.