index
int64
0
1,000k
blob_id
stringlengths
40
40
code
stringlengths
7
10.4M
17,200
bcbb73af7fbd1eac8e6c7b5841d998c4b0720038
from gensim import utils from gensim.models.doc2vec import LabeledSentence from gensim.models import Doc2Vec from gensim.models.doc2vec import LabeledSentence # numpy import numpy from sklearn.metrics.pairwise import cosine_similarity # random from random import shuffle import string import nltk from nltk.tokenize i...
17,201
d81f338c73e51c1013a6d6570061e7ae73251705
#! /usr/bin/python import time import RPi.GPIO as GPIO import threading class TrafficLight: def __init__(self): GPIO.setmode(GPIO.BCM) self.ledList = [] def addLed(self, ledname, gpiono, delay_secs, status_blink=False): self.ledList.append(Led(ledname, gpiono, delay_secs, status_blink...
17,202
bddfe9c0856bd6101b41c5b444b6c35e258c607e
DIR = 'data/' LINEA = 30 bMovil = False HOST = 'localhost' USUARIO = 'ipaspudo' PASSWD = 'qazwsxedc' BDEDATOS = 'ipaspudo'
17,203
a08301ce1f89ebb8847c5ad01962cb441f443c6f
target = 'VPatch' files = Split(""" apply_patch.c checksum.c md5.c vpatchdll.c """) libs = Split(""" kernel32 user32 """) Import('BuildPlugin env') BuildPlugin(target, files, libs, defines = ['DLL_CHECKSUMS'])
17,204
1cc92383d4adc1fddaa7b8ed5f67533f99509000
from testsuits.base_testcase import BaseTestCase from pageobjects.znbwl_add_menu import ZnbwlAddMenu import unittest class Znbwladdmenu(BaseTestCase): def test_znbwl_add_menu(self): zam=ZnbwlAddMenu(self.driver) zam.first_add_menu("today is Thursday") zam.second_add_menu("a fine day") ...
17,205
6d2b0ee790f67028499dca784fa13f55250ae082
# Generated by Django 2.1.5 on 2020-08-30 17:48 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('rockermind', '0002_auto_20200830_1147'), ] operations = [ migrations.RemoveField( model_name='rocker', name='members', ...
17,206
cfc72e4a19de490d18d0df56e8da1d02721c8949
""" For the time being, the most important heuristic for determining article priority will be based on the presence of authors """ from sklearn import svm from sklearn.feature_extraction.text import CountVectorizer, TfidfTransformer from warden.models import AuthorRating, ArticleRating class AuthorRank: """ ...
17,207
f22d2bd2db9d0b106dcbc0bc4c6b222bb2bee502
day = "sunday" if day == sunday or day == monday: print "it's the weekend"
17,208
f63041ce95281c34f97b569f32a00d7ce148f1c7
# Let d(n) be defined as the sum of proper divisors of n (numbers less than # n which divide evenly into n). # If d(a) = b and d(b) = a, where a b, then a and b are an amicable pair # and each of a and b are called amicable numbers. # For example, the proper divisors of 220 are 1, 2, 4, 5, 10, 11, 20, 22, # 44, 55 a...
17,209
524dd00cd878c3f59a01909b29fb35e83f1ceb9c
#!/usr/bin/env python ################################################################################ # Mauricio Esguerra # mauricio.esguerra@gmail.com # March 6, 2017 # # Pymol Script for CGO display of an xyz axis centered on the center of mass. # # This script can be invoked without # X11 display with: # >pymol -qc...
17,210
42c6473e3ce8159732e8279b8d30767a061d0c54
import random def countNumbers(table, parzyste = 0, nieparzyste = 0, output = [0, 0]): for x in table: if x%2==0: parzyste += 1 else: nieparzyste += 1 output[0] = round((parzyste/len(table))*100,2) output[1] = round((nieparz...
17,211
40609dc090658234b7c10650ceea2a3acc54af5d
BUSINESS_ROLES = [('LANDLORD', 'landlord'), ('TENANT', 'tenant'), ('THIRD_PARTY', 'third party')] CASE_TYPES = [('TRIBUNAL', 'tribunal'), ('ADJUDICATION', 'adjudication')]
17,212
d5ba60f2b4d8b45da9048cdd0a316a18e7b28a6a
# -*- coding: utf-8 -*- """ Copyright (c) Microsoft Open Technologies (Shanghai) Co. Ltd.  All rights reserved. The MIT License (MIT) 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 res...
17,213
bedb4db485aae537c806a8c7099ca7679e4d34e8
#Made by: Kouah Mohammed Aymen #Computer science student at "National Computer science Engineering School, Algiers (ESI)" #E-mail: jm_kouah@esi.dz #Github: https://github.com/aymenkouah #Requires installaling "filetype" #https://pypi.org/project/filetype/ # Modules import os import filetype import random...
17,214
ccc5fbc1a2665f389f32b7fef500dc8a4add9fe2
from urllib.parse import urlparse from base import process_external_url_queue import url_queue import csv from bs4 import BeautifulSoup from selenium import webdriver HOST = 'localhost' PASSWORD = 'python' USER = 'python' DB = 'cpa' PORT = 3306 def main(): # 1. instantiate stuff canada_queue = url_queue.URL...
17,215
7d654f30d60eed2359d789ef7b9edac44bbb6164
import logging from bernard import ( layers as lyr, ) from bernard.i18n import ( translate as t, ) from bernard.platforms.telegram import layers as tll from src.did_the_rocket_launch_yet.utils.urls_rocket import get_url_rocket_frame logger = logging.getLogger('bisect') def get_response_rocket_did_launch(mi...
17,216
212086623cfd8693e3ffb1db509fdd2eb43eada0
# Add an array to ``point_data`` to a DataSet and then clear the # point_data. # import pyvista mesh = pyvista.Cube() mesh.clear_data() mesh.point_data['my_data'] = range(mesh.n_points) len(mesh.point_data) # Expected: ## 1 mesh.point_data.clear() len(mesh.point_data) # Expected: ## 0
17,217
a0c8bb77c3158c4c9e4284a679cf950f1cab1fca
from app.models.models import * from django.db.models import Avg from django.shortcuts import render import datetime import difflib import html ## A singleton class for caching successful responses class ResponseCache: class __ResponseCache: def __init__(self, most_recent_response): self.most_...
17,218
2963f875dda3f28760626de207b24897ccecfaa4
class Complex: def __init__(self,a, b) -> None: self.a = a self.b = b def __add__(self, obj): return Complex(self.a + obj.a, self.b + obj.b) c1 = Complex(1, 4) c2 = Complex(11, 3) c3 = c1+c2 print(c3.a, c3.b)
17,219
0392dff19065054415e92f75734032eda4314923
""" This module contains functions for handling the command line interface to Spotlight. """ import argparse try: from spotlight import version version_action = version.VersionAction except ImportError: from spotlight import _version version_action = _version.NoVersionAction class Driver: """ Driv...
17,220
d55a964ca6573474517c089c05ec8ab2b1042ba9
import tkinter.ttk as ttk import time from tkinter import * root = Tk() root.title("HJ GUI") root.geometry("640x640") '''progressbar = ttk.Progressbar(root, maximum=100, mode = "determinate") # mode = "indeterminate" 이면 좌-우로 왔다갔다 무한반복, determinate 이면 게이지가 좌->우로 차는거 반복 progressbar.start(10) # 10ms 마다 출력...
17,221
496657c2318de434a8426675097acdf8cf210a50
import cv2 from scipy import ndimage import os, sys import numpy as np dev = int(sys.argv[1]) cap = cv2.VideoCapture(dev) print(cap.isOpened()) os.system("v4l2-ctl -d %i -c focus_auto=0" % dev) i = 0 max_focus = 255 step_size = 1 fine_tuning_iterations = 5 fine_tuning_batch_size = 10 # [x, y, h, w] rect = [None, Non...
17,222
7464dc543581f2b103855d20679f2c090b8f5f22
#!/usr/bin/python2 import sys, re rc = re.compile test = """amavis[5691]: (05691-06) TIMING [total 3257 ms] - SMTP EHLO: 3 (0%), SMTP pre-MAIL: 1 (0%), SMTP pre-DATA-flush: 4 (0%), SMTP DATA: 80 (2%), body hash: 1 (0%), mime_decode: 20 (1%), get-file-type: 30 (1%), decompose_part: 10 (0%), parts: 0 (0%), AV-scan-1: ...
17,223
6ab6fdf0ca5254fde1c10236f5a34892866870b1
#!/usr/bin/env python import rospy from rospy_tutorials.srv import AddTwoInts, AddTwoIntsResponse, AddTwoIntsRequest # Messages used in the node must be imported. rospy.init_node('service_client_node_py',anonymous=True) #initialzing the node with name "service_client_node_py". The second arugument "anonymous" is opti...
17,224
21b38967f9768d5c19991a2f2d7239fc4a16d313
import os import sys import subprocess from datetime import datetime import logging from threading import Thread import json import re from time import sleep from ImageDB import ImageDB from astropy.visualization.scripts.fits2bitmap import fits2bitmap path = os.path log = logging.getLogger(__name__) class Executor(ob...
17,225
d3b9e2d4323a2b187161328dbfe0264c12372d45
from .category import * from .trivia import * from .premios import * from .sorteos import * from .rules import *
17,226
c7ef4fd226ee95e7cf00a364127606f891a860c8
#ex4 a, b numeFisierAsn = "afr_green_monkey.asn1" numeFisierFasta = "conversie_fasta.fasta" numeFisier1Fasta = "Multifasta.fasta" print ("ex. ASN - a - conversie secventa ADN") def Mapping(char): map={ "0":"AA", "1":"AC", "2":"AG", "3":"AT", "4":"CA", ...
17,227
2900eb0cd6ef832c803e5118c94aa8931bc97941
from bs4 import BeautifulSoup import urllib2 import re import smtplib from email.mime.text import MIMEText from email.mime.multipart import MIMEMultipart sender = 'indrajeet.lyfsgr8@gmail.com' receiver = 'sen15recess@gmail.com' GMAIL_USERNAME = "sentest15@gmail.com" GMAIL_PASSWORD = "123@Kiit" pageFile = urllib2.urlope...
17,228
1cd9322a78f94aa2137745ab8104245d305e3fd8
# SMS spam optimised # The pipeline you built earlier for the SMS spam model used the default parameters for all of the elements in the pipeline. It's very unlikely that these parameters will give a particularly good model though. # In this exercise you'll set up a parameter grid which can be used with cross validatio...
17,229
6e6d00337e18408f04b0bd17708de3b971c2d4b7
#!/usr/bin/env python import webbrowser from globus_sdk import AccessTokenAuthorizer, NativeAppAuthClient, TransferClient from utils import is_remote_session, start_local_server CLIENT_ID = "1b0dc9d3-0a2b-4000-8bd6-90fb6a79be86" REDIRECT_URI = "http://localhost:8000" SCOPES = "openid email profile " "urn:globus:aut...
17,230
3b95692741d015679e1ad86a8471dec78fa011c7
__author__ = 'ysekky' from learner_base import LearnerBase from sklearn.svm import SVC class SimpleSVM(LearnerBase): def learning(self, training_data, feature_names, **kwargs): x = self.create_feature(training_data, feature_names) y = self.encode_training_class(training_data) self.learn...
17,231
1ae03e0105cbfbf0fd09fe3f4f6ca0f4f20508ac
#!/usr/bin/env python # -*- coding: utf-8 -*- import sh import os import re from os.path import dirname from docktree import Docktree try: from StringIO import StringIO except: from io import StringIO def setup_module(): os.chdir(dirname(__file__)) def teardown_function(function): try: sh.d...
17,232
8c9d1ab26c94b2bf4983fadf7240218e77382215
# Generated by Django 2.2.7 on 2019-11-25 11:45 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('livecoding', '0009_auto_20191125_1107'), ] operations = [ migrations.AlterField( model_name='ex...
17,233
996a7d42b1992b218d64e6fe8b7f0811dfdc1d88
# class inheritance """ >>> x = OldBenz() >>> print(x.number_of_wheels) 4 >>> print(x.get_speed()) 70 >>> my = VW() >>> print(my.number_of_wheels) 4 >>> print(my.diesel) False >>> print(my.star_logo) Traceback (most recent call last): ... AttributeError: 'VW' object has no attribute 'star_logo' """ class Vehicle(...
17,234
1f8f8d11f0f79caa797de0ca4ccdae43f3dc3167
# Copyright (c) 2014 Kontron Europe GmbH # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is...
17,235
760b8d1f51b5fbbbbe9d13c8743ae67bb276b4ca
#!/usr/local/bin/python # Copyright 2015 The Switch Authors. All rights reserved. # Licensed under the Apache License, Version 2, which is in the LICENSE file. """ Does specifying a . in an input file result in the parameter retaining its default value, mimicking the behavior of AMPL? The answer is yes, it does. """ ...
17,236
fe929d8c81d56c2cf85842fde0cbf1e2976f8c8f
# solution to the HackerRank problem "Largest Rectangle" # https://www.hackerrank.com/challenges/largest-rectangle/problem # Real Estate Developers is planning to demolish a number of old buildings and construct a shopping mall # Task is to find the largest solid area in which the mall can be constructed. # Ahmetcan Oz...
17,237
eee87b28b94537d136984d557363d015e85e1c6d
import os import pyttsx3 engine = pyttsx3.init() def speed_audio(speed): global engine engine.say("speed is {0}.".format(speed)) engine.runAndWait() def heel_strike_audio(): os.system('mpg321 heel_striking.mp3') def increase_tilt_audio(): os.system('mpg321 increase_tilt.mp3') def decrease_tilt_...
17,238
ca4c91d3392cd705923c12d97d3318b55280f3c8
import pandas as pd data1={'key1':['A0','A0','A1','A2'], 'key2':['A0','A1','A0','A1'], 'B':['B0','B1','B2','B3'], 'C':['C0','C1','C2','C3'], 'D':['D0','D1','D2','D3']} df1=pd.DataFrame(data1) data2={'key1':['A0','A1','A1','A2'], 'key2':['A0','A0','A1','A1'], 'B':['B4','B5','B6','B7...
17,239
a4a404a9a7dce4b91233c6b9b263c98919e14096
import pandas #from nltk.classify import NaiveBayesClassifier as NBC from nltk.tokenize import word_tokenize import nltk import json #deals with decoding errors import sys reload(sys) sys.setdefaultencoding('utf8') input = "sad.csv" #dictionary mapping the number of positive tweets that appear in data and the num...
17,240
605d2d380d7917e6960ddd2f24038dee88b3b720
import numpy as np from numpy.testing import assert_allclose from pytest import raises as assert_raises from scipy.optimize import nnls class TestNNLS: def setup_method(self): self.rng = np.random.default_rng(1685225766635251) def test_nnls(self): a = np.arange(25.0).reshape(-1, 5) x ...
17,241
edcf750f07556fc80f7b2be0a7ab76e1458ba1c5
# Test Logging in Python import logging import logging.config logging.config.fileConfig(fname='log.conf', disable_existing_loggers=False) # Get the logger specified in the file logger = logging.getLogger(__name__) def main(): logger.debug('This is a debug message') logger.info('This is an info message') ...
17,242
875f2e9cf5632e3fae3333d2c7ebed21fd8ea0f0
from django.shortcuts import render from django.shortcuts import get_object_or_404 from django.http import HttpResponse from .models import Post,Category import markdown from comments.forms import CommentForm from django.views.generic import ListView,DetailView # Create your views here. # def index(request): # # r...
17,243
c244ac19603e5425c63754a797db8aa21cf57e3a
import phe import torch import numpy as np class KeyMaster(): def __init__(self): self.public, self.private = phe.generate_paillier_keypair(n_length=256) def public_key(self): return self.public def encrypt(self, plain): return self.public.encrypt(float(plain)) def decrypt(s...
17,244
f125c381644bc46c5b7bdc9ca83b6a86f79a9a20
# -*- coding: utf-8 -*- from bs4 import BeautifulSoup import re from scrapy.http import Request from feedback.items import FeedbackItem from scrapy.spiders import CrawlSpider, Rule from scrapy.linkextractors import LinkExtractor from scrapy.selector import Selector class IreSpider(CrawlSpider): name = "test" ...
17,245
bfa65331c0cd219a70e4a195e78d7a28af6af273
# -*- coding: utf-8 -*- """ Manages user's configuration """ import os import configparser from pathlib import Path def rmfriend_dir(): """Returns the directory which will contain the configuration and cache.""" return Path.home() / '.rmfriend' def notebook_cache_director(): """Return the path to the ....
17,246
a5a6bc67e50ff9a463b4298b71e606e27844c3d8
#!/usr/bin/env python import numpy as np import numpy.linalg as la import pycuda.driver as cuda import pycuda.autoinit def vecadd(a, b, c): c[:] = a[:] + b[:] # prepare the kernel from pycuda.compiler import SourceModule mod = SourceModule(""" __global__ void vecadd_gpu(int nx, float *a_gpu, float *b_gpu, float *...
17,247
ce13d01291a80f727cae898a6d50be6909dae3d3
# # See https://github.com/dials/dials/wiki/pytest for documentation on how to # write and run pytest tests, and an overview of the available features. # from __future__ import absolute_import, division, print_function import libtbx.load_env import pytest @pytest.fixture def dials_regression(): '''Return the absol...
17,248
3b428a9036c5f6c63ba4f6aded19a701ab7dd21e
MOCK_USER = { 'username': 'testuser', 'real_name': 'Test User', 'registration_number': 123, 'roles': ['ACCOUNTS', 'EQUIPMENT'], 'email': 'test@user.com', } MOCK_USER_2 = { 'username': 'testuser_2', 'real_name': 'Test User 2', 'registration_number': 124, 'roles': ['ACCOUN...
17,249
9ba20f0afb2d016a133f84af148e55a978239906
import math import time t = time.time() lim = 1000000 def isPrime(num): '''isPrime(int) --> bool''' if (num < 3): if num < 0: num *= -1 elif num == 1: return False elif num == 2: return True if (num % 2 == 0): return False for i in range(3, math.floor(math.sqrt(num)) + 1, 2)...
17,250
dc4e76fbfe6bfeeddb55a5a6ae3eace178b5b28e
""" Class Equipement """ class Equipement: def __init__(self,obj): """ Create an objet Equipement nature_libelle > nature of the equipement ins_nom > name of the equipement ins_numero_install > foreign key of the installation equipement_id > primary key of the equipem...
17,251
1431acd7eaddeaf9bf6caf2cdad81a0e784c5e4b
print(6 + 2) print(10 - 2) print(2 * 4) print(int(48 / 6))
17,252
1672c76bb622bf001cebac2be61190868f66b253
arr1 = (67, 28, 63, 77, 80) arr2 = (62, 35, 70, 75, 63) # input(arr1,arr2) count = len(arr1) i = 0 stList = [] while i < count: if arr1[i] > 60: if arr2[i] > 60: stList.append("S"+str(i+1)) i += 1 print(stList)
17,253
fa81d11c1ce753f5be8ec7125b25fcf768e2d1f7
class Matrix: """General matrix class for Betsy Cannon""" def __init__(self, file = None): self.matrix = [] if file: for row in file: self.matrix.append(map(float, row.split())) def __str__(self): return str(self.matrix) def write_to_file(self, file): for row in self.matrix: file.write(' '.join...
17,254
9fc30a0e0056b38a6ec208e887e52efcd3a714b4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Oct 19 22:14:19 2017 @author: t """ import numpy as np import cv2 #cv2.copyMakeBorder(src, top, bottom, left, right, borderType[, dst[, value]]) → dst file_path = os.path.join('/home','t','git','Snapsolve','TrainingSetGeneration','generatedpics','open...
17,255
8cd2155975dcb66ac89ac7ac3b26ba600cd5afd4
import sys from setuptools import find_packages, setup install_requires = [ 'numpy>=1.11.1', 'pyyaml', 'six', 'addict', 'requests', 'opencv-python' ] if sys.version_info < (3, 3): install_requires.append('backports.shutil_get_terminal_size') if sys.version_info < (3, 4): install_requires.extend(['enum34', ...
17,256
d332cf90acc3a73bdf6f2d643e02787976159f98
import os import numpy as np import librosa import matplotlib.pyplot as plt import pickle def onset_times(sound, sampling_rate): ''' input : sound - 1D array song sampling_rate - sampling_rate return : 1D array onset sequences (seconds) ''' return libros...
17,257
a85712134472c9375c850239feb05514983912ea
import numpy as np from scipy.signal import convolve2d import matplotlib.pyplot as plt # Generate original image img = np.zeros([16, 16]) img[4:12, 4:12] = 255 # Define filters filters = [ np.array([[1, 1, 1], [0, 1, 1], [0, 0, 1]]), np.array([[1, 1, 1], [1, 1, 0], [1, 0, 0]]), np.array([[1, 0...
17,258
38e24bb2d36ccc1a4722146c985681a919f57412
''' Sudoku is a logic-based, combinatorial number-placement puzzle. The objective is to fill a 9×9 grid with digits so that each column, each row, and each of the nine 3×3 subgrids that compose the grid contains all of the digits from 1 to 9. Complete the check_sudoku function to check if the given...
17,259
e5f23bc2c9355afa3df737ce2b2c922917e0745c
# Generated by Django 2.2.7 on 2020-09-26 16:12 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('blog', '0011_auto_20200813_0902'), ] operations = [ migratio...
17,260
882bed3135750bf8e6995dd1c6c0c9621dc3f02a
import torch import numpy as np from sklearn.decomposition import KernelPCA from sklearn.manifold import TSNE from sklearn.cluster import MiniBatchKMeans from preprocess import * from data import * from model import * from torch.utils.data import DataLoader def inference(X, model, batch_size=256): """ 得到encod...
17,261
f1604a263824bdd88309e096b69dc37a5d8610f7
from bs4 import BeautifulSoup from django import forms import phonenumbers def validate_mixed_content(value): """ Validate content to avoid mixed content warnings """ targets = ( {"tag": "img", "attr": "src"}, {"tag": "script", "attr": "src"}, {"tag": "iframe", "attr": "src"},...
17,262
41d8b87315ed6cd8388127dc4a7261cd18261362
# -*- coding: utf-8 -*- """ Using SQLAlchemy and Flask get db record.(GET) """ from flask import Flask, render_template, abort from flaski.models import WikiContent app = Flask(__name__) app.config['DEBUG'] = True # 起動されたサーバーの/にアクセスした時の挙動を記述。 # @app.route("/hoge")で記述すれば、http://127.0.0.1:5000/aaでアクセスした時の挙動を記述できる。 @...
17,263
bdf0b92d5b8ff762f8af4cbbebf0296a9c92dc62
class Solution(object): count = 0 def uniquePaths(self, m, n): """ :type m: int :type n: int :rtype: int """ # using dictionary to represent matrix d = {} # initialize the first row to 1 for i in range(m): d[(i,0)] = 1 ...
17,264
9f57ceb5cc7a0fb6af243f0c01b4b9cea9686e3b
# for i in range(12): #rows # for j in range(0,i): #star # print("*",end=" ") # print() #nextrowil pokaan # for i in range(12,0 ,-1): # for j in range(0,i): # print("*", end=" ") # print() #1 #2 3 #4 5 6 #7 8 9 10 # def pattern(n): # count=1 # for i in range(n): # ...
17,265
fef3d36020e9c9a01e24e45885ba0cbd02345fc1
from django.test import TestCase from .models import HealthData,Person from django.contrib.auth.models import User from django.urls import reverse class UserTestCase(TestCase): def create_user(self,username="guest",password="1DS8ylMMP"): u = User.objects.create(username=username,password=password) ...
17,266
279bf0fb43c134902f5c9ef050f5654422ca3f8f
""" Loops for and while Range """ # print(list(range(2,10, 1))) for i in range(1,31, 1): if (i%3 == 0 and i%5 == 0): print("FIZZ_BUZZ") elif (i%3 == 0): print("FIZZ") elif (i%5 == 0): print("FUZZ") else: print(i) # Not printing a new line after print command ...
17,267
52f6b6c5d2b12af2496705c675c8e35d3b66d594
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. from odoo import fields, models class ProductTemplate(models.Model): _inherit = 'product.template' # agora_sync = fields.Boolean(string='Synchronize with Agora')
17,268
797b2ac7331755e582e110b037f11f8ba4a9c3d9
# -*- coding: utf-8 -*- # Generated by Django 1.11 on 2018-03-14 20:29 from __future__ import unicode_literals from django.db import migrations, models import django.utils.timezone class Migration(migrations.Migration): dependencies = [ ('gatheros_event', '0008_auto_20180306_1024'), ] operation...
17,269
8229f74670bf13b908e78908395b0659925cc11f
import numpy as np from sklearn.ensemble import RandomForestClassifier as SKRandomForestClassifier from sklearn.feature_selection import SelectFromModel as SkSelect from skopt.space import Real from .feature_selector import FeatureSelector class RFClassifierSelectFromModel(FeatureSelector): """Selects top featur...
17,270
028cc099b91cba75bd8a43e4237258e3a1ac614b
from flask_wtf import FlaskForm from wtforms import StringField, PasswordField, BooleanField, SubmitField, TextAreaField from wtforms.validators import DataRequired, Length class LoginForm(FlaskForm): username = StringField('Username', validators=[DataRequired(), Length(5, 20)]) password = PasswordField('Passw...
17,271
2d57b3c5645c84dcd4d1fdb88efb7e55abc34230
from skbio.draw import boxplots fig = boxplots([[2, 2, 1, 3, 4, 4.2, 7], [0, -1, 4, 5, 6, 7]])
17,272
bc380ee3a39b04dd558a71920f61cc2ef9cf8b3b
# Make a list that includes at least three people you # would like to invite to dinner. # Then use your list to print a message to each person, # inviting them to dinner. idol_guest_list = ["arnold schwarzenegger", "babe ruth", "sean connery"] invitation = f"Mr. {idol_guest_list[0].title()}, " \ ...
17,273
771f80a8e54aa80f60754bd1a4ff13091794f664
# -*- coding: utf-8 -*- # Generated by Django 1.9.1 on 2016-02-05 10:15 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('blog', '0009_tag_description'), ] operations = [ migrations.AlterField( ...
17,274
1ed9280f9b103cc2f126aa287c633b5300f0e193
# python3 class BuildHeap: def __init__(self): self.swaps = [] self.data = [] self.size = 0 def reading(self): n = int(input()) self.data = list(map(int, input().split())) self.size = len(self.data) - 1 assert len(self.data) == n def printing(self...
17,275
4431c11bd1082e553382dae4c6586136915bc0c6
# -*- coding: utf-8 -*- # Generated by Django 1.11 on 2018-11-16 07:48 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('supporting_business', '0016_auto_20181109_1921'), ] ...
17,276
e62654b95574c88e3e4ace157a842c3e63e20378
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Oct 4 17:37:19 2018 @author: son """ import numpy as np import matplotlib.pylab as plt def numerical_diff(f, x): h = 1e-4 return ((f(x+h) - f(x-h))/ (2*h)) def origin_numerical_diff(f, x): h = 1e-4 return ((f(x+h) - f(x))/ (h)) def n...
17,277
83ac2b1258df8c46333f7d7a933eb58eebdc0435
# -*- coding: utf-8 -*- from pyfr.integrators.dual.base import BaseDualIntegrator class BaseDualPseudoStepper(BaseDualIntegrator): def collect_stats(self, stats): super().collect_stats(stats) # Total number of RHS evaluations stats.set('solver-time-integrator', 'nfevals', self._stepper_n...
17,278
31b0ed8c56d1b8c773c74b8614f72a9d1d6b6995
#!/usr/bin/env python # Bkgd configuration file for limit-setting produced with makeANTables.py backgrounds = { 'Fake2016DEFGH' : { 'N' : '1634', 'alpha' : '0.000558720822988', }, 'Elec2016DEFGH' : { 'N' : '32', 'alpha' : '0.0493887359699', }, 'Muon2016DEFGH' : { ...
17,279
a1ed716a95bf6a731d82146e37629255e141ec92
# Generated by Django 3.0.8 on 2020-07-29 21:28 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('iot', '0003_iotdevice_circuit'), ] operations = [ migrations.CreateModel( name='Access', ...
17,280
02301920f1023c58a0ed0210cbfc9848d87771c5
from decimal import Decimal import os import tempfile from django.core.urlresolvers import reverse from django.test import Client, TestCase from importer.models import ImportLog, ExpenseItem from importer.tests.test_data import load_test_data class BaseTestCase(TestCase): def send_file_upload_request(self, view...
17,281
7b44e26378874e2693cb089ea1812329b030155d
#!/usr/bin/env python3 s = input() num1Bits = s.count( '1' ) if num1Bits % 2 == 0: print( '{}{}'.format( s, 0 ) ) else: print( '{}{}'.format( s, 1 ) )
17,282
5d00ae2596535a19af8a2b975842f1d0ef030a32
""" Holds system wide configuration options. """ from .constants import * import os """"The preferences below are used as defaults if none of the configuration files exist. Being defaults, they have the lowest priority of the importing procedure.""" # Whether or not to try to obtain an OpenGL context supporting mult...
17,283
a44b17b58f6e8d2138c1c0bf597a00a9a4bdc8a7
from django.contrib import admin from reviews.models import Review # Register your models here. admin.site.register(Review)
17,284
86130202098124fa80c28620003839f7630e0d13
# (c) 2022 Amazon Web Services, Inc. or its affiliates. All Rights Reserved. # This AWS Content is provided subject to the terms of the AWS Customer # Agreement available at https://aws.amazon.com/agreement or other written # agreement between Customer and Amazon Web Services, Inc. import json import os import boto3 ...
17,285
fd8cc4d5ea4ea61413fd2414a975b3cb2b338fc6
""" Starting with 1 and spiralling anticlockwise in the following way, a square spiral with side length 7 is formed. 37 36 35 34 33 32 31 38 17 16 15 14 13 30 39 18 5 4 3 12 29 40 19 6 1 2 11 28 41 20 7 8 9 10 27 42 21 22 23 24 25 26 43 44 45 46 47 48 49 It is interesting to note that the odd squares lie a...
17,286
60964a4000c29b932e81067288e1fb6c02e198a5
""" SConnectForm.py Form to connect to slack """ import npyscreen class SConnectForm(npyscreen.Form): def create(self): self.name = "Login to Slack" # cs = self.add(npyscreen.BoxBasic, name="Connect to Slack") self.add(npyscreen.TitleText, name="Login:") self.add(npyscreen.TitleP...
17,287
6b51ccf8a0244db3ce07b523e670653b31d516e2
# Copyright 2023 The Google Earth Engine Community Authors # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
17,288
d5b568cbb1fb6a127777364329ddf5cb9a501d48
from location import Location from messages import Message class EnterMineAndDigForNugget: @staticmethod def enter(miner): if miner.location != Location.GOLDMINE: miner.say('Walking to the goldmine.') miner.change_location(Location.GOLDMINE) @staticmethod def execute(min...
17,289
c1e05ed6e78ea47b790e9e16a939a9bd900b50d2
''' Kruskal: relative importance analysis ''' ''' load modules ''' import numpy as np import itertools from math import factorial from numpy import matrix, linalg ''' function to calculate R2 for a subset of the matrix ''' def calcR2(varlist, rmatrix): #only include variables in the list workmat ...
17,290
e79f75ea932bfe4b46c464e11aa1a45e6430a2d0
import statsmodels.formula.api as smf import pandas as pd import numpy as np def vif_cal(data, y): """ Code for VIF Calculation. Writing a function to calculate the VIF values """ x_vars=data.drop([y], axis=1) xvar_names=x_vars.columns.tolist() x_var_col, vif_list = [], [] str_gap = max([len(c...
17,291
59482cc6b3cb121db48d312b68e4ffd57c060a94
# -*- coding: utf-8 -*- import numpy as np import scipy as sp import pandas as pd def walmart_prepare(df): def convert_weekday(day): '''Function to convert weekday char strings to numeric''' if day == 'Sunday': return 0 elif day == 'Monday': return 1 elif day == 'Tuesday': return 2 elif day ==...
17,292
08383e9eda198667c2f724a3e52524e1a7bb07a5
version https://git-lfs.github.com/spec/v1 oid sha256:fc918f6634c335750e0a2d303e13d21c5fe6aaf1dd905e7789e94e95aad2da0e size 32096
17,293
330941793ae02d3fb07c53b642d4957806873133
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters from telegram import ChatAction def start(bot, update): update.message.reply_text("""Hi, here you have the actions you can perform: 1. /showTasks 2. /newTask 3. /removeTask 4. /removeAllTasks""") def show(bot, update): ...
17,294
37065a5101702dfe65c609f7071f4b3cc613f1a0
#!/usr/bin/env python import unittest import nbconvert import os import numpy as np with open("assignment8.ipynb") as f: exporter = nbconvert.PythonExporter() python_file, _ = exporter.from_file(f) with open("assignment8.py", "w") as f: f.write(python_file) from assignment8 import KozenyCarmen class...
17,295
0864a0a4e493296928b450d79afe787ce92efad5
# 2015.11.18 11:51:45 Střední Evropa (běžný čas) # Embedded file name: scripts/client/gui/gold_fish.py from account_helpers.AccountSettings import AccountSettings, GOLD_FISH_LAST_SHOW_TIME import constants from gui import GUI_SETTINGS from helpers.time_utils import getCurrentTimestamp def isGoldFishActionActive(): ...
17,296
e5255911768a8c024196650e93933ffa9e9904af
from django.apps import AppConfig class TiendamascotasConfig(AppConfig): name = 'tiendaMascotas'
17,297
41e2ff99d249f1c12553f6bc9b82218182112d62
# coding=UTF-8 from __future__ import print_function, absolute_import, division import logging import typing as tp from coolamqp.framing.definitions import ConnectionUnblocked, ConnectionBlocked from coolamqp.objects import Callable from coolamqp.uplink import Connection from coolamqp.uplink.connection import MethodW...
17,298
5214b49f38aae73d0cbd1459197e9d13dae511c1
from font import Font, FontLoader from textdrawer import TextDrawer def getText(): return 'Git' text = getText() font = FontLoader().loadFont('fancyFont/') drawer = TextDrawer() drawer.setFont(font) drawer.draw(text)
17,299
30b0176251618513cb675aa1145d8043d28f158f
import json from get_urltrain import d import urllib from urllib import request import requests from pprint import pprint from get_urltrain import url from prettytable import PrettyTable from colour_set import colored r = requests.get(url, verify=False) #请求网址1的内容 # rows = r.json()['data']['datas'] #将内容解析为列表 # r...