index
int64
0
1,000k
blob_id
stringlengths
40
40
code
stringlengths
7
10.4M
987,700
cde3014c218bbe4793fdaea163eaae55fc61bf63
# ------------------------------------------------------------- # # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you unde...
987,701
3283f68099fef800f3d625bf014d52e23eb742b9
import os from django.shortcuts import render, redirect from django.views.generic import ListView, DetailView, View from django.contrib.auth.models import User, auth from .models import UserProfile, UnusedPins, UsedPins, BulkStudent, AttendClass from django.contrib.auth.decorators import login_required import random im...
987,702
52af129d7375a9717d88e2253515dc1dbefe498d
import json class Pago(): def __init__(self): self.nombre=None self.apellido=None self.monto=None self.descripcion=None self.metodo=None def set_value(self, info): if info == "stop": return False elif not self.nombre: self.no...
987,703
03ff2855d4740c76f07ce2c99a1cc46253ca776e
def merge(A,m, B, n): last=m+n-1 i=m-1 j=n-1 while i>=0 and j>=0: if A[i]>B[j]: A[last]=A[i] last=last-1 i=i-1 else: A[last]=B[j] last=last-1 j-=1 while j>=0: A[last]=B[j] last=last-1 j=j...
987,704
afd066c93c5c756f9214d6aebe6b71665f2a73ed
from django.shortcuts import render from rest_framework.views import APIView from django.http import HttpResponseRedirect from django.http import JsonResponse from collections import defaultdict from backend.notification import * class Serializers(object): @staticmethod def notifications_aggregator(notifications):...
987,705
77bef87cd8f738bcdd7f2eccd3c7df1fe72b6ff5
# coding=utf-8 # # # !/data1/Python2.7/bin/python27 # # 全局变量在多进程里面是不能够共享的,进程是拥有自己的数据,代码段的 # ; # import os from multiprocessing import Process num = 100 def run(): print 'slave: {} start'.format(os.getpid()) # 在子进程中修改全局变量,对于父进程中的全局变量是没有影响的; # 在子进程中使用全局变量时,子进程使用了完全不一样的另一份拷贝,父进程和子进程是完全不同的两个变量; globa...
987,706
14f7a908e38a36a7504fa5fe7f274323921ae1a4
#Creaate a program that generates a password of 6 random alphanumeric characters in the range abcdefghijklmnopqrstuvwxyz01234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*()? import random password_range = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','0','1','2','...
987,707
eb16436d9f9079eab2bea77e8c7502ebdeb8e7c8
from math import ceil from collections import defaultdict d1 = defaultdict(int) d2 = defaultdict(int) n, m = map(int, input().split()) s = input() t = input() for i in range(n): d1[ord(s[i]) - 65] += 1 for i in range(m): d2[ord(t[i]) - 65] += 1 ans = 0 for i in range(26): if d1[i] == 0: continue ...
987,708
3b401d15487a4ad1b150e0aeab3aa0d13b8c62c2
# -*- coding: UTF-8 -*- from __future__ import division import sys import xlsxwriter import re tashkeel_patt = ur"[\u0617-\u061A\u064B-\u0652]+" workbook = xlsxwriter.Workbook((sys.argv[4])+'_shell_output/'+(sys.argv[4])+'avgWordL.xlsx') worksheet = workbook.add_worksheet() workbook2 = xlsxwriter.Workbook((sys.argv[4]...
987,709
1a23b9efe3d65338d26295467cd957782fc461ba
#!/usr/bin/env python # coding: utf-8 """ Este programa conta as ocorrências das letras de A a Z em um arquivo texto em formato UTF-8, e exibe uma lista com as letras em ordem decrescente de quantidade. As letras acentuadas e letras minúsculas são convertidas para seus equivalentes maiúsculos e sem acentos. O cedil...
987,710
0842d219612fd8b7e70fb08b1c0208fcdc0b9c60
import re import os #text = ('dare.txt') #found = re.findall ('html', text) #text.split('html') # print (text) with open("dare.txt", "r") as f: for l in f: found = re.findall("(.*)(\.html)") print(found)
987,711
150a4819bf8511457821f4f43e7a8bfe245dd689
from typing import List, Any from fastapi import APIRouter, HTTPException from api.api_v1.endpoints.util import get_nodes_and_relationships from models.intermediary import INTERMEDIARY from schema.intermediary import IntermediaryOut, IntermediaryIn, Intermediary from schema.react_force_graph import ReactForceGraphInp...
987,712
a9da5e72c839d70a6d1dd187f5b46ce9f7917035
# created by jenny trac # created on Nov 23 2017 # program lets user choose how many rows and columns # program shows all the numbers and calculates the average import ui from numpy import random minimum = 1 maximum = 50 def make_the_array(rows, columns): # created the array with random numbers global m...
987,713
3bba041842775bea461c49a4ea6a950d9192aa9a
def nested_sum(t): total = 0 for x in t: if isinstance(x, list): total = nested_sum(x) + total else: total += x return total mylist = [1,2,3,[4,5],[6,7,8]] print(nested_sum(mylist))
987,714
08126c38341f0da1dff305cdce9e15711059fe6d
import numpy as np import matplotlib.pyplot as plt import random phi = np.array(['0.44', '0.38', '0.16', '0.05', '0.58', '0.85', '0.20', '-0.37', '0.46', '0.59', '1.25', '-0.34', '1.12', '-1.07', '-0.84', '-0.32', '0.65', '-0.38', '0.79', '1.01', '0.42', '0.45', '-0.10', '-0.26', '0.29', '0.93', '1.15', '-1.00', '0....
987,715
e7cc28ab43f77bf744564ce2eacc4b476f1cab48
import sqlite3 DB_PATH = "../../db/users.db" def create_table(conn): conn.cursor().execute('''CREATE TABLE IF NOT EXISTS users (id UNIQUE, username text, firstname text , lastname text)''') def insert_id(info): # conn = set_connection() with set_connection() as conn: ...
987,716
ce2ca5dfee78cbac866f839b279cdb19828404d5
from fractions import gcd from itertools import accumulate N = int(input()) A = tuple(map(int, input().split())) to_right = [0] + list(accumulate(A, gcd))[:-1] to_left = list(reversed(list(accumulate(reversed(A), gcd))))[1:] + [0] print(max(gcd(r, l) for r, l in zip(to_right, to_left)))
987,717
9c42e6ec860d97fa1b4ddf129d130d5f762bd660
import sqlite3 from django.shortcuts import render, redirect, reverse from libraryapptwo.models import Library, model_factory, Book from django.contrib.auth.decorators import login_required from ..connection import Connection def create_library(cursor, row): _row = sqlite3.Row(cursor, row) library = Library()...
987,718
3720bb867c5828082ef281807cf2fd082e3573b9
class Node: def __init__(self, value): self.left = None self.value = value self.right = None class BST: def __init__(self): self.root = None # insertion in binary search tree def insert(self, value): if self.root is None: self.root = Node(value) ...
987,719
f318b0a51e029cd4df1dc70171ccfc0b5798206d
name = "sahil" tuples = ("sa", "ra") lists = ["s", "a", "h", "i", "l"] dictionary = {"sahil": "raza"} print(f'name = "{name}"', f"tuples = {tuples}", f"lists = {lists}", f"dictionary = {dictionary}", " " , sep = "\n")
987,720
d39b8d5b5cccdd6b84b58ce4a08e1050f2aff4a6
import argparse class Options: def __init__(self): self.parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter) self.parser.add_argument("--video_file", type=str, default="", help="filename of video file") self.parser.add_argument("--positive_folder", type...
987,721
bfa0406251e5deecec65e6a5555cf3aed613c92c
from weixin.contact.token import Weixin import requests import logging import json import pytest class TestDepartment: @classmethod def setup_class(cls): print('\nsetup_class') Weixin.get_token() print(Weixin._token) def setup(self): print('setup...') def test_create_...
987,722
dc8995b61f4bc2480bac2516c92aabb1474e1a68
#!/usr/bin/env python3 __author__ = "Christian F. Walter" from math import factorial if __name__ == "__main__": with open('p067_triangle.txt', 'r') as tri_file: tri = tri_file.readlines() for i, row in enumerate(tri): tri[i] = row.strip().split() # # from bottom to top, sum max of two numbers below...
987,723
f144f1a7c20ffe5edd6f558237a32d224b49bf85
from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np import argparse import sys import tempfile from tensorflow.examples.tutorials.mnist import input_data import tensorflow as tf from skimage import transform import tensorflow as tf import i...
987,724
844a8ff13f424c9dae04b209ee92c99f4ee6785d
import unittest import asserts import masTest if __name__ == "__main__": loader = unittest.TestLoader() suite = unittest.TestSuite() suite.addTests(loader.loadTestsFromModule(asserts)) suite.addTests(loader.loadTestsFromModule(masTest)) runner = unittest.TextTestRunner(verbosity=3) results = r...
987,725
3fc85f6d7d9117ebf2c8378fe252db26e915c78e
import numpy as np import pytest from numpy.testing import assert_allclose from scipy import stats from sklearn.metrics import ( mean_absolute_error, mean_squared_error, median_absolute_error, r2_score, ) from xskillscore.core.np_deterministic import ( _mae, _mape, _median_absolute_error, ...
987,726
f49e9bc61cbf04ca12e2f5fa1dd0f939a5f4bab9
import mysql.connector as mysql from modules.classes import Car, User, DataBaseException def commit_req(estimate_req): cnx = mysql.connect(host = "db", user = "root", passwd = "root", db = "db") cursor = cnx.cursor() estimate_req['model_id']=None print(estimate_req) insert_query='INSER...
987,727
b3245ee0ac37d080a6f6d74ce9df4127e0802372
# -*- encoding: utf-8 -*- from src.base.monitor import CXMonitor class VectorCXMonitor(CXMonitor): pass
987,728
cfe9aa4f213f39ad0e5249a6fbc55bb79cc17a73
EDITORS = [ 'subl', 'atom', 'code' ]
987,729
d13293b05e0145b05594b4f88231c4230bc7df35
from flask import jsonify, request from flask_todo import app, db, bcrypt from flask_todo.models import Todo, TodoSchema, User, UserSchema import datetime from pytz import timezone from sqlalchemy import desc from flask_jwt_extended import ( create_access_token, create_refresh_token, jwt_required, jwt_refresh_t...
987,730
6350727c8e86967b6f44754e816c936c323c35bf
# -*- coding: utf-8 -*- ## some coding for commonly used plots import numpy as np import matplotlib.pyplot as plt from matplotlib import rcParams # setup some plot defaults plt.rc('text', usetex=True) plt.rc('font', family='serif') plt.rc('font', size=30) rcParams.update({'figure.autolayout': True}) def plot_1d(x,y...
987,731
f3a03dbf3bbc21ca9380b039326f1e7b70f77103
# Programmer: Mr. Devet # Date: September 9, 2021 # Description: Draws a scene with a boat and a sun # Load the contents of the turtle module into the python # environment from pygameplus import * # Create the graphics window and open it screen = Screen(725, 310, "My Boat") screen.background_color = "sky blue" screen...
987,732
2b1d1a053f77d4861bd7217ba63c80ac22482237
#!/usr/bin/env python import cv2 as cv import numpy as np import open3d as o3d from matplotlib import pyplot as plt def task_1_3_extract_and_match_features(img1, img2): orb = cv.ORB_create() keypoints1, descriptors1 = orb.detectAndCompute(img1, None) keypoints2, descriptors2 = orb.detectAndCompute(img2, N...
987,733
18184048e0091e02df6685f99ff7625e10e11d1d
# ---------------------------------------------------------------------- # Numenta Platform for Intelligent Computing (NuPIC) # Copyright (C) 2015-2016, Numenta, Inc. Unless you have an agreement # with Numenta, Inc., for a separate license for this software code, the # following terms and conditions apply: # # This p...
987,734
88d396c0225c469410e1f737dd408a4662e778cc
#!/usr/bin/python map = [[],[],[],[]]; num = 0; ans = 0; tmp = 0; def check(x,y): global tmp,ans,num; if x >= num or y >= num: return 0; if map[x][y] != '.': return 0; for i in range(x-1,-1,-1): if map[i][y] == 'M': return 0; elif map[i][y] == 'X': ...
987,735
e7472112fb0292a03c04342e604a1d8ae2305733
import filecmp import io import os from random import randint import requests from django.conf import settings from django.contrib.auth import get_user_model from django.core.files import File from django.core.files.temp import NamedTemporaryFile from django.urls import reverse, resolve from rest_framework import stat...
987,736
4d0680a87ac8c1413df316e11645785445d1065c
from time import time as now from threading import Timer from SocketServer import BaseServer import logging logger = logging.getLogger('timer.ActivityTimer') debug = logger.debug """ A timer that calls BaseServer.handle_timeout when there is no activity recorded within the servers 'timeout' variable. Invoke Activity...
987,737
6c3644b7bedfca03fab2771bb340a26361b8c8fd
#!/usr/bin/env python # encoding: utf-8 class Solution: # @param {string} input # @return {integer[]} def diffWaysToCompute(self, input): ret = [] for i in range(len(input)): c = input[i] if c in ('+', '-', '*'): left = self.diffWaysToCompute(input[:...
987,738
f591c21fe606af39328fe12a8f50619752e1669f
#-*- coding: utf-8 -*- # vim: set fileencoding=utf-8 import logging import random import string import datetime import json from google.appengine.api import users from google.appengine.ext import deferred import httplib2 from ardux.tasks import sync_resources from flask import redirect, g, session, request, make_resp...
987,739
e9a9d87020420033ae8d800ea0f88208e30e75d2
from flask import request from flask_restful import Api, Resource from app.api.v1.model.models import UserModels class User(Resource): def __init__(self): self.db = UserModels() def notFound(self): return {'Message' : 'Record not found'},404 def get(self, user_id): user = self.d...
987,740
f8f448f2df7094d9c962434055dff28b411c7a34
import urllib2 import json def get_tweets(name): s = urllib2.urlopen("http://search.twitter.com/search.json?q="+name).read() x = json.loads(s) for i in range(len(x['results'])): print "%s.%s--> %s\n" %(i, x['results'][i]['from_user_name'], x['results'][i]['text']) name = raw_input("Enter the twitter-username g...
987,741
62d190cf6cc199f4da3a37038ff4cc5716d8f9ab
from netapp.netapp_object import NetAppObject class ArchiveRecord(NetAppObject): """ Single instance of sampled data in binary form. """ _data = None @property def data(self): """ Binary instance data. Average expected length of each return string is under 10k byte...
987,742
251968cf50b8af09e909e60eed0f5274b42fce44
import sys import logging from lbps.network_tools import LBPSWrapper from lbps.structure.base_station import BaseStation from lbps.structure.relay_node import RelayNode from lbps.structure.user_equipment import UserEquipment from itertools import count class DRX(LBPSWrapper): count = count(0) def __init__( ...
987,743
b35625419f9de20301d72a7e53152c1c8c8512f8
import sys sys.path.append('/home/aistudio') import paddle import paddle.fluid as fluid from TPN.models.solver import Solver from TPN.models.evaluator import Evaluator from TPN.readers.rawframes_dataset import RawFramesDataset from TPN.utils.config import cfg def evaluate(evaluator, epoch): with fl...
987,744
5182647f2134618426dea66c6d8027d54ec60bd8
from cs50 import SQL db = SQL("sqlite:///finance.db") rows = db.execute("SELECT * FROM log") print(rows) new_rows = [] for i in range(len(rows)): if rows[i]["symbol"] not in [item["symbol"] for item in new_rows]: new_rows.append(rows[i]) print("NO DUBLICATE") else: for r...
987,745
3c98ed65f0c6e75c1ef225cd421334963da544a5
#!/usr/bin/env python3 from glob import glob import logging import os import sys from fastapi import FastAPI, File, UploadFile from fastapi.responses import FileResponse from fastapi.middleware.cors import CORSMiddleware from uvicorn.logging import ColourizedFormatter logger = logging.getLogger('traffic-editor-file-...
987,746
259db2033aebd5ff00539c9a81d168092faa9c37
""" Python program to get a list, sorted in increasing order by the last element in each tuple from a given list of non-empty tuples. """ t1=(1,'s','c','d','f',6) t2=('x','y') t3=('p','q','r','s') t4=(t1,)+(t2,)+(t3,) l=[t4] print(l) t4=t1+t2+t3 print(l)
987,747
177254d3d51cf3f499aa45b712df2d22a9f4cd98
import cv2 import numpy as np def gradient(img,y,x): grad = np.array([0.0, 0.0, 0.0]) grad = img[y, x] * 4 - img[y + 1, x] - img[y - 1, x] - img[y, x + 1] - img[y, x - 1] return grad def isophote(patch, patchSize): p = patchSize//2+1 pGrad = np.array([patch[p,p,:] - patch[p+1,p,:], patch[p,p,:] - patch[p,p+1,:]...
987,748
267ae35db74b443a9eaa07ac8983c1dad6e7d77b
import os basedir = os.path.abspath(os.path.dirname(__file__)) jwt_secret="mykey" # class Config(object): # DEBUG = False # # MONGO_URI = 'mongodb://localhost:27017/mydb' # MONGO_URI = os.getenv('MONGO_URL') # class DevelopmentConfig(Config): # DEBUG = True # class ProductionConfig(Config): # ...
987,749
1067ac71b92a55ff826134a3e734dc352f603515
import numpy as np import matplotlib.pyplot as plt from matplotlib import style import csv import pickle style.use('classic') def input_file_csv(type1,angle=None): date = '08-03-2019' normalize_csv(date,type1,angle) date = '11-03-2019' normalize_csv(date,type1,angle) date = '25-02-2019'...
987,750
5ddeddab84dff65113be7ee853d916f8c5f3b5d2
import numpy as np import pandas as pd from pandas_datareader import data as pdr import matplotlib.pyplot as plt import datetime from datetime import date import statsmodels from statsmodels.tsa.stattools import coint from pykalman import KalmanFilter from math import sqrt import yfinance as yf yf.pdr_override() #set ...
987,751
84ad68849a82de44fd45963f86faa2af55cb2854
from netaddr import IPSet from app.scope.scan_manager import IPScanManager def test_new_scan_manager(app): scope = IPSet(["10.0.0.0/24"]) blacklist = IPSet(["10.0.0.5/32"]) mgr = IPScanManager(scope, blacklist, False) assert mgr.get_total() == 255 assert mgr.get_ready() def test_scan_cycle_compl...
987,752
69bba5bea0699741d26cfc769dd68e042ad7810d
from market_observer_interface import ObserverInterface, ObservableInterface class Observable(ObservableInterface): def __init__(self): self.observers = [] def register(self, observer): assert isinstance(observer, Observer), "Observer objects available to register only" if observer no...
987,753
712e2fa267d4387003efba57d45652b1a39e561a
from django.test import TestCase from .models import Post, UserPostLikes from django.contrib.auth.models import User from rest_framework.test import APIClient from rest_framework import status from django.urls import reverse # Create your tests here. class ModelTestCase(TestCase): def setUp(self): """De...
987,754
b5d74aad33f783564c8a2d370b39aa836f8f24bc
from django import forms from .models import Client, MealTracker class ClientForm(forms.ModelForm): class Meta: model = Client fields = ('client_name', 'gender', 'email', 'height', 'weight', 'client_age', 'BMR', 'account_number', 'address', 'city', 'state', 'zipcode', 'phone_numb...
987,755
abe5f9f7281eab2604d207bdb4f04cb2c4232a0f
import unittest from core.constants import ErrorMessages from problem2.processor import Processor class TestPrblm2Processor(unittest.TestCase): def setUp(self): self.processor = Processor() def tearDown(self): self.processor = None def test_parser(self): kingdom_list = self.proc...
987,756
33b3728ab4a39717c5d55248a77848b406a6be6f
#!/user/bin/env python # coding: utf-8 from jinja2 import nodes from jinja2.ext import Extension from base import BaseExtension from uri import UriExtension class CssType: INLINE = 1 # 内联样式 EXTRA = 2 # 外部样式 # 创建一个自定义拓展类,继承 jinja2.ext.Extension class CssExtension(BaseExtension): # 定义该拓展的语句关键字,这里表示模版中的 {% uri ...
987,757
5be5042da70eddaed798233ac0b3315baa33c47d
ATTRIBUTE = "ATTRIBUTE" CONTENT = "CONTENT" IMPORT = "IMPORT" MOD = "MOD" WIDGET = "WIDGET"
987,758
5d64aedabfbba26cb6f35b696598647a081703e8
import tkinter as kin import tkinter as tk from tkinter import * from tkinter import messagebox as tkmessagebox from tkinter.font import Font from tkinter import messagebox import time import random from time import sleep import time top = kin.Tk() top.geometry("1920x1080") def irsensor(): import RPi.GPIO a...
987,759
350c94faa7a0b15e4517318eccec4d882da89d3d
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Copyright (c) 2013, Rui Carmo Description: Experimental Cython compile script License: MIT (see LICENSE.md for details) """ import os, sys from distutils.core import setup from distutils.extension import Extension from Cython.Distutils import build_ext from Cython.Bui...
987,760
61959d83e66f4edb454a71fe8294e33c10681d9a
# Generated by Django 2.2.3 on 2019-07-24 23:31 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('myapp', '0010_auto_20190724_2322'), ] operations = [ migrations.RemoveField( model_name='documentconvert', name='place', ...
987,761
a8f48599be3aee49a3cbcd8aff28d162b17b2616
x=input("Enter a num:") y=input("Enter a num:") if x != y: print("yes") else: print("no")
987,762
d1a1c0ce64ebf4715b3e761ff19fec0bcd2e3baa
import numpy as np gamma = 0.75 alpha = 0.9 location_to_state = { 'L1' : 0, 'L2' : 1, 'L3' : 2, 'L4' : 3, 'L5' : 4, 'L6' : 5, 'L7' : 6, 'L8' : 7, 'L9' : 8 } actions= [0,1,2,3,4,5,6,7,8] rewards = np.array([[0,1,0,0,0,0,0,0,0], [1,0,1,0,0,0,0,0,0], ...
987,763
e505a0f4a8625d5b6d8a74494a5d530c1101f65a
import sys from Library.constrainedPolymer import ConstrainedPolymerPackNBB as CPNBB import Utilities.fileIO as fIO import numpy as np class peptideHairpinGenerator(CPNBB): # A class for a buildingBlockGenerator object # that creates random peptide hairpins between two points. # Static values are a...
987,764
1860713de22a88398b79900e95b9aef9a08b2c86
import math import cmath import string import sys import bisect import heapq from queue import Queue,LifoQueue,PriorityQueue from itertools import permutations,combinations from collections import deque,Counter from functools import cmp_to_key import math import cmath import string import sys import bisect import heapq...
987,765
ae96e8a9a597b97942a11ac7d72d59add2a52b9c
import utils if __name__ == '__main__': # 使用变量 print(utils.name) # 使用函数 print(utils.sum(10, 5)) # 使用类 person = utils.Person() person.say_hello()
987,766
278074db6b815136c55e3af5960611ee4897b7e7
# Generated by Django 3.0.1 on 2020-01-04 04:33 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('chat', '0002_auto_20200104_0433'), ] operations = [ migrations.AlterField( model_name='room', name='last_activity', ...
987,767
26fd9331961a9c28792d97165a81e77c19e54139
def middle_three_char(): word = input('Enter the string: ') middleIndex = int(len(word) /2) middleThree = word[middleIndex-1:middleIndex+2] print(middleThree) middle_three_char()
987,768
e6129916b7924cf6888fa18dc9eb61f161b04582
from sklearn.model_selection import LeaveOneOut import numpy as np def loo_risk(X,y,regmod): """ Construct the leave-one-out square error risk for a regression model Input: design matrix, X, response vector, y, a regression model, regmod Output: scalar LOO risk """ loo = LeaveOneOut() ...
987,769
a24ce25d4a3ecc57598f51c52a5a333913d59a43
#!BPY # -*- coding: UTF-8 -*- # # read/write file # # # 2017.08.29 Natukikazemizo import bpy import codecs data =[] f_in = codecs.open(bpy.path.abspath("//") + "data/in.txt", 'r', 'utf-8') f_out = codecs.open(bpy.path.abspath("//") + "data/out.txt", 'w', 'utf-8') data1 = f_in.read() f_in.close() lines1 = data1.spl...
987,770
ff1154cdc6c21d4b8adc6f0318dc5f52d2bad0f4
from django.db import models from people.models import Person class Checkin(models.Model): person = models.ForeignKey(Person, verbose_name='Pessoa', related_name='person', on_delete=models.PROTECT) observation = models.TextFie...
987,771
4917b340a84f27a07b0de1ec26db044b291d132c
# import json # stringOfJsonData = '{"name": "Zophie","isCat":"True","miceCaught":0,"felineIQ":null}' # jsonDataAsPythonValue = json.loads(stringOfJsonData) # print(jsonDataAsPythonValue) # import json # pythonValue = {'name': 'Zophie','isCat':'True','miceCaught':0,'felineIQ':None} # stringOfJsonData = json.dumps(pyth...
987,772
1e4148cf381ee5d3ff9a2a79fc64b738575caae4
import math import numpy as np import matplotlib.pyplot as plt from time import sleep # Input v = math.radians(float(input("Rotation in degrees: "))) count = int(input("Amount of times to rotate: ")) # Definitions vector = np.array([5, 0]) rotated_vector = vector the_matrix = np.array([[math.cos(v), -math.sin(v)], [...
987,773
5ba831c46268d1c8b11a544ddd136ec2c08d377a
import time import pygame import taichi as ti import numpy as np from pygame.locals import * def mainloop(res, title, img, render): dat = ti.Vector.field(3, ti.u8, res[::-1]) @ti.kernel def export(): for i, j in dat: dat[i, j] = min(255, max(0, int(img[j, res[1] - 1 - i] * 255))) ...
987,774
97ae9af9354d6e6a8c7f7cebc401445138d366ab
from sqlalchemy.ext.declarative import declarative_base from sqlalchemy import Column, Integer, String class Create(): Base = declarative_base() class Modules(Create.Base): __tablename__ = 'modules' id = Column(Integer, primary_key=True) type = Column(String) name = Column(String) name_fran...
987,775
647c363d975cfd31429e848b0a5dc29c27709d36
# coding:utf-8 from __future__ import print_function import os, time, sys, json, re from lib.common import * from lib.ip.ip import * # 作者:咚咚呛 # 常规类后门检测 # 1、LD_PRELOAD后门检测 # 2、LD_AOUT_PRELOAD后门检测 # 3、LD_ELF_PRELOAD后门检测 # 4、LD_LIBRARY_PATH后门检测 # 5、ld.so.preload后门检测 # 6、PROMPT_COMMAND后门检测 # 7、crontab后门检测 # 8、alias后门 # 9...
987,776
73e662f02a4251eeb2d75d3867a0d22e1d14d968
class Solution: def addBoldTag(self, s: str, words: List[str]) -> str: ''' transform to LC56 ''' def add_into_interval(start, end): i = bisect.bisect_left(bold_range, start) j = bisect.bisect_right(bold_range, end) if i%2 == 0...
987,777
e153fdb04cf55b2a84b497a0eba5202c7865d935
# -*- coding:utf8 -*- class Person: def say_hi(self): print('Hello world ,how are you!') p = Person() p.say_hi()
987,778
4b166b1f80ccae1a4b4f4b5176a72fe0ab1b718c
# 1. Write a variable for each of the five datatypes # 2. Convert a string into a number # 3. Print out the number you converted above # 4. Change the number in the variable from exercises 2 and 3 and print it out again # 5. Ask the user to enter their name, and print "Hello NAME", eg, if I entered # "Matthe...
987,779
222f2ed8b39e156a5ffd5f11d61aba0926931f43
# Generated by Django 2.0.2 on 2018-03-02 06:03 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] ope...
987,780
fb275f40bf805a736eeb5e2887ed87f7b4841eef
# Generated by Django 2.0.2 on 2018-02-27 17:07 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('users', '0009_remove_pro...
987,781
071a3fe9179dd63343d507e8a094f61bdd8c6f4c
from pratical6.car import Car def main(): my_car = Car("audio",180) my_car.drive(30) print("fuel =", my_car.fuel) print("odo =", my_car.odometer) print(my_car) limo=Car("Toyota",100) print("fuel =", limo.fuel) limo.drive(115) print("odo= ",limo.odometer) print(limo) main()
987,782
c49f1aea07ae3f082e389c64ddb5c8459eb9a318
import os import glob from importlib import import_module _cameras = {} def get_camera_list(): """Obtain the list of available camera drivers.""" cameras = [] modules = glob.glob(os.path.join(os.path.dirname(__file__), '*_camera.py')) for module in modules: m = import_module('.' + os.path.bas...
987,783
e94c01ed4cadc600d71fb2d9dc2a438ee49f7261
import requests import os from django.core.management.base import BaseCommand, CommandError from bs4 import BeautifulSoup homepage = "https://vhost.vn/" urls = "https://vhost.vn/ten-mien/" source = "VHost" def get_dom(url): page = requests.get(url) dom = BeautifulSoup(page.text, 'html5lib') return dom de...
987,784
2418cebb24c9f158e10843744e493a413f0df3ad
import csv import os import sys import numpy as np import pandas as pd import datetime import time import inspect ERROR_CODE = 100 NORMAL_CODE = 0 def getKeyboadInput(): ans = input() return ans def execSleep(sec): time.sleep(sec) def left(str, amount): return str[:amount] def right(str, amount): ...
987,785
34fdc3f0b1c0c9ca6414f0ee296e0230bbc5e935
# Generated by Django 2.2.2 on 2019-12-22 14:10 import django.contrib.postgres.fields.jsonb from django.db import migrations, models import django.db.models.deletion import django.utils.timezone class Migration(migrations.Migration): initial = True dependencies = [ ('company', '0001_initial'), ...
987,786
1c8cd24b1697f9fe47e6eadcad3f3577826e32fd
def addition(num1, num2): return num1 + num2 def subtraction(num1, num2): return num1 - num2 def multiplication(num1, num2): return num1 * num2 def division(num1, num2): return num1 / num2 print('Welcome to PyCalc!') print('Select an option below:') print('1. Add') print('2. Subtract') print('3. Mul...
987,787
1c890ac54dd5ba1218c12d6d01114dfae6ac2491
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Jun 9 16:26:30 2021 @author: mike """ import os import yaml import numpy as np import pandas as pd from hilltoppy import web_service as ws import requests from time import sleep # from sklearn.neighbors import LocalOutlierFactor pd.options.display.max...
987,788
64db285dc9150a38438e857f06e3749845df5203
# coding: utf-8 """ """ __version__ = "0.0.1" from .helpers import *
987,789
81878ee1e63609af976d2855dcc470df4e7186f4
import HTTPCall class TravelSeasonality(object): def __init__(self): self.HandleREST = HTTPCall.HTTPCall() self.HandleREST.request_authentication() self.tasks = {} def call(self): self.response = self.HandleREST.request_content( '/v1/historical/flights/JFK/seasonality ' + \ ...
987,790
8b4da3e743b04bb1afde616ce49e6a86f06af78d
import sunck ''' __name__属性: 模块就是一个可执行的.py文件,一个模块被另一个程序引用。我们不想让模块中的某些代码执行,可以用__name__属性来使程序仅调用模块中的一部分 ''' sunck.sayGood()
987,791
2fe002744e91244a4b6ae8499ea510e6842fd70a
V, X = map(float, input().split()) print('Yes' if X == V or X > V else 'No')
987,792
c53a76c33f0f182d7930b5be542e4d0bc2931e3f
<<<<<<< HEAD ======= #Given an unsorted array arr and a number n, delete all numbers in arr that are greater than n. >>>>>>> 24cff50b7d516788ae3fadf06fe003c15d118850 def removeLarger(arr, n): for i in arr: if i > n: arr.remove(i) return arr list = [3, 4, 5, 6, 8, 9, 10, 452, 65, 2452, 75, 34...
987,793
2bfb879dc266be5e21bd545b10a7986ad52c7598
import subprocess from time import sleep while True: subprocess.Popen('notepad') #use artificial multithreading subprocess.Popen('calc') #use artificial multithreading subprocess.Popen('mspaint') #use artificial multithreading subprocess.Popen('explorer') #use artificial multithreading sub...
987,794
b61ee1534cb5468ff33b50b2e5895fd3e9b90750
# [Classic] # https://leetcode.com/problems/valid-number/ # 65. Valid Number # History: # Facebook # 1. # Apr 3, 2020 # 2. # May 12, 2020 # Validate if a given string can be interpreted as a decimal number. # # Some examples: # "0" => true # " 0.1 " => true # "abc" => false # "1 a" => false # "2e10" => true # " -90e3...
987,795
639c11001d30363b7c0c9dcde7abb84d0e989ff0
# 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 writing, software # distributed under the...
987,796
0d65af61199f5e632b6a22d10a3d64bdcacf0a3e
schema = { "$schema": "http://json-schema.org/draft-04/schema#", "title": "Example Schema", "type": "object", "properties": { "firstName": { "type": "string" }, "lastName": { "type": "string" }, "age": { "description": "Age in y...
987,797
e236f00280c21171a5307dbdad22f504fd20dd5b
# Generated by Django 3.2.8 on 2021-10-18 14:39 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('rooms', '0002_auto_20191216_0937'), ('users', '0002_alter_user_avatar_alter_user_first_name'), ] operations = [ migrations.AlterFiel...
987,798
9d5cd86bd4deb3007a7ad3214e1bb3c2bf5cbb70
from django.apps import AppConfig class GamepickerConfig(AppConfig): name = 'gamepicker'
987,799
3a0370fca1faece049455f051da636d21c87ddda
from .models import Event from django.utils import timezone def next_events(request): events = Event.objects.filter( start_date__gte=timezone.now()).order_by('start_date')[:5] return {'events': events}