index
int64
0
1,000k
blob_id
stringlengths
40
40
code
stringlengths
7
10.4M
996,600
aef70dd9254cc2f0299e9d9839f4ea58a3b3e567
#!/usr/bin/env python3 def thousand(): """Felsorolja és összeadja az 1000nél kisebb inteket Amennyiben azok a három vagy az ötnek a töbszörösei""" return sum([x for x in range(1000) if x%3==0 or x%5==0]) def main(): print(thousand()) if __name__ == "__main__": main()
996,601
2e24ccb931af1c73693b458ce482344a623d878d
#varsha import pickle import matplotlib.pyplot as plt import os from collections import OrderedDict import numpy as np from matplotlib.backends.backend_pdf import PdfPages import matplotlib.backends.backend_pdf path = 'C:\\Users\\supraja\\source\\repos\\DjangoWebProject1\\DjangoWebProject1\\pyt_Files\\pdf_Files\\' #p...
996,602
4f323c60076efad3bab64d1014bd0b25f1c6de66
""" @author : Qizhi He @ PNNL (qizhi.he@pnnl.gov) """ import tensorflow as tf def tf_session(): # tf session config = tf.ConfigProto(allow_soft_placement=True, log_device_placement=True) config.gpu_options.force_gpu_compatible = True sess = tf.Session(config=config) ...
996,603
68a3852931be1e7ac61ce78d691375956501c4dd
number1 = int(input("Enter a number: ")) number2 = int(input("Enter a number: ")) number3 = int(input("Enter a number: ")) #if number1 > number2 and number2 > number3: # print ("True") #else: # print ("False") print (number1 > number2 and number2 > number3)
996,604
66d603505ac88b8236d37d33097f5c0cbbe2f211
from abc import ABCMeta, abstractmethod from typing import List from app.Dto.AircraftDto import * from app.Dto.SelectDto import SelectAircraftDto from app.repositories.AircraftRepository import AircraftRepository class AircraftManagementService(metaclass=ABCMeta): @abstractmethod def register_aircraft(self, ...
996,605
e73fe66d2ef184264e5df81e61a6bcdfb076d315
import unittest import os from glob import glob from nose_parameterized import parameterized from ruamel.yaml import load import six from pyacd.parser import parse_acd ACDTEST_DIR = '/usr/share/EMBOSS/acd' def get_acds_list(): tests = [] acd_list = glob(ACDTEST_DIR+'/*.acd') for acd_path in acd_list: ...
996,606
f977a02ac5fc7677d8097528c2ebdf166af28e99
#! /usr/bin/python # -*- coding: utf-8 -*- # # Copyright (C) 2011-2014, International Business Machines # Corporation and others. All Rights Reserved. # # file name: dependencies.py # # created on: 2011may26 """Reader module for dependency data for the ICU dependency tester. Reads dependencies.txt and makes the data ...
996,607
41cf51bc638c11e8acccb02ccf8191aaaeedc0ef
# Generated by Django 3.1.5 on 2021-01-17 18:27 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ('vocabulary', '0001_initial'), ] operations = [ migrations.CreateModel( name...
996,608
9b141ccb469e289f82a7f89eb4683665b966b13a
import json import os import pytest import time import numpy as np import pandas as pd from pandas.util.testing import assert_frame_equal import ips.steps.air_miles import ips.steps.final_weight import ips.steps.imbalance_weight import ips.steps.minimums_weight import ips.steps.non_response_weight import ips.steps.ra...
996,609
2631daeb2b4b44426fcfef5fd4c472595a0e6618
import sublime import sublime_plugin def plugin_loaded(): value = get_setting() sublime.log_input(value); sublime.log_commands(value); sublime.log_result_regex(value); def get_setting(): preferences = sublime.load_settings("Preferences.sublime-settings") result = preferences.get("debug") ...
996,610
bc78a599175873a1e017b783adec333ee360d9ad
#!/usr/bin/python3 # -*- coding: utf-8 -*- ''' Created by Tan.Xing Created date: 2019/01/03 Last edited: 2019/01/03 ''' import sys from PyQt5.QtWidgets import QApplication from UI.UiController import windowController from Widget.SafeCloseWindow import SafeCloseMainWindow if __name__ == '__main__': app = QApplica...
996,611
1f78f469b32e45726326cb95b14d4a383c5e5d68
# Imports from sklearn import svm import sklearn.cross_validation as cv from sklearn.grid_search import GridSearchCV from sklearn.cross_validation import train_test_split from sklearn.cross_validation import StratifiedKFold from sklearn.metrics import classification_report from sklearn.decomposition import PCA import ...
996,612
6b4486f2001da41dff99e9e480f214c0fe61a093
import os import menu import post import sml import template def get_posts(posts_src_dir): post_filenames = [fn for fn in os.listdir(posts_src_dir) if fn.endswith('.post')] for post_filename in post_filenames: post_path = os.path.join(posts_src_dir, post_filename) yield post.from_file( ...
996,613
02ea7223d5ff84b3b3235ab27789f18d8af1d73e
from sqlalchemy import Boolean, Column, Integer, String, Enum from database import Base from schemas import Role class User(Base): __tablename__ = "users" id = Column(Integer, primary_key=True, index=True) email = Column(String, unique=True, index=True) username = Column(String, unique=True, index=T...
996,614
827b0f9551ae9bd2244b0c77a29222f0030d7122
import os, sys import pickle import random import numpy as np from PIL import Image import torch from torch.utils.data import * from . import skeleton # import skeleton from .dataset_utils import * # from dataset_utils import * class Human36m(Dataset): def __init__(self, root_dir, modality, re...
996,615
c5b514866a5b73a46d5b49819a52c75bfd26a92f
a = "All" b = " work" c = " and" d = " no" e = " play" f = " makes" g = " Jack" h = " a" i = " dull" j = " boy" print (a+b+c+d+e+f+g+h+i+j) print(6 *(1 -2)) # ah lekker bier bruce = 6 print(bruce + 4) x = str(51 % 24 +2) y = " uur" print(x+y) response = input(100) #principal amount
996,616
4d10af56cb39939c35f8e813c6f8e13c13fecbdc
from django.db import models class Propiedad(models.Model): name = models.CharField(max_length=50) address = models.CharField(max_length=100) square_meters = models.PositiveSmallIntegerField() email = models.EmailField(max_length=50)
996,617
0315e63470993b4158d5549358ccd318b7888609
""" 1. Create an empty stack called op_stack for keeping operators. Create an empty list for output. 2. Convert the input infix string to a list by using the string method split. 3. Scan the token list from left to right. • If the token is an operand, append it to the end of the output list. • If the token is a left pa...
996,618
06cf5d30837cdf38998ed15acb4cef488067d374
import xlsxwriter current_row = 2 NAME_COLUMN = "A" LAT_COLUMN = "B" LNG_COLUMN = "C" workbook = xlsxwriter.Workbook("data/Kommuners_Koordinater.xlsx", { 'constant_memory': True }) worksheet = workbook.add_worksheet() worksheet.write(f"{NAME_COLUMN}1", "name") worksheet.write(f"{LAT_COLUMN}1", "lat") worksheet.w...
996,619
267978e5da11b40fb499e2f0b7380464ad0c913d
from rest_framework.authtoken.models import Token from rest_framework.permissions import IsAuthenticated from rest_framework.response import Response from rest_framework.views import APIView __all__ = ['TokenRetrieveView'] class TokenRetrieveView(APIView): permission_classes = (IsAuthenticated,) def get(s...
996,620
6ca98192b617b61dd797b94249962982ccc02462
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import unittest from lib import executeTestCase from lib import runner,utils from lib.launcher import * from lib.dde_dock import * result = True casename = 'all-3356:有道词典开启与关闭' class YoudaoDict(unittest.TestCase): caseid = '83365' @classmethod def setUpClas...
996,621
4f7f54cb55839c1bc49ee56f30392466cda76d66
import re import spotipy from spotipy.oauth2 import SpotifyClientCredentials from spotipy.oauth2 import SpotifyOauthError from playlist.config import settings class SpotifyService: def __init__(self): try: self.spotify = spotipy.Spotify( client_credentials_manager=SpotifyClie...
996,622
baf8f7758323942a41cc0dd00eff91a92f13d5eb
resposta = input('Você deseja adicionar mais nomes a competição?') dic={} menor = 10000000000 while resposta != 'sair': if resposta != 'sair': a = float(input('Qual a aceleração de cada corredor?')) dic[resposta] = a resposta = input('Você deseja adicionar mais nomes a competição?') tempo = calc...
996,623
9165e36a9add2486e92aec2aa099ac845c7545c6
#! python3 __author__ = 'KattStof' #Bombur.py - a simple email/sms/facebook bombing script # One Script to rule them all from colorama import Fore, init import smtplib, getpass, time from fbchat import Client from fbchat.models import * from GSMS import GSMS init(convert=True) print( Fore.YELLOW + """ _______ ____...
996,624
898d3689c35a436292b27c69bbaa322b2bb46a61
from flask import Blueprint from flask import current_app as app # Blueprint Configuration home_bp = Blueprint( 'home_bp', __name__, template_folder='templates', static_folder='static' )
996,625
107d6c0bed3c2c803a8f7c0c9db32261b030dd2d
""" Some API handling code. """ import requests import syndicate import syndicate.data from syndicate.adapters.sync import HeaderAuth from syndicate.client import ResponseError xmldecode = syndicate.data.serializers['xml'].decode # CRAZY DEBUG XXX def debug(): try: import http.client as http_client ...
996,626
96fb07f82627a2b93adcfdebce2126af1eaa0aa6
import datetime #from profile import profile from flask import Flask, render_template, url_for app = Flask(__name__) @app.route('/') def home_page(): year = datetime.datetime.now().year return render_template('./index.html', year=year, profile=profile) @app.route('/<username>/<int:post_id>') def user_page(use...
996,627
7faa7a5087132c3f06f4ad01fe94bc31f77e6725
# -*- coding: utf-8 -*- # Generated by Django 1.11.3 on 2018-07-10 08:27 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('app', '0003_auto_20180703_1830'), ] operations = [ migrations.AddField( ...
996,628
b575505bea22bded6e7e9d47ed4d702eecf78b75
# Python viewing to see the Mendocino stations # Step 1: Determine the stations in the radius. # Step 2: Read them in. Make a list of timeseries objects in one large dataobject. # Step 3: Compute: Remove outliers and earthquakes. Then identify # Step 4: Produce a table and plot of accelerations before/after time ra...
996,629
d2a8fae8f451b4e16ee721bd70900ea4872d341a
#!/usr/bin/env python # -*- coding: utf-8 -*- ######################################################################## # # Script to rotate a dihedral angle in a molecule # ######################################################################### import ff_gen.IOmod as IOmod import molsys.stow as stow import chemcoo...
996,630
1ed67b19ff7a0f17feac3bea0b7a9e25a79a4c99
from environment import World from creature import Cell from random import randint, choice def main(): env = World(10, 10) creatures = list() env.replenish(20) env.display() num_creatures = 10 for i in range(0, num_creatures): x, y = env.random_location() creatures.append(C...
996,631
446f10b33142cd84c1384efa89e899efbd0b9b13
from flask import ( Blueprint, flash, g, redirect, render_template, request, url_for ) from werkzeug.exceptions import abort from flaskr.auth import login_required from flaskr.db import get_db bp = Blueprint('blog', __name__) @bp.route('/', methods=['GET', 'POST']) def index(): db = get_db() posts = db...
996,632
49ca55fbdfc7fea819956c3510d49654bbb5078d
from parser import * from matrix import * screen = new_screen() color = [0, 0, 0] edges = [] transform = new_matrix() parse_file('script2', edges, transform, screen, color)
996,633
53cb967d01fbaf4ff31ac55641fd7ebd5ed36f53
from django.shortcuts import render from django.http import HttpResponse from appTwo.models import User # Create your views here. def index(request): return render(request, 'appTwo/index.html', context={}) def users(request): users_list = User.objects.order_by('first_name') users_dict = {'users_info': use...
996,634
cc24cf26e1006c4ea0b3381237a701b978fd8f12
#!/usr/bin/env jython import arthur.Data as Data import arthur.EmUtil as Util import arthur.EDML as EDML import arthur.ExpectationMaximizationMap as EM import arthur.ExpectationMaximizationMapAlt as EMALT import il2.model.BayesianNetwork as BN import il2.model.Domain as Domain import il2.model.Table as Table import il...
996,635
f0c7521041c79ec8d5d6d121f3f7c020088cc182
list = [3, 7, -2, 12] max(list) - min(list)
996,636
509bfa243b6fb7dc44ea01d3d37edde414891a9c
""" Draw bezier curve for a given set of points using the recursive de Castlejau algorithm. Implemented using PyQt4 """ import sys from PyQt4.QtGui import * from PyQt4.QtCore import * INT_MAX = 100000 NEARNESS_THRESHOLD = 10 NUM_T_VALUES = 2000 class BezierWindow(QWidget): def __init__(self, t_values=100): ...
996,637
8ac19451b67b894c235d9141de592b30b4fd96f1
from activitylog import * from datetime import datetime from datetime import date def createDB(): db.create_tables([Person, ActivityType, Activity, MeasurementType, Measurement, Location]) def defaultActivities(): root = ActivityType.create(name="BaseActivityType", is_abstract=True) mindful = ActivityType...
996,638
6476dc4aede72f4e11ceb54868a4b4e1f3926d5c
import sys def write_items(items, num): with open(str(num).zfill(2) + '_forumpage.txt', 'w') as f2: f2.write('\n'.join(items)) def main(): assert len(sys.argv) == 3 items = set() num = int(sys.argv[2]) with open(sys.argv[1], 'r') as f: for line in f: line = line.strip...
996,639
36b0db8a803e78ecbaef4ac0b05f1536b0c70720
""" This module will test the status command """ import time from controller.app import Configuration from tests import ( Capture, create_project, exec_command, execute_outside, init_project, pull_images, start_project, start_registry, ) def test_all(capfd: Capture) -> None: execu...
996,640
7001ab8bfd7d64f19cc9fe909689bd4ce91d7bb4
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('shares', '0014_auto_20151113_0916'), ] operations = [ migrations.CreateModel( name='Correlation', fi...
996,641
8b08bec8be01016f964716e433aa6cdccdca3def
""" This is a companion to my [previous challenge](https://edabit.com/challenge/mZqMnS3FsL2MPyFMg). Given an English description of an integer in the range **0 to 999** , devise a function that returns the integer in numeric form. ### Examples eng2nums("four") ➞ 4 eng2nums("forty") ➞ 40 eng...
996,642
1a4e5666dad3913bc491cf2f8ac804eb3471890e
import os def print_file(filename): print("\n" + filename) print("=" * len(filename)) with open(filename, "r") as f: lineno = 1 for line in f.readlines(): print(f"{lineno:03} : {line}", end='') lineno += 1 for (dirname, dirs, files) in os.walk(r"e:\classroom\python\jan27\demo")...
996,643
8e70e69e5a271c76bfb9c722e25aa8c337f27c86
from typing import List """ Dynamic Programming if a%b==0 and c%b==0, then c%a==0 Sort the nums and keep track of all nums before index i which meet the condition: nums[i]%nums[i-n]==0. """ class Solution: def largestDivisibleSubset(self, nums: List[int]) -> List[int]: if not nums: return [] ...
996,644
9165d511a6659e3c6e7eb8094801b8e365e6e64a
""" Abstract class module for unified """ from abc import abstractmethod from lead2gold.motif.motif import Motif class Tool(): """Base abstract class for known tools and required functions """ def __init__(self, toolName): """Initialize all class attributes with their default values. """ self.toolName = to...
996,645
302459c5be3f70081bb28be495b7605e54672f66
#!/usr/bin/env python import os.path, sys, argparse sys.path.append(os.path.split(__file__)[0]+os.sep+'..') from inter import * # ------------------------------------------------------------------------------- # Comamnd line parsing # ------------------------------------------------------------------------------- de...
996,646
0c54bbc7d7f2cbca2b790ce3b6145c118136d077
def GetTranslatedText(tag, languageCode): # establish database connection import database import pyodbc connectionString = database.GetConnectionString() conn = pyodbc.connect(connectionString) #rowsAffected = 0 # problems getting rows affected from MS SQL... try: # create...
996,647
89669610d822e1d2753e0da5fad8cd767264ff3d
# from keras.models import load_model # # load the model # model = load_model('facenet_keras.h5') # # summarize input and output shape # print(model.inputs) # print(model.outputs) # function for face detection with mtcnn from PIL import Image from numpy import asarray from mtcnn.mtcnn import MTCNN # extract a single ...
996,648
6899645de75426f47a97c2e9ef5aab81e61218e3
/home/vinay/anaconda3/lib/python3.7/warnings.py
996,649
e65a11a661ca0009e21bc49c121cfef9ebb2343e
import sys MAPPING = { '1': { '1': ('1', 1), 'i': ('i', 1), 'j': ('j', 1), 'k': ('k', 1), }, 'i': { '1': ('i', 1), 'i': ('1', -1), 'j': ('k', 1), 'k': ('j', -1), }, 'j': { '1': ('j', 1), 'i': ('k', -1), 'j': ('1', -1), 'k': ('i', 1), }, 'k': { '1': ('k', 1), 'i': ('j', 1), 'j': ('i...
996,650
5b7ab0d3df7f2b9ede5cd14add2a049d991efc43
import cv2 import matplotlib.pyplot as plt #importazione delle librerie necessarie import numpy as np import math def houghSpace(im): maxTheta = 180 #la larghezza dello spazio corrisponde alla massima angolatura presa in considerazione houghMatrixCols = maxTheta #dimensioni dell'immagine original...
996,651
192bfc7adeb2d55c013a8f5d146d9987ed50f339
# displayMenu: # displays a menu with options # DO NOT MODIFY THIS FUNCTION import Library as Library if __name__ == "__main__": def display_menu(): print("Select a numerical option:") print("======Main Menu=====") print("1. Read book file") print("2. Read user file") print...
996,652
385d1513724f5e99a6f37494992bea51312d3b6e
#!/usr/bin/env python from PyQt4 import QtGui from PyQt4 import QtCore from led_classes import * from db_classes import * import time class Example(QtGui.QWidget): def __init__(self): super(Example, self).__init__() self.stop = False self.running = False self.initUI() def initUI(self): QtGui....
996,653
fbd2d974710072e52df10632a3269024c5b4656c
"""@package tester @brief Framework extension for Unittest. @copyright Copyright (c) 2017 Marcel H MIT License Copyright (c) 2017 mh0401 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 ...
996,654
8ccf71ce180183ed0492b5303d58dc82a083ab58
import math year = input() holidays = int(input()) weekends = int(input()) saturday_games = (48 - weekends) * 3 / 4 holiday_games = holidays * 2 / 3 total_games = saturday_games + holiday_games + weekends if year == 'leap': total_games += total_games * 0.15 print(math.floor(total_games))
996,655
1eec293476a3c91c3a237f3f4a19826a1790863c
import imaplib, email class IMAPWrapper: """ Class to connect to imap server login and extracting emails between two given dates """ def __init__(self,username,password): try: self.mail=imaplib.IMAP4('imap.iitb.ac.in',143) self.mail.login(username,password) ...
996,656
7d1673db172b4e80931d8b13f02abb7b0537946c
from django.test import TestCase, SimpleTestCase from .models import CustomUser from django.urls import reverse from .forms import CustomUserChangeForm # Create your tests here. class UserModelCreationlTest(TestCase): def setUp(self): CustomUser.objects.create( username='test_user', full_name='John ...
996,657
1e899668107087045b0890a8cf8f70f27cb696af
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Oct 23rd 2018 @author: lucagaegauf Single epoch of LSTM LSTM structure ---------------------------------------------------------------- Input Layer (x): 1 node LSTM (h, c): 3 hidden states - Forget, input, and output gates: sigmoid activated - Hidden and c...
996,658
e4e9a7a51d642ee79f6d50cb0a9e044d016baa1b
import numpy as np import cv2 import tensorflow as tf class FaceMesh(object): def __init__(self, model_path): self.num_coords = 468 self.x_scale = 192 self.y_scale = 192 self.interpreter = tf.lite.Interpreter(model_path=model_path) self.interpreter.allocate_tensors() ...
996,659
2ca613357bb5166b2efc06ee9a4cdf8127d5734a
#!/usr/bin/env python3 from locale import getpreferredencoding from sys import stderr print("locale:", getpreferredencoding(do_setlocale=True), file=stderr) print('…', file=stderr) print('…')
996,660
688d92a2df25959c6eee5bbaa7e92568232b5b4e
from .confronta_estoque import * from .estoque_na_data import * from .executa_ajuste import * from .edita_estoque import * from .index import * from .item_no_tempo import * from .lista_docs_mov import * from .lista_movs import * from .mostra_estoque import * from .movimenta import * from .posicao_estoque import * from ...
996,661
1e75167a475921d2f1e00dbc8e574ea990dd2606
import requests from bs4 import BeautifulSoup url = "https://en.wikipedia.org/wiki/Seoul_Metropolitan_Subway" resp = requests.get(url) html_src = resp.text soup = BeautifulSoup(html_src, 'html.parser') target_img = soup.find(name='img', attrs={'alt':'Seoul-Metro-2004-20070722.jpg'}) pri...
996,662
32220214d199a4a73096cadc7a03190e17df4c12
def find_digit(a): count=0 a_int=int(a) a_list=[] for i in range(len(a)): a_list.append(int(a[i])) for j in range(len(a_list)): try: if a_int%a_list[j]==0: count+=1 else: continue except ZeroDivisionErr...
996,663
8ace9c931a9cf2cfdae114e2b37b41c0b412ee52
from ExtraccionDatosOanda import ExtraccionOanda from analisis_y_estrategia import analisis_y_estrategia from multiprocessing import Process, Array from ExtraccionDatos10s import extraccion_10s_continua from ContadorEstrategia import ContadorEstrategias from SeguimientoRangos import SeguimientoRangos import time import...
996,664
073ec1ba7edd68ea713a7adcbe29a5cae62cb873
import utility import helper import pickle import numpy as np def load_datasets(path, filenames): X = np.load(path + filenames[0]) Y = np.load(path + filenames[1]) return (X, Y) def test(filename): fp = open(filename, 'rb') data = pickle.load(fp) fp.close() weights = data.get('weig...
996,665
428c989911121f9a1487d29313a57eff4bb21d7a
def add(a, b): print "Passed a=%s and b=%s, returning a+b=%s" % (a,b,a+b) return a + b
996,666
fcec9a84465f521b8b9faeabf794cd88b3ce1907
#!/usr/bin/env python3 string = input('Digite uma string: ') def eh_minuscula1(original): ''' Permite somente letras minúsculas (inclusive com acentuação). ''' for c in original: if not c.islower(): return False return True def eh_minuscula2(original): ''' Permite letras minúsculas (inclusive com acentuação...
996,667
ed36b490b0d637d23d806b09bdde42e9b9d92d19
from collections import UserDict from numbers import Integral class CellSpace(UserDict): """ CellSpace adds 2D slicing and bounds information to dicts of (x,y) coordinate pairs. Notes: CellSpace does not support assigning by slice at this point. Height and width are not absolute measures of how ma...
996,668
8f0584445aa53a4c546787efc74bbc34cc6090be
#!/usr/bin/env python # -*- coding: utf-8 -*- # # temp_LED.py # # Use a thermistor to read temperatures and illuminate # a number of LEDs based upon the returned temperature # # Copyright 2015 Ken Powers # import time, math import RPi.GPIO as GPIO # Set GPIO pins to Broadcom numbering system GPIO.setmode(GPIO.B...
996,669
857af81c95856968d113793b56ad3686b8cc34f5
import csv import pandas as pd import numpy as np import ast from itertools import product from gurobipy import * from network import Network from od_demand_generator import demand_generator from weightedzips import ZipCoords from network import dist from output import write_arcs_to_csv, write_zd_to_csv datapath = "C:...
996,670
3cc6fd8efb4774186682e7cc75418d595b7d696f
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations from django.conf import settings class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('jobpost', '0002_auto_20150825_0115'), ...
996,671
3469776d21a1e64aec486755074d6426f76f4102
leafGIF=""""""
996,672
fcf74e0f7b8ad56e01c934dfcefef7ca618ee41a
"""Tests for group forms.""" # pylint: disable=invalid-name from datetime import datetime from unittest import TestCase from taggit.models import Tag from mock import patch, call from model_mommy import mommy from open_connect.connectmessages.tests import ConnectMessageTestCase from open_connect.groups import forms f...
996,673
d8517c7e95e2211d3dd4eba22f5a477f177fdab0
import glob import os import random import time import numpy as np from PIL import Image import scipy.spatial.distance from sklearn import preprocessing import torch from torch.utils.data import DataLoader from torch.utils.tensorboard import SummaryWriter from torchvision import datasets, transforms from tqdm.notebook...
996,674
f6b0a4d6519c3b488bd967f4ab8a0e36558b1092
"""Extract subject-question-answer triples from 20 Questions game HITs. See ``python extractquestions.py --help`` for more information. """ import collections import json import logging import click from scripts import _utils logger = logging.getLogger(__name__) # main function @click.command( context_sett...
996,675
d6e6c64dc1c42cd694ce2f871d4d7fffcdb5f246
import redis_mover redis_mover.start()
996,676
0be73d1b4ccf305ff2c3af24c7984ec79fa5a9ca
import time from websocket import create_connection import cv2 import numpy as np from collections import deque ws = create_connection("ws://127.0.0.1:1234/") cap = cv2.VideoCapture(0) pts = deque(maxlen=10) Lower_green = np.array([110, 50, 50]) Upper_green = np.array([130, 255, 255]) while True: ret, img = cap.r...
996,677
692184990b7b3cf751260a867a3558d85bd80d53
import yaml,sys,os sys.path.append(os.getcwd()) def get_data(): data_list = [] with open('G/web/Data/login_data.yaml','r',encoding='utf-8') as f: readdata = f.read() data = yaml.load(readdata).get("data") print(data) for i in data: for o in i.keys(): data_list.app...
996,678
e7cda37573525634c2975e52b07ee6491339b895
class Solution(object): def pivotIndex(self, nums): """ :type nums: List[int] :rtype: int """ soln_arr = [] for i, val in enumerate(nums): lsum = self.calcSum(nums, 0, i) rsum = self.calcSum(nums, i+1, len(nums)) if lsum == rs...
996,679
678ef9db58d74fdb9627b1cbd845e58836698e5a
import arcpy import os # A1 AND A2 ZONES - DATA CLEANING # workspace tempgdb = r"C:\Users\rithi\Downloads\Thesis\Workspace\scratch\B2.gdb" # CHANGE gdb = r"C:\Users\rithi\Downloads\Thesis\Workspace\BGI_invest.gdb" arcpy.env.overwriteOutput = True arcpy.env....
996,680
d4d1f6d79cc4dedd4a3c475077bc29c89d140e90
import re import xml.etree.cElementTree as ET import numpy ################################################################################ def readDataBlock(xmlnode): """ Turn any 'DataBlock' XML node into a numpy array of floats """ vmin = float(xmlnode.get('min')) vmax = float(xmlnode.get('max')) ...
996,681
0902a3e01e5d32dcb22507ad8afe6f8d0fb77d6e
from copy import copy import operator import typing from interval_search import binary_search from .._HereditaryStratum import HereditaryStratum from ._detail import HereditaryStratumOrderedStoreBase class HereditaryStratumOrderedStoreList(HereditaryStratumOrderedStoreBase): """Interchangeable backing container...
996,682
1f8d9bcc154ad2e4d0a0929fefca509f781a7e01
from typing import Dict from typing import List from typing import Optional from lxml import etree # TODO: Port to defusedxml to satisfy Bandit # import defusedxml.ElementTree as etree class Soap: """A simple class for building SOAP Requests""" def __init__(self, command): # type: (str) -> None se...
996,683
b690fedb671164352d84ba72fb894315bbd11f54
""" La funcion "crear_mazo_cartas_poker" esta incompleta y necesita ser completada para devolver una lista de diccionarios con todas las cartas disponibles en un mazo de poker. Nota: El ejercicio 041* ya muestra una función similar que puede usarse como ayuda * https://github.com/avdata99/programacion-para-no-progra...
996,684
1a0e318d77c4c5189826dc5ee94ddc6e88fce3cd
from .csv2WKT import Crs2WKT
996,685
1f7c3d10759b1ce5c317e221fb5c5fcc56c57b30
import matplotlib.pyplot as plt import numpy as np import pandas from matplotlib.table import Table #the_table.auto_set_font_size(False) #the_table.set_fontsize(5.5) npop = 8 nc = 12 grid = [[0 for x in range(nc)] for y in range(npop)] def randomgen(high, n): listrand = list(np.random.randint(high, size = n)) ...
996,686
a392264a15162dec84182f5d31137642fe51be1f
# -*- coding: utf-8 -*- from django.http import Http404 from rest_framework.views import APIView from rest_framework import status, permissions from rest_framework.response import Response from api import serializers from api.permissions import IsAuthorOrReadOnly from lbs2 import models # List of orders class Vehicle...
996,687
e16aa22ab171280b0086f8097f8cd08270500ce5
from random import randint, seed from time import time seed(time()) tst = input() print tst for t in range(tst): n, m, k = 100, 5000, 5000 print n, m, k for u in range(2, 101): print u-1, u, randint(1, 1000) for i in range(99, m): u = randint(1, n-1) v, w = randint(u+1, n), ra...
996,688
0ecaab3f4514c2d32e03f3fc14daa46cb48883a8
from facundo import nombre nombre.mostrarNombre()
996,689
cb8c3524c7a5e1bf96e17f91df9017e012808fdd
import sys,urllib.request,re,os if len(sys.argv)!=2: print("Specify an N3 block identifier") sys.exit() dataset=sys.argv[1] with urllib.request.urlopen("http://cmbn-navigator.uio.no/navigator/feeder/all_pyramids/?id="+dataset) as http: page=http.read().decode("utf-8") trs=page.split("</tr>") if len(trs)==1: pri...
996,690
4c1790b8aea07197717f33a5e9396ef6f2215cf9
import config class Cell(object): def __init__(self, pos=-1, value=0, is_starter=False): self.values = [] if value == 0 else [value] self.locked = [] self.pos = pos self.is_starter = is_starter self.candidates = config.PUZZLE_DEF['VALUES'].copy() def get_cell_name(sel...
996,691
715a408e972dcd26ce4643dcd99264b0753052a7
import decimal import graphene from graphene import relay from . import models from graphene.types.scalars import Scalar from graphql.language import ast class Decimal(Scalar): """ The `Decimal` scalar type represents a python Decimal. """ @staticmethod def serialize(dec): if isinstan...
996,692
00b19797edae9351e07910bda41759cbd77b1f85
#!/usr/bin/env python3 # -*- conding:utf8 -*- from flask import abort from flask_restful import Resource, fields, marshal_with, reqparse, inputs from app.api import api, meta_fields from app.extensions import auth from app.models.category import Category as CategoryModel from app.lib.errors import success, ex...
996,693
16fe04acda607dc4e3798ccfcc8e26b6372af664
def mochila(v, p, c, i): if c <= 0 or i == 0: return 0 else: if p[i] > c: return mochila(v, p, c, i-1) else: return max(mochila(v, p, c, i-1), mochila(v, p, c - p[i], i-1) + v[i]) v = [1, 3, 5, 7, 15, 2] p = [5, 2, 10, 8, 10, 8] c = 25 n = len(v) print(mochila(v...
996,694
47c3ba5993fa01391808b7fc95ba9286e5174e25
def find_it(seq): res = {} for i in seq: if res.get(i) == None: res.setdefault(i, 1) else: res[i] += 1 for j in res: if res[j] % 2 != 0: return j print (find_it([1,1,2,-2,5,2,4,4,-1,-2,5])) # def find_it(seq): # for i in seq: # ...
996,695
ed4796aa9e528b076a2604ee485da490c0cc7e2b
# Generated by Django 2.1.5 on 2019-02-04 15:17 import django.db.models.deletion from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("studies", "0001_initial"), ("challenges", "0017_auto_20181214_1256"), ("cases", "0008_auto_20190201_1312"), ...
996,696
a327f0f52ca9570cc50711db28893326d17b6773
import numpy as np from queue import deque class EyeStateManager: SAMPLES_AVERAGED = 5 BLINK_THRESHOLD = 3 CHANGE_THRESHOLD = 3 def __init__(self, choose_label_callback=np.argmax): self.sample_queue = deque(maxlen=self.SAMPLES_AVERAGED) self.last_id = -1 self.blink_count = 0 ...
996,697
c8101ebc443a4a4f0295979ae1f3a7b3594e897c
#!/usr/bin/python import os import sqlite3 import requests def getCookieFromChrome(host='example.webscraping.com'): cookie_path = '/home/hiro/.config/google-chrome/Default/Cookies' sql = ("select host_key, name, encrypted_value from cookies " "where host_key='%s'") % host with sqlite3.connect...
996,698
b20661b10102ff555ed1895e11df0fee6f93d31f
from datetime import datetime def reformatDateString(input): if input is not None and '/' in input: dObj = datetime.strptime(input, '%m/%d/%Y'); return dObj.strftime('%Y-%m-%d') def getTimeObjFromDTString(input): if input is not None and ':' in input and ' ' in input: date_time_parts ...
996,699
ed319626f7ba0158ab37eab8c1b185b5c42e8f99
import pandas as pd import re import logging def badrow(address: str, city: str) -> bool: return city.split('_')[0].lower() not in address.lower() # logging.basicConfig(filename="spotcrime_scrape.log", level=logging.DEBUG, # filemode='a', format='%(asctime)s %(message)s') # define a Handler w...