index
int64
0
1,000k
blob_id
stringlengths
40
40
code
stringlengths
7
10.4M
986,700
a2eab6002bf469c047a0467e21f184e8b93ac185
#! usr/bin/env python3 # -*- coding: utf-8 -*- # author: Kwinner Chen # python: v 3.6.4 # import re # import demjson from lxml import etree from urllib.parse import urljoin #, unquote, urlsplit from datetime import datetime from downloader import page_downloader # 该方法需要返回一个跟踪链接,和一个新闻链接列表 def news_list_parse(respons...
986,701
290216e5434987987b842d1bf27b953853693b7a
import exercise1 from math import pi def test_add(): sum = exercise1.add(2,3) assert sum == 5 def test_square(): squared = exercise1.square(2) assert squared == 4 def test_area(): circleArea = exercise1.area(5) assert circleArea == (pi*(5**2)) def test_calculateInterestRate(): rate = exe...
986,702
2308b2949728ae3b549bcfcb5fb76dab2fb54de8
#!/usr/bin/env python3 import re import sys import requests ip = sys.argv[1] data = requests.get(f'http://{ip}:9171/_debug_toolbar/sse') data = eval(data.text.split('\n')[2][5:]) print(data) ids = list(map(lambda x: x[0], data)) print(ids) for each in ids: r = requests.get(f'http://{ip}:9171/_debug_toolbar/{ea...
986,703
6eb0753679375688085e777cd14e3a9029a20e56
# salariedcommissionemployee.py """SalariedCommissionEmployee derived from CommissionEmployee.""" from commissionemployee import CommissionEmployee from decimal import Decimal class SalariedCommissionEmployee(CommissionEmployee): """An employee who gets paid a salary plus commission based on gross sales.""" ...
986,704
7f49d00a78eecaeda2870ea116d40596a23b59b2
x = int(input()) ans = x//11*2 x %= 11 if x == 0: print(ans) elif x <= 6: print(ans+1) else: print(ans+2)
986,705
7ebf5d15286448aea510a211130b613eed32d89a
import json import os import time import requests google_maps_api_base_url = 'https://maps.googleapis.com/maps/api' def get_google_data(address_lines): api_key = os.environ['GOOGLE_MAPS_API_KEY'] query = '' for i in range(1, 5): if address_lines['line'+ str(i)] is not None: query = q...
986,706
184d1762bbd254046eee0043ede6e3bfef008286
import cs50 input = cs50.get_string("Text:") words = 1 sentences = 0 letters = 0 for i in input: if i =='?' or i =='.' or i == '!': sentences+=1 elif i == ' ': words+=1 elif i not in ["'","’",",",";","?",'.','!',' ','-']: letters+=1 print(letters,words,sentences) if words < 100: ...
986,707
0608e3ca9d8a4fd7fe9b7a0c8ccf1a44b6d3e896
import os import numpy as np from PIL import Image from util import root_path, resolution MAX_TOTAL_BITS_LENGTH = 512 * 512 * 3 META_BITS_LENGTH = len(bin(MAX_TOTAL_BITS_LENGTH)[2:]) def run(): file_path_encoded = os.path.join(root_path, "samples", f"biggan-{resolution}-samples-onnx-{0}-encoded.png") enco...
986,708
70216486abbe09afd48eef64f5819f1d88d55585
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.shortcuts import render from django.views.generic import TemplateView from django.http import HttpResponse from django.views import View import json, traceback, sys from about.models import About as AboutModel class About(View): ...
986,709
60eb0aafecf3c36c33501a3e59b177d147041d59
""" Create a recursive function that inserts a value into the correct node of a tree. This should be very similar to the _contains function found in the Software Example, but when an empty node is found where the number should go you should add the number to the tree. """ class SearchTree: class Node: ...
986,710
de31a9e57ee4f2e91c5c67cb25e4aeb5fb111d10
def f(x): return (x - 1) def main(): return ((10 * 11) + f((1 + 2))) #Boilerplate if __name__ == "__main__": import sys ret=main() sys.exit(ret)
986,711
8d723599f9293054b470c0036a14670484986b06
import cv2 import sys GST_STR_L = 'nvarguscamerasrc sensor-id=0 \ ! video/x-raw(memory:NVMM), width=3280, height=2464, format=(string)NV12, framerate=(fraction)20/1 \ ! nvvidconv ! video/x-raw, width=(int)3280, height=(int)2464, format=(string)BGRx \ ! videoconvert \ ! appsink' GST_STR...
986,712
40e6df92598cee28d104efe97b91d63dd60519a9
# Даны два действительных числа. Найти среднее арифметическое и среднее геометрическое этих чисел. a, b = float(input('Введите a: ')), float(input('Введите b: ')) print('Среднее арифметическое a и b: ', ((a + b) / 2)) print('Среднее геометрическое a и b; ', ((a * b) ** 0.5))
986,713
f91114ebc15ddad18d35615248e622d509f169e1
# -*- coding: utf-8 -*- """Module containing models for Gaussian processes.""" import numpy as np import theano.tensor as T from theano.sandbox.linalg.ops import MatrixInverse, Det, psd, Cholesky minv = MatrixInverse() det = Det() cholesky = Cholesky() from ..util import lookup, get_named_variables from ..componen...
986,714
f84ca606ae08147176f44a6660ea5b98d7b70ade
def incomodam(n): if n <= 0 or type(n) != int: return '' elif n == 1: return 'incomodam ' else: return 'incomodam ' + incomodam(n - 1) def elefantes(n, primeiro = True): if n < 1: return '' if n == 1: return 'Um elefante incomoda muita gente\n' if primei...
986,715
87c003e6125f68efb6dd47b4bf19d632151a7230
name = input("Ingrese su nombre: ") num = int(input("Ingrese un número: ")) for i in range(0,num): print(name)
986,716
eff77736445cc5bc16cfe0dc48619509c48cdf7c
def ConvertByteToMapSize(byte): if (byte == "$"): return "Small" elif (byte == "H"): return "Meduim" elif (byte == "l"): return "Large" else: return "XL"
986,717
3d83ff593d280eb99fa843680a1f783eb7920b0e
from ControleFinito import * from Fita import * class Maquina: def __init__(self, cadeia): self.__fita = Fita(cadeia) self.__controle = ControleFinito() self.__controle.setPosicao(len(cadeia) + 2) def Lu(self): # Maquina que encontra o primeiro espaço em branco e para. Indo par...
986,718
49725821266c5e940324aa5ae2af564273a46c19
import collections a = {'a': 'A', 'c': 'C'} b = {'b': 'B', 'c': 'D'} c = {'c': 'E'} m1 = collections.ChainMap(a, b) m2 = m1.new_child(c) print('m1["c"] = {}'.format(m1['c'])) print('m2["c"] = {}'.format(m2['c']))
986,719
06c83f767070e23cec13084aa3ea988030dd6473
__author__ = 'Justin' import pandas as pd import numpy as np from sklearn.feature_selection import SelectKBest, f_classif from sklearn.ensemble import RandomForestClassifier from sklearn import cross_validation from matplotlib import pyplot as plt def bSelect(titanic): predictors = ["Pclass","Sex","Age","SibSp","...
986,720
de499e0a02c6b4f9586798d81e71693a8d96be25
import asyncio # https://realpython.com/async-io-python/ # Asyncio Version async def count(): print("One") await asyncio.sleep(1) print("Two") # the benefit of awaiting something, including asyncio.sleep(), # is that the surrounding function can temporarily cede control # to another function that’s more...
986,721
f875bfb36a4b44348c13fff1877d9d22489ddfe9
from bson import ObjectId from pymongo import ReturnDocument from tournament.connection_pool import ConnectionPool from tournament.models import Services class DataStore: DB_NAME = 'game' def __init__(self, collection): self.conn = self.__get_connection() self.collection = collection ...
986,722
ddc3781f05a032ec83bab88294b3950f8990ec91
# -*- coding: utf-8 -*- """ Created on Thu Jan 18 21:20:35 2018 @author: ldz """ # ============================================================================= '''testDatingClassifier''' # ============================================================================= from kNN import file2matrix,autoNorm,class...
986,723
afb15bffac641f75cd7d8613e2bfc961787a718b
from urllib2 import urlopen import base64 bank_statement_url = "url" file_object = urlopen(bank_statement_url) base64_file = base64.b64encode(file_object.read()) f= open("fileencoded.txt","w+") f.write(base64_file) f.close() f = open("fileencodedd.txt", "r") print(f.read())
986,724
f72e2a80f1a9a87d2fe48b3d45036b0aaa04a406
def make_bricks(small, big, goal): small_size = 1 big_size = 5 formula = (small_size * small) + (big_size * big) adjustment_value = formula - goal if not formula % goal or not goal % formula: return True else if formula > goal: if big_size % adjustment_value == 0 or small_size % adjustment_value == 0: ...
986,725
7bb17ae26902ff00027d4a8c7d3d959475dfdfa5
# Copyright 2014 Facebook, Inc. # You are hereby granted a non-exclusive, worldwide, royalty-free license to # use, copy, modify, and distribute this software in source code or binary # form for use in connection with the web services and APIs provided by # Facebook. # As with any software that integrates with the Fa...
986,726
1dac0b1db83adeac01aee47dd64d21b375460b38
# Define here the models for your scraped items # # See documentation in: # http://doc.scrapy.org/en/latest/topics/items.html from scrapy.item import Item, Field from scrapy.contrib.loader.processor import MapCompose, Join, TakeFirst, Compose from scrapy.utils.markup import remove_entities from scrapy.contrib.loader.p...
986,727
2ba791261582c4fcb95f3b115ed7997bc65f8111
import re import functools from datetime import datetime from utils.decorators import challenge # Challenges @challenge(name="It's a Sign", level="Hard", desc=""" Given the four words that were supposed to be contained in each box, determine if at least one of them is of ...
986,728
7a0e9d5f54e16ceafcc0c10438236db618d55909
#! /usr/bin/python #per renderlo esguibile # -*- coding: utf-8 -*- #per poter usare caratteri speciali come _ import math #importa la libreria matematica import string #importa la libreria stringhe import os #importa libreria per eseguire comandi bash #script per eseguire lo...
986,729
2c2123f3743f1f7d69b129a01a95528aed28f0d9
from django.db import models # Create your models here. class City(models.Model): name = models.CharField(max_length = 25) cityid = models.IntegerField(blank = True, null = True) description = models.CharField(max_length = 250,blank = True, null = True ) ftemp = models.FloatField(blank = True, null = True) ctemp ...
986,730
1bd874ce062ad70b387c13c80315a4eaba2f2d58
import pytest import factory from django.test import Client from django.shortcuts import reverse from http.client import responses from django.contrib.auth import authenticate from app.views import StudentModelViewSet, ResultView from app.models import Grade, Student from app.factories import GradeFactory, StudentFact...
986,731
fb04ce58f555d375ba41dbac8241a375c8057967
from django.shortcuts import render, redirect from django.contrib.auth.models import User from django.template.context_processors import csrf from django.contrib.sessions.models import Session from django.views import View from Member.models import rounds,table from django.contrib.auth.decorators import login_required ...
986,732
ea151fd1c2560fcb575625b29f6d8ccfc9da47aa
# 将一个正整数分解质因数。例如:输入90,打印出90=2*3*3*5。 def reduceNum(n): print(n, end='') if not isinstance(n, int) or n <= 0: print("请输入一个正确的数字") elif n in [1]: print(n) while n not in [1]: # 因为 python3 中取消了 range 函数,而把 xrange 函数重命名为 range,所以现在直接用 range 函数即可。 for index in range(2...
986,733
87d3c9e12048a8edd50636be9a266f1d610082fc
import unittest from number_of_islands_ii import Solution, Point class TestSolution(unittest.TestCase): def test_Calculate_Solution(self): solution = Solution() self.assertEqual( [1, 1, 2, 2], solution.numIslands2(4, 5, [Point(1, 1), Point(0, 1), Point(3, 3), Point(3, 4)]) ...
986,734
369b00847752efc6ee575df666bf60bf85529661
import logging import logging.handlers DEBUG = True LOG_LEVEL = logging.DEBUG USE_SYSLOG = False LOGGING_CONFIG='tophat.conf.logconfig.initialize_logging' LOGGING = { 'loggers': { 'agent': {}, }, 'syslog_facility': logging.handlers.SysLogHandler.LOG_LOCAL0, 'syslog_tag': "agent", 'log_leve...
986,735
ab50cd0868e05cd14d521f6b32aad38973bec4aa
import time import torch import torch.nn as nn import torchvision.models._utils as _utils import torchvision.models as models import torch.nn.functional as F from torch.autograd import Variable def conv_bn(inp, oup, stride = 1, leaky = 0): return nn.Sequential( nn.Conv2d(inp, oup, 3, stride, 1, bias=False)...
986,736
b703c85a1afed0f0288bbed29cbb84790280271f
# Generated by Django 2.1.7 on 2019-05-13 17:11 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('users', '0004_auto_20190425_1524'), ] operations = [ migrations.AlterField( model_name='user', name='netid', ...
986,737
831172ace842dbc507e2036e88ac66a9f39e8fe9
import uuid from django.db.models import UUIDField from django.contrib.auth.models import AbstractUser class User(AbstractUser): """Extended user model, replacing 'id' with a uuid field which is going to be used in cassandra. """ id = UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
986,738
2d63221b7ff267f284ae050b70ab3d586f32d7e6
from FirstCharacter import * class Startingworld: location = "Starting World" # Data type:Sring #init all the variables def __init__(self,player): self.playerinworld = player self.FirstCharacter = FirstCharacter(self.playerinworld) #retuns the name of the location def loction(sel...
986,739
bb994e5fc4f13d9facf087e48b9762b9efc9844d
from typing import Dict, List def foo(param: Dict[str, List]) -> str: return 'Hello, world!' x: Dict[str, str] = dict(foo='bar', baz='qux') print(foo(x))
986,740
42aa2de1ed96d9eb01c607807ae4acfab7a9c294
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Mar 25 13:15:45 2017 @author: sinlight """ #import pandas as pd def prepro(dfrom) : #传入原始数据框 "对数据框进行预处理对数据框内容进行预处理,去掉多余的空格,方便以后匹配" for i in range(0,len(dfrom.index)): for j in range(0,len(dfrom.columns)): if isinstance(dfrom...
986,741
6ad98dfa4c4e49b5b1897a7b3c703a70f46d810e
# Generated by Django 3.2 on 2021-05-11 13:42 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('videos', '0013_auto_20210511_1126'), ] operations = [ migrations.RemoveField( model_name='playlist', name='titile', ...
986,742
a6ad2ed4c355d0a920c14e72cbd96570c30344a5
import os import unittest import finite.pflow from finite.storage.factom import Storage class OctoeTestCase(unittest.TestCase): def setUp(self): finite.pflow.set_provider(Storage) self.xmlfile = os.path.dirname(os.path.abspath(__file__) ) + "/../examples/oct...
986,743
dcffa2c04b70390b02feca682bce27431f1478c0
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django import template from django_hosts.reverse import reverse_full from v3d_libs.utils.http import encode_link register = template.Library() class ELinkNode(template.Node): def __init__(self, parser, token): bits = token.split_cont...
986,744
4216c303860020d95756a5e7b450cdc0e085a901
# **************************************************************************** # # LE - / # # / # # display.py .:: .:/ . .:: ...
986,745
9d077cc8f1d509f7985aa8e672ac8db83e642b9e
# Program to run Newton Interpolation to specified polynomial degree import numpy as np import matplotlib.pyplot as plt import json import pandas as pd # Create the Newton Interpolation 'fdd' Method def newtInt(x,y): fdd = np.zeros((len(x),len(x))) print('the fdd array is: \n',fdd) for i in range(len...
986,746
0a3347deda8779e4c840ab740b47df6fdc215978
import sys import os import copy from itertools import groupby from operator import mul import marshal # Score multipliers BOARD_SZ = 15 (NORM, DL, TL, DW, TW) = (1, 2, 3, 4, 5) POINT_VALS = {'a' : 1, 'b' : 4, 'c' : 4, 'd' : 2, 'e' : 1, 'f' : 4, 'g' : 3, 'h' : 3, 'i' : 1, \ 'j' : 10, 'k' : 5, 'l' : 2, 'm...
986,747
bdb3498493e36e6899bda030b98f0190d86cfdd1
from django.apps import AppConfig class PostServiceAppConfig(AppConfig): default_auto_field = 'django.db.models.BigAutoField' name = 'PostServiceApp'
986,748
b34d9c24f4b119d16aafaba905ef414dd071ccc2
#! pyton 3 # regex_strip.py """ This program takes a string and does what strip() does. We use the first argument as the string to be passed and the second argument as the characters to be removed. If the second argument is left empty, whitespace characters are removed from the beginning and end of the string. """ i...
986,749
fbad53bb96670630384900d412c4e27b4ef4ca87
from threading import * from xmllib import XMLParser from ExpatXMLParser import ExpatXMLParser, DOMNode from os import path import gtk from gtk import * from gtk.glade import * import string from cue import Cue from omniORB import CORBA import CosNaming from idl import LB, LB__POA crossfader_open_menu=None def acti...
986,750
2b1c7e1e22956f1980c7571321eb78ceda7fe7cc
#!/usr/bin/env python # -*- coding: utf-8 -*- # musorg # author: rshen # date: 2009-03-19 import sys import os from PyQt4.QtGui import QApplication from PyQt4.QtCore import QFile from musorg.ui import MusorgMainWindow from musorg.config import Configuration app = QApplication(sys.argv) # Load the configuration file...
986,751
1dd44b60897dd0bf78dc976b1f1fecf5b31616d9
import json import time data=json.loads('{"lon": 79.589, "alertmsg": "Pet moves out", "time": 125885555, "lat": 83.045, "petname": "abc", "id": 1001}') isdatasend=True isdata2send=True time.sleep(0.5) mainalert={} mainalert["alert"]=[] if(isdatasend): mainalert["alert"].append(data) if(isdatasend & isdata2sen...
986,752
7101456c4cc4500b11e7a259e7b38b54fda36cc2
import tensorflow as tf from yolov3.yolov3 import Create_Yolov3 from yolov3.utils import load_yolo_weights, detect_realtime from yolov3.configs import * input_size = YOLO_INPUT_SIZE yolo = Create_Yolov3(input_size=input_size, CLASSES=TRAIN_CLASSES) yolo.load_weights("./checkpoints/yolov3_face_Tiny.h5") out_path = '....
986,753
b82754e3b4016df056e5387c582a1b6e9568be61
from server.app import socketio, app if __name__ == "__main__": socketio.run(app, debug=True, use_reloader=False)
986,754
d918249a2d29d58c8ff6cd795ae8b3d60c6523db
# from requests import Session # from zeep import Client # from zeep.transports import Transport # session = Session() # session.cert = 'C:\\Users\\rajeshvs\\Desktop\\RootChain_SHA2' # transport = Transport(session=session) # client = Client( # 'http://my.own.sslhost.local/service?WSDL', # transport=transport) # # fro...
986,755
bd038824d54c111d9a23dbefb1bb245e64a97e40
import os import re import threading import urllib.error as err import urllib.request as req from tkinter import messagebox import requests from bs4 import BeautifulSoup def show_error(source_url, dest_folder): if source_url == "" and dest_folder == "": error_type = "both url and save folder are missing"...
986,756
8c87b443fc3c206b2da08433ba2b4e2662ab3cf3
import numpy as np import pandas as pd import os print(os.listdir("../input")) import time import random import pandas as pd import numpy as np import gc import re import string import os from keras.preprocessing.text import Tokenizer from keras.preprocessing.sequence import pad_sequences # pytorch imports import...
986,757
39735dfee33b83eb0a6f1b984b4ad0f811fe0969
def fn(a,*args,d): print(args) print(d) fn(5, 1, d = 100)
986,758
b79dd1179f82f9329803c5c7e0dd88816dc2cb12
import json, os from src.paths import SRC_DIR config_path = os.path.join(SRC_DIR, '..', 'config.json') with open(config_path, 'rb') as config_file: config = json.load(config_file) if __name__ == '__main__': print(config)
986,759
3a987b9f3b0f704077205f5090a63abfb5d01801
# Generated by Django 3.1.3 on 2020-11-12 14:44 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('listings', '0003_auto_20201112_1400'), ] operations = [ migrations.AlterModelOptions( name='category', options={'ver...
986,760
3ac1764731684d74e4c35e5ba742492c3d7b8370
# # Copyright (c) 2017 Idiap Research Institute, http://www.idiap.ch/ # Written by Angelos Katharopoulos <angelos.katharopoulos@idiap.ch> # import unittest import numpy as np from importance_sampling.datasets import InMemoryDataset from importance_sampling.reweighting import UNWEIGHTED, UNBIASED from importance_samp...
986,761
02b187c3df45aebc7200ad7de0c6e594049571aa
#!/usr/bin/env python import os import sys import webnsock import web from subprocess import check_output, Popen, PIPE from signal import signal, SIGINT from logging import error, warn, info, debug, basicConfig, INFO from pprint import pformat, pprint import qi from os import path import argparse from time import sle...
986,762
9b0bec4d118e46aff3a248ba0d688880ac2022ad
"""Fazer uma sequencia de impressão onde sejam mostras as representações decimal, octal, hexadecimal dos valores inteiros de 0 a 225 (que são os valores que um byte pode representar). Verificar o contéudo dos especificadores de representação no contexto do comando print. Cria para cada representação uma função especif...
986,763
d1fac521adbc3bb65ac8be5d8db606a4fa4f99c6
x = [1,2,3,4,5] tmp = 0 k = 2 # k = rotation value for i in range(k): x.append(x[0]) del x[0] print(x)
986,764
f0488c5c474b9143bc799568912c61a55a5259f3
import os from fabric.api import abort from fabric.api import local from fabric.api import puts from fabric.api import settings from fabric.colors import red from fabric.context_managers import lcd def to_file(r, logfile): """Writes Fabric capture result to the given file.""" def _write(fname, msg): ...
986,765
3a9d531264e2edb440a3eeeb1bb83cb911f1de62
import cv2 import numpy as np import pickle import os, math from Gaussian import simple_gaussian, evaluate from skimage.measure import label, regionprops import matplotlib.pyplot as plt def display(img): cv2.imshow('image',img) cv2.waitKey(0) cv2.destroyAllWindows image_path = os.listdir('C:/Users/TonyY/A...
986,766
953841af3581e59b91301f6c77c706424d9a8259
import pandas as pd from sklearn.ensemble import RandomForestRegressor from sklearn.model_selection import KFold from sklearn.model_selection import cross_val_score from sklearn.metrics import r2_score data = pd.read_csv('abalone.csv') target = data['Rings'] feature = data.drop('Rings', axis=1) feature['Sex...
986,767
9ad903612678cfc332871f13fb5fdef961403994
import bubblesort import insertionsort import mergesort import quicksort import selectionsort from utils import test if __name__ == "__main__": testfuncs = [ bubblesort.bubblesort, insertionsort.insertionsort, mergesort.mergesort, quicksort.quicksort, selectionsort.selecti...
986,768
6afa3413fa3f8100c90c4ca5bf836a3a3e384780
# Importing the Kratos Library import KratosMultiphysics as KM import KratosMultiphysics.CoSimulationApplication as KratosCoSim # Importing the base class from KratosMultiphysics.CoSimulationApplication.base_classes.co_simulation_coupled_solver import CoSimulationCoupledSolver # CoSimulation imports import KratosMult...
986,769
452edc0332c51badc58c8ba351b537b2722135da
from Player import * import random import copy WAN = "🀇🀈🀉🀊🀋🀌🀍🀎🀏" # 0-8 TIAO = "🀐🀑🀒🀓🀔🀕🀖🀗🀘" # 9-17 TONG = "🀙🀚🀛🀜🀝🀞🀟🀠🀡" # 18-26 ELSE = "🀀🀁🀂🀃🀄🀅🀆" # 27-33 DICT = dict(zip(WAN + TIAO + TONG + ELSE, range(34))) HILL = list(WAN * 4 + TIAO * 4 + TONG * 4 + ELSE * 4) class AI(Bot): def...
986,770
afdb745831c4cb78a59cb405f83b13c8e5361e45
import math, gs ''' define a series of functions of general applicability to processing yapseq data: ''' aa_charged_positive = ['R','H','K'] aa_charged_negative = ['D','E'] aa_polar_uncharged = ['S','T','N','Q'] aa_hydrophobic = ['A','I','L','M','F','W','Y','V'] aa_special = ['C','G','P'] aas = aa_charged_positive ...
986,771
562c4640f14f35a2562d9193fe5f1e964b252e95
__author__ = 'Amy Shi, Amber Lee, Fred Ayi-Quaye' from tkinter import * root = Tk() root.title("Voronoi Painting") root.geometry("500x500") root.mainloop()
986,772
fd8a234bf2de10a09c8546ec2c55d1e9a73609e8
import django_tables2 as tables from django.contrib.auth import get_user_model from django.utils.html import format_html, format_html_join from django.utils.safestring import mark_safe from django.utils.translation import gettext as _ from django_hosts.resolvers import reverse import config.hosts from transit_odp.comm...
986,773
f54a02a48f6a521e7d8b9a44d84baf1cddb90df2
import random def left(): l = ["You went to the river...Do you want to go across it or walk along the banks of the river (across/walk) ?", "You saw a butterfly...follow it or leave it (follow/leave) ?", "You saw your friend trapped Help him/her or leave it (help/leave) ?", ] return random.choice(l) def right()...
986,774
f32fb8f9980e8e08471f2fe997a38a5022ae2c0e
# Minhas variáveis salario = 3450.45 despesas = 2456.2 """ A ideia é calcular o quanto vai sobrar no final do mês! """ # Linha 1 # Linha 2 # Linha 3 print('Fim')
986,775
89144fba427cfe0da982325be3d1592f07e4a018
from django.shortcuts import render from django.http import HttpResponse from shop.models import product def index(request): products=product.objects.all() n=len(products) nslides=n//4+ceil(n/4-n//4) params={'products':products, 'no_of_slides':nslides , 'range':range(1,nslides)} return render(requ...
986,776
b9b2adc9bb3831f5d0216101d6afbab4b4724873
from .Mainloop import Mainloop class State(): def __init__(self, name, period, onStartFunc, onLoopFunc, onEndFunc, onEvents, after, cancel): self.name = name self.mainloop = Mainloop(period, onStartFunc, onLoopFunc, onEndFunc, after, cancel) self.onEvents = onEvents def start(self): ...
986,777
862bf1e59090f22ae0c01741a838fde91527210a
# -*- coding:utf-8 -*- """ Python 3.7 Author:Spring Time: 2022/3/29 6:50 PM """ import shutil import zipfile import os import datetime from config import settings # shutil.make_archive('/Volumes/HDD/Code/Python/FridayDemo/Friday/App/ApiAuto/Debug/', "zip", root_dir='/Users/mac-mini/Desktop/约面0330') zip_dir = '/Volu...
986,778
1f05c963b629424819699087d4c7614791c6b93b
a = 0 with open('azs.txt', "r+") as azs_file: for line in azs_file.readlines(): a += 1 print(a)
986,779
90d855f034794e794df4b10c00735926c65c7e0d
# ========================================================================= # # One Layer Nerual Network to make # The 4 flower attributes are # 1 sepal length # 2.sepal width # 3.pedal length # 4.pedal width # Goal: Pred...
986,780
392ec887eee6c0d0b2b0639cb58b76d9290fe658
from django.contrib import admin from .models import Customer,Order class CustomerAdmin(admin.ModelAdmin): list_display = ("Customer_Id","FirstName","LastName","Email","Phone","City","PinCode") empty_value_display = "NULL" class OrderAdmin(admin.ModelAdmin): list_display = ("Order_Id","FK_Customer__Id", "...
986,781
beb199180a675ae6accf93be7418e760e33164b7
#!/usr/bin/env python3 # -*- coding: utf-8 -*- def my_pgcd(a, b) : if(a%b==0) : return b else : return my_pgcd(b, a%b) def my_inverse(a, N): r0, r1 = a, N u0, u1 = 1, 0 #u0=b v0, v1 = 0, 1 while(not(r1==0)): q = int(r0/r1) r, u, v = r1, u1, v1 r1 = r0 - q * r1 ...
986,782
dd9825ab676b672b9226a9ee7986a74a1b2e47c0
#! /usr/bin/env python3 # this script returns the fibonacci number at a specified position in the fibonacci sequence import argparse def get_args(): #create an argument parser object parser = argparse.ArgumentParser(description = 'this script returns the fibonacci number at a specified position') # a...
986,783
80be7095f6d13fd93f501cd326e7ccceeb1262f3
# -*- coding: utf-8 -*- # # inspired from: # https://kitware.github.io/vtk-examples/site/Python/PolyData/ExtractSelection/ # https://vtk.org/Wiki/VTK/Examples/Cxx/Picking/CellPicking import vtk colors = vtk.vtkNamedColors() # print(colors.GetColorNames()) # see also https://vtk.org/Wiki/VTK/Examples/Python/Visual...
986,784
415e6973abb9c2ccc658ba6d88b76a874ee19586
from django.contrib.auth.models import User from django.test import TestCase from dfirtrack_main.models import Os, Osimportname import urllib.parse class OsimportnameViewTestCase(TestCase): """ osimportname view tests """ @classmethod def setUpTestData(cls): # create object os_1 = Os.obje...
986,785
6d33c8f26157ab630b38f7bcbf31ec7bcb1a86ca
from common.enum import Enum _oper_types = ['start', 'stop', 'reload'] OperType = Enum(_oper_types)
986,786
080a1a13d3ca10813655b7d83e2e243cecfadc42
class Stack(): def __init__(self): self.stack = [] def pushCharacter(self, val): self.stack.append(val) def popCharacter(self): return self.stack.pop() def notEmpty(self): return len(self.stack) != 0 class Queue(): def __init__(self): self.queue = [] def enqueueCharacter(self, va...
986,787
c65ac3390d57625c668ca31e49ea2ec5fb97555c
from typing import Any, Dict, List, Optional from pystac.utils import StringEnum class ProviderRole(StringEnum): """Enumerates the allows values of the Provider "role" field.""" LICENSOR = "licensor" PRODUCER = "producer" PROCESSOR = "processor" HOST = "host" class Provider: """Provides in...
986,788
595b0cbbf7704b0b029e1409e5956e7f863c48e0
# -*- coding: utf-8 -*- # VIEWS DA API - UNB ALERTA - REST FRAMEWORK # Importando generics da rest framework para a criação da APIView from rest_framework.generics import ( CreateAPIView, DestroyAPIView, ListAPIView, RetrieveAPIView, RetrieveUpdateAPIView ) from rest_framework.views ...
986,789
0463210c39960698e70ca0b240a0cb6f6dda78c6
from urllib.request import Request, urlopen from urllib.error import HTTPError import logging import json import time class Database: PAGE_SIZE = 100 def __init__(self): self.logger = logging.getLogger('logger') self.database_url = 'http://localhost:5984' self.requests_table = self.da...
986,790
d3229b641e925640d1edb09454e08ed29a0b18eb
#import curses_thing #import page_getter #import subprocess #handle two threads: curses thread and page getter thread
986,791
4eaac70be7cec89979e50b099e0bcb9edb849b6c
from crispy_forms.helper import FormHelper from django.db.models.base import Model from django.forms import ModelForm from django import forms from .models import(Register_users) class Register_userForm(forms.ModelForm): class Meta: model = Register_users fields = '__all__' def __init__(sel...
986,792
8671ea98eaebf2fac04359c802435f662b1afafb
from django.shortcuts import render # Create your views here. from django.views.generic import TemplateView, DetailView from .models import * class HomeTemplateView(TemplateView): template_name = 'home.html' def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) ...
986,793
55a684b38873ca80e4fce448adb8d08e4b5d8f4b
import requests import logging import schedule import time from configparser import ConfigParser logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s') def run(user,pwd, keep_type, ids): logging.info("work type: {}".format(keep_type)) session = requests.Session...
986,794
d3b12ffbaec31bcf651babdeafbf8585a4068835
# Given an array of non-negative integers, you are initially positioned at the first index of the array. # Each element in the array represents your maximum jump length at that position. # Your goal is to reach the last index in the minimum number of jumps. # For example: # Given array A = [2,3,1,1,4] # The minimum...
986,795
0956f78952db5566cd217d67c7d0ff2aa5c619ab
Find X and Y intercepts of a line passing through the given points Given two points on a 2D plane, the task is to find the **x – intercept** and the **y – intercept** of a line passing through the given points. **Examples:** > **Input:** points[][] = {{5, 2}, {2, 7}} > **Output:** > 6.2 > 10....
986,796
ab60d40b1708b4644a32ba5056db6ef4feb2da23
# Generated by Django 3.1.1 on 2020-09-29 11:01 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('home', '0016_auto_20200929_0932'), ] operations = [ migrations.RenameField( model_name='artwork', old_name='artwork_...
986,797
5a3cfd2829e35eac20ed4329808d1bb0f0cd0011
# Example of a HEAD request import requests resp = requests.head('http://www.python.org/index.html') status = resp.status_code last_modified = resp.headers['last-modified'] content_type = resp.headers['content-type'] content_length = resp.headers['content-length'] print(status) print(last_modified) print(content_ty...
986,798
3f1dd5bb591f7b1d30011ef6b5917168d1d44bef
from odoo import api, fields, models class TrainingLesson(models.Model): _name = 'lu.lesson' _description = "课程信息哦" name = fields.Char(string='课程名称') teacher_id = fields.Many2one('res.partner', string='老师', domain=[('is_teacher', '=', True)]) student_ids = fields.Many2many('res.partner', strin...
986,799
dd5ffe40b5bd66011f2f4957ec58e66942a25dfd
def main(): first, last = input("Enter name: ").lower().split() common_letter_list = get_common_list(first, last) print(sorted(common_letter_list)) print(sorted(get_common_set(first, last))) def get_common_set(first, last): return set(first).intersection(set(last)) def get_common_list(first, las...