index
int64
0
1,000k
blob_id
stringlengths
40
40
code
stringlengths
7
10.4M
999,500
09af77947ee6be307b6e10f5dbda5af82f9d3f2e
""" Module with logging utilities """ import vlogging import net.utilities import net.data def log_model_analysis( logger, image, segmentation_image, model, indices_to_colors_map, void_color, colors_to_ignore): """ Log analysis of model's prediction on a single image. Logs input image, ground tr...
999,501
771e8d156f9a2861a36605a4a8cf32c94e8f0f3a
import settings import os import requests def splitlist(list_, number): lists = [] last_number = 0. while last_number < len(list_): new_list = list_[int(last_number):int(last_number + \ (len(list_)/float(number)))] lists.append(new_list) ...
999,502
def410421f34e6d085b2e230df2cd34b9aaf138e
from collections import defaultdict for _ in range(int(input())): num_customers, num_compartments = map(int, input().split()) customer_list = [] for i in range(num_customers): customer_list.append(list(map(int, input().split()))) customer_list.sort(key=lambda x: x[1]) allowed_count = 0 c...
999,503
8fc7cea0bac46ba4e5a4c163ca3959a678e512d0
from sharpie_set import Sharpie_set from sharpie import Sharpie green = Sharpie("green", 0.1) red = Sharpie("red", 0.2) orange = Sharpie("orange", 0.3) new_set = Sharpie_set() green.use() new_set.add(green) new_set.add(red) new_set.add(orange) print(new_set.count_usable())
999,504
50ed0f61e909b1db87d45355b8de3a4446c853a5
import requests from bs4 import BeautifulSoup res = requests.get('https://movie.douban.com/top250?start=0&filter=') soup = BeautifulSoup(res.text,'html.parser') tag = soup.find('div',class_='article') li_all = tag.find_all('li') list_all = [] for key in li_all: tag_url = key.find('a')['href'] tag_order = key....
999,505
294d7e8556e23da77462fece2b0f51c75b5c070d
from django.shortcuts import render, render_to_response, get_object_or_404 from principal.models import Jugador, Pareja, Partido, Pista, Arbitro from django.contrib.auth.models import User from django.http import HttpResponse, HttpResponseRedirect from django.template import RequestContext def inicio(request): return...
999,506
1eebd2e07bb61ecfc3b26b75682f2543288ee5b8
1: 1.1: False 1.2: True 1.3: False 1.4: True 1.5: True '9/15' 2: len(s)*2-len(s)**2 '10/10' 3: 3.1: b 3.2: a 3.3: b '10/15' 4: 1: g 2: h 3: f 4: i 5: c 6: ...
999,507
8eca16b83eddf6d994537c4fb81ef70d263571ae
import json from difflib import get_close_matches # imported data data = json.load(open("data.json")) # translate is not a good function name def translate (w): # functions convert to a lower string always w=w.lower() # conditionals if w in data: return data[w] #condition for input data with ti...
999,508
bcc60d540edd22d75c2189b0b988d276f4984971
#!/usr/bin/env python3 import ast import base64 import argparse from datetime import timedelta import boto3 from psycopg2 import sql from botocore.exceptions import ClientError from use_postgres import UseDatabase def main(): """Connects to Aurora Database, calculates the delta between most recent GROW anom...
999,509
1970cf29aa92b1264925eecefa7c3dd88a4a0d4b
''' Created on 18.06.2009 @author: Lars Vogel ''' def add(a,b): return a+b def addFixedValue(a): y=5 return y+a print( add(1, 2)) print( addFixedValue(3))
999,510
66e0dd72c4ce890095fef48e4b7d421a3585f516
import numpy as np import scipy.ndimage as ndimage import matplotlib.pyplot as plt import cv2 import math from scipy import misc print(int(10.62545))
999,511
ba9fff76e1081767a0c5e22e5ce13dee5c7f5a4b
#!/usr/bin/env python # Mikhail (myke) Kolodin, 2022 # 2022-12-14 2022-12-14 1.0 # prod3max.py # даны случайные числа [-100 .. 100], # найти произведение 3 макс различных чисел from random import randint from math import prod MINVAL = -100 # мин. число MAXVAL = 100 # макс. число LEN = 10 # длина массива...
999,512
e1a5e719133c7e1ffe59008df09f66c1512d92a7
import os import time from pprint import pprint # releaseTime = template_releaseTimeStamp; // template_releaseTime_human # beneficiary = address('template_beneficiarr_address'); # string constant public name = "template_constract_name"; options = [ { "address": "0x18089Cb45906F19889c44c23A86b96062C245...
999,513
704bc480cd14ea62c15d773b862b0a748abb2ad6
from django.shortcuts import render, redirect, get_object_or_404 from django.views.decorators.http import require_POST from django.utils.translation import ugettext_lazy as _, ungettext from django.contrib import messages from django.conf import settings from django.contrib.sitemaps import Sitemap from django.template ...
999,514
d5c73ddae8719281cd49393e7a061a7a9ff7140d
import hampath import sattv """ BioComp.changeMer(30) BioComp.createNodes(7) BioComp.connectNodes(["0->1,3,6", "1->2,3", "2->1,3", "3->2,4,", "4->1,5", "5->2,6"]) # from research paper BioComp.report() """ """ SATTruthValue.changeMer(30) """ # SATTruthValue.createNodes(["`x1,x2,`x3", "x1,x2,~x3", "`x1,x2,x3"]) # SATT...
999,515
40ba05a61f1d93e2d2d45072bea8c5adbf5dd537
from app import create_app import os import sys sys.path.append(os.getcwd()) config_name ='development' app = create_app(config_name) if __name__ == "__main__": app.run()
999,516
a9341c04f99a950153f86b4cbb9517e03929e5b5
import datetime import random from django.contrib import messages from django.shortcuts import render, redirect def index(request): try: request.session['ninja_gold'] except KeyError: request.session['ninja_gold'] = 0 try: request.session['activities'] except KeyError: ...
999,517
2f8f2290d65c97d09aaf7053459dd74e6a7aaa51
# Generated by Django 3.1.13 on 2021-09-13 11:02 import api_img.models import django.core.validators from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Images', ...
999,518
17fa58f664ed99daec39fbe5695765007e0c72da
import os.path import math import numpy as np import conversions as convs def calcs_all(name, lattice, gbdata, pa_parent, dim, proc, k): print('Calculating energy values') path = pa_parent+'/wield/bin' os.chdir(path) os.system('mkdir '+name) Eul1 = gbdata[:,(0,1,2)] Eul2 = gbdata[:,(3,4,5)] xe1 = gbdat...
999,519
4e5f83c98aeebe4171013058c8474cb6152a5407
#!/usr/bin/env python from __future__ import print_function '''Script that checks for differences at a given run number (or at the last IOV) between two Global Tags ''' __author__ = 'Marco Musich' __copyright__ = 'Copyright 2016, CERN CMS' __credits__ = ['Giacomo Govi', 'Salvatore Di Guida'] __license__ = 'Unknown' __...
999,520
130101b3e72a1660df9174487c3d11bbc1d9f33a
""" General Programming Solutions. This module contains answers to the quesions in the General Programming section of the 100 Data Science questions set. """ from collections import defaultdict from itertools import repeat import numpy as np """ 1. Write a function that converts a dictionary of equal length lists ...
999,521
f8940e4926bd2ac6ba29c70bcf349550a86e664d
######################################VPC Details############################################################# import boto3 from prettytable import PrettyTable table = PrettyTable(['Region','VPC Id','VPC Name','VPC CIDR']) REGIONS = [ 'us-east-1', 'eu-west-1', 'ap-northeast-1' ] for region in REGIONS: ...
999,522
81b3e914ce3d692097f1a260c344c0c2fa39994b
""" X is a good number if after rotating each digit individually by 180 degrees, we get a valid number that is different from X. Each digit must be rotated - we cannot choose to leave it alone. A number is valid if each digit remains a digit after rotation. 0, 1, and 8 rotate to themselves; 2 and 5 rotate to each oth...
999,523
e7e99aeabb70d34254a671b9bcda392b9c83ed42
import preprocessing import pandas as pd import numpy as np import matplotlib.pyplot as plt import csv import pickle from sklearn import svm from collections import Counter from sklearn.metrics import accuracy_score from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.feature_extraction.text impo...
999,524
dcc52ce7c0ba1a5e68eaa70ba7ad0d5a46f71de9
from flask import Flask from apis import api_route, TwitApi, UsersApi, UsersTwitsApi from variables import app_secret_key from flask_restful import Api from models import db, Users from passwordhelper import PasswordHelper from twits_blueprint import twits_blueprint from login_blueprint import login_blueprint app = Fl...
999,525
042715071788887b327b75904b9a490130f5c89a
import statistics N = int(input()) AB = [map(int, input().split()) for _ in range(N)] A,B = [list(i) for i in zip(*AB)] if N%2 == 1: low_med = statistics.median(A) high_med = statistics.median(B) print(high_med - low_med +1) else: low_med = statistics.median(A) high_med = statistics.median(B) pr...
999,526
3ba19e2c8ad777e1b79e6b2bced1f6339a5fdd15
print("What is your name?") n = input() print(f"hello, {n}")
999,527
60f84dc802e6e8ec2946ec6a433fbb34955202f6
from django.db import models from django.contrib.auth import get_user_model from .restaurant import Restaurant #from django.db.models.signals import post_save #from django.dispatch import receiver User = get_user_model() class Review(models.Model): class Meta: constraints = [ models.UniqueCo...
999,528
4e95d2b524e842348391cd905a2d7c91fc1cf328
#!/usr/bin/env python #--------------- #RMS 2016 #--------------- #Program to quickly view and filter seismograms, found in the directory structure provided by obspyDMT #User loop of the Seismoviewer program import os import sys import glob import argparse from SeismoViewer import SeismoView import time parse...
999,529
58d3efb0bcc689aaa05211514a980ba2bf3cf990
class AddDigits(object): def addDigits(self, num): """ Problem stste : Given a non-negative integer num, repeatedly add all its digits until the result has only one digit. ( For example:Given num = 38, the process is like: 3 + 8 = 11, 1 + 1 = 2. Since 2 has only one digit, return it. ) ...
999,530
d5e91acea1314e4a34bacc762e78ca527b7e408d
# coding: utf-8 import os.path, sys sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), os.pardir)) from database import Database from article import Article from helper import Helper import csv import pymongo from pymongo import MongoClient import math import threading from probabilistic_model im...
999,531
ab77e28339b1311c05de1242767cff1b326ff7d5
import unittest from tensor import Tensor class TestTensorMethods(unittest.TestCase): def test_Tensor_creation(self): root = Tensor([1], [1]) self.assertIsNone(root.children) self.assertListEqual([1], root.lst) def test_children_Tensor(self): root = Tensor([ 1, 2, 3, 4, ...
999,532
e72172e392eed6b1d981ff095068870c87b3b78c
# Copyright (c) 2014 Universidade Federal Fluminense (UFF) # Copyright (c) 2014 Polytechnic Institute of New York University. # This file is part of noWorkflow. # Please, consult the license terms in the LICENSE file. from __future__ import (absolute_import, print_function, division, unicode_li...
999,533
60efda5e0be9fd8f75e73a275b29003920b59fdb
species( label = 'S(227)(226)', structure = SMILES('C=CC=CC(O)O[O]'), E0 = (-78.6532,'kJ/mol'), modes = [ HarmonicOscillator(frequencies=([492.5,1135,1000,2950,3100,1380,975,1025,1650,1380,1390,370,380,2900,435,2995,3010,3025,975,987.5,1000,1300,1337.5,1375,400,450,500,1630,1655,1680,3615,1277.5...
999,534
7ca2d983cec914d3945f3098f33038474efb211b
import dataclasses import datetime import hashlib import io import json import logging import lzma import os import random import tarfile import tempfile import typing import glci.model logger = logging.getLogger(__name__) dc = dataclasses.dataclass @dc class OCIConfig: pass @dc class OCIContainerCfg: Host...
999,535
458a8a17b6f812d2ab8f93d7d485baaaa8fffaad
# The authentication credentials for using twilio # Dont bothering copying this, its a trial account : ) account_sid = "AC72bf334a5108bf91e562ca51d8154e95" # Change with your twilio account id auth_token = "891df13e81ca64091805aab9b0f86ecf" # Change with your twilio auth token twilio_number = "+12058756630" # Chang...
999,536
73ebe42e10ccef331e9efb9e89306fa0adbdad1b
import dash_html_components as html from utils import Header, make_dash_table, plotgraph1, plotgraph2 import pandas as pd import pathlib def create_layout(app, report_list): rows = [] for ii in range(len(report_list)): # numero de filas elems = [] for jj in range(len(report_list[ii])): ...
999,537
107386fec296434d7329b20e5131890cc210b9c6
import cv2 import time import numpy as np # To save the output in a video form (in format of output.avi) fourcc=cv2.VideoWriter_fourcc(*'XVID') outputFile=cv2.VideoWriter("output.avi",fourcc,20.0,(640,480)) #to start the webcam capture=cv2.VideoCapture(0) # making the cam sleep for 2 secs time.sleep(2) ...
999,538
31560b8de6af6beebb6efe89f31625e90ef6e125
"""Support for the Foursquare (Swarm) API.""" from http import HTTPStatus import logging import requests import voluptuous as vol from homeassistant.components.http import HomeAssistantView from homeassistant.const import CONF_ACCESS_TOKEN from homeassistant.core import HomeAssistant, ServiceCall import homeassistant...
999,539
8ab820e224020b2aa715cec7fc76333a3ab0a9f7
import numpy as np from matplotlib import pyplot as plt import time import cv2 import os from Video_Tools import load_video from Video_Tools import split_vid_into_rgb_channels from Video_Tools import get_video_dimensions from Video_Tools import devide_frame_into_roi_means def normalization(colour_channel_values): ...
999,540
280d453e48661fcfa99846a682dbaa2838037900
import os from PIL import Image import numpy as np from torch.utils.data import Dataset class CustomDataset(Dataset): def __init__(self, X, y, transform=None): random_shuffle = np.random.choice(len(X), len(X), replace=False) self.samples = np.array(X.copy(), dtype='object')[random_shuffle] ...
999,541
effe3755f8696f71055f79ae95136c6063b2506f
API_SERVER = 'localhost'
999,542
57c1a50ba10d933d849f9af214e9d740cdbda406
import math from tools.ConfigFactory import ConfigObject from tools.Exceptions import ParseException def autoconvDecorator(f): def newFunction(self, other): if not isinstance(other, LogNum): other = self.factory(other) return f(self, other) return newFunction NegativeI...
999,543
1d513ded4c4402573070111f95061f0367c693be
vars = { 'chromium_git': 'https://chromium.googlesource.com' } deps = { 'src/buildtools': (Var("chromium_git")) + '/chromium/buildtools.git@0f8e6e4b126ee88137930a0ae4776c4741808740', 'src/tools/gyp': (Var("chromium_git")) + '/external/gyp.git@54b7dfc03f746b6a539ac38f2fb0815d10b54734', 'src/testing/gmo...
999,544
eb1ab740f6c520317a1c097e49f499b09cf18da6
import math import numpy as np fout = open('C:\\Users\\Soheil\\Documents\\Visual Studio 2017\\Projects\\B\\B\\Boutput-small.out', 'w') #fout = open('C:\\Users\\Soheil\\Documents\\Visual Studio 2017\\Projects\\B\\B\\Boutput-large.out', 'w') T=int(input()) for t in range(1,T+1): print(t) N, R, O, Y, ...
999,545
ee860798758ddec08ce4776763af6edc2b9c0bbf
#!/usr/bin/env python # # ----------------------------------------------------------------------------- # Copyright (c) 2016 Indiana University # Copyright (c) 2016 The Regents of the University of California # # This file is part of AEGeAn (http://github.com/BrendelGroup/AEGeAn) and is # licensed under the ISC lic...
999,546
3c22e16f3419c422323f3582399b22baef2bfc40
# Lesson: Python basics # Write some basic Python # a. number = 6 result = 0 result = (number * 2 + 10) / 2 int_result = int(result) print (int_result) print("Du hast " + str(number) + " ausgewählt, das magische Ergebnis ist " + str(int_result) + "!") # b. mail = "willy.wizard@zauberschule.de" name = mail.split("...
999,547
d84fded186ec782e464a46af5cf2ffb9d2a62e4e
import string def is_pangram(s): for letter in string.ascii_lowercase: if letter not in s.lower(): return False return True
999,548
a629765e560135fc903dd521d059d90a131db1e2
# coding=utf-8 from OTLMOW.OTLModel.BaseClasses.AttributeInfo import AttributeInfo from OTLMOW.OTLModel.BaseClasses.OTLAttribuut import OTLAttribuut from OTLMOW.OTLModel.Datatypes.ComplexField import ComplexField from OTLMOW.OTLModel.Datatypes.StringField import StringField # Generated with OTLComplexDatatypeCreator....
999,549
a069a867778063e43ac4f744631967d38a96f9e2
input = """Tile 2141: #.#...#... ###..#...# .....##... ..#.##..#. .#....#..# ...####### .....#...# #.#......# ##........ ########.# Tile 3467: ..#.#....# #.....#..# ....#....# ...#...... #.#....### .#....#..# #......... .....#...# .##...#... ##.#..#.#. Tile 3389: ......##.. .##...#... .#..###... ....##.#.. #..#.#.......
999,550
0cf284f800ad97fd77f9f1746f963315f59f6872
from question9 import Computer, TerminateSequence import copy class Scaffolding(): def __init__(self, input_list): self.path = [] self.spaces_touched = set() self.prev_direction = "" self.input_map = input_list self.ymax = len(self.input_map) self.xmax = len(self.in...
999,551
68c728c251618beccb23436f02968ef6427027ed
from __future__ import unicode_literals from django.apps import AppConfig class CrispyFormsAppConfig(AppConfig): name = 'crispy_forms_app'
999,552
38d94933f21cb0ef28724a1f54b422b07b1b57f6
#!/usr/bin/python from Project.logit import print_to_log # local file from os import system, path # import two functions from platform import system as platform # import platform system as platform from subprocess import Popen, PIPE # needed for built-in terminal from Tkinter import * # need this too class Mai...
999,553
b2139ecb48a81bd8cfa4cfb7ca94e2243c6b386d
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Oct 12 15:54:04 2020 @author: descentis """ import numpy as np import matplotlib.pyplot as plt # Make a fake dataset height = [46, 93.25, 93.60, 95.02, 95.38] bars = (r'$k = 2$', r'$k = \sqrt{n\left(\dfrac{m-d}{m+d}\right)}$', r'$C = n^2$', r'$k = 10...
999,554
33caaf13069e63a36e76264357d916dec6c06b54
a=eval(input("enter the number")) rev=0 while(a>0): d=a%10 rev=rev*10+d a=a//10 print(rev)
999,555
279c777c96e4e2bab82c523f714fd8e0aefd4484
from django.contrib import admin from guardian.admin import GuardedModelAdmin from wtb.models import WtbBrand, WtbEntity, WtbBrandUpdateLog @admin.register(WtbBrand) class WtbBrandModelAdmin(GuardedModelAdmin): list_display = ('__str__', 'storescraper_class') @admin.register(WtbEntity) class WtbEntityModelAdmi...
999,556
120bc28e4a22000cde0a8a0d23707208ee5809e6
import socket import re # initialize the game board def init_game(csocket): board = [' ' for x in range(10)] #list to contain player's moves print("I will start the game") print_board(board) # to print the intialized board print("Type q when you want to quit") start_game(csocket, board) #start the game...
999,557
1ae1b887c413bab285b1d861d024be4efc10aa7e
import json import urllib2 from bs4 import BeautifulSoup from pyalexaskill.AlexaBaseHandler import AlexaBaseHandler from utilities.utils import IntentHandler class AlexaTivixHandler(AlexaBaseHandler): # Sample concrete implementation of the AlexaBaseHandler to test the # deployment scripts and process. ...
999,558
6c27983036172d018f07c059c8c56e67a983d6a0
# write a program that calculates the average student height from a List of heights. student_heights = input("Input a list of student heights ").split() for n in range(0, len(student_heights)): student_heights[n] = int(student_heights[n]) av_height=0 sum_height=0 i=0 for h in student_heights: sum_height=sum_heigh...
999,559
c2536a6110414ee2c004c0e57a39ff5e0e32e55c
def is_pyramid(n): if n == 0: return 0, False is_pyr = 1 sum = 0 k = 0 while n != sum: if sum > n: is_pyr = 0 break k += 1 sum += k ** 2 if is_pyr == 1: return k, True else: return k, False n = input() if n.isdigit(): ...
999,560
e8585df1d1f93c1d6eb905bcce12efff566a31e2
from django.conf import settings from django.contrib.auth.forms import AuthenticationForm from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger from django.core.urlresolvers import reverse from django.http import HttpResponse from django.shortcuts import render_to_response, get_object_or_404 from dja...
999,561
7829e7133c1f5213e59720d791d3d70e7a17cf97
# -*- coding: utf-8 -*- """ Created on Sun May 31 14:19:13 2020 @author: renluqin """ import seaborn as sns import pandas as pd import matplotlib.pyplot as plt import prince """load documents""" combats = pd.read_csv("pokemon-challenge/combats.csv") pokemon = pd.read_csv("pokemon-challenge/pokemon.csv"...
999,562
b55047dc7da79e4ae8576548ce0645054e150507
""" PROJECT EULER - PROBLEM 1 If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below 1000. """ # Version 1 result = 0 # Add numbers that meet the condition for num in range(1,1000): # Condi...
999,563
ef5c41c5284546b850efb3c492114aab172b7f26
#!/bin/env python3 # -*- coding: utf-8 -*- # import libraries from bs4 import BeautifulSoup import urllib #from urllib.parse import urlparse #from urllib.request import urlopen from urllib.request import urlretrieve import glob from PIL import Image import os import json import threading from threading import Thread ...
999,564
f0c1f5aaba5a6ba5fe4f5927edcbdb7b5b36980d
from quark_runtime import * import quark.reflect import use_class_before_def_md class Bar(object): def _init(self): pass def __init__(self): self._init() def go(self): foo = Foo(); (foo).name = u"bob" _println((foo).name); def _getClass(self): return u"pkg.Ba...
999,565
b92d7c5f68ca816b909d232f7838c9febcd1ccda
### Imports ################################################################### from picamera.array import PiRGBArray from picamera import PiCamera import time import cv2 import os import pygame import math import ctypes from ctypes import * ### Setup ############################################...
999,566
a775d075fa2b619a86398ea467627d4b4b2ac08c
import json from BucketLib.bucket import Bucket from cb_tools.cb_tools_base import CbCmdBase from memcached.helper.data_helper import MemcachedClientHelper class McStat(CbCmdBase): def __init__(self, shell_conn, username="Administrator", password="password"): CbCmdBase.__init__(self, she...
999,567
0df1af32b81b88b2fcddef381ff2c76ed27d0d79
from django.shortcuts import render import json import urllib import requests import pyrebase from django.http import HttpResponse config = { 'apiKey': "your_api_key", "authDomain": "domain_name", "databaseURL": "db_url", "projectId": "project_id", "storageBucket": "storage_bucket", ...
999,568
e513728fa4fcd925ef4008aa67f8604a10bda3f5
infile = open("McHenry_County_Precinct_Names.txt", "rt", encoding = 'utf-8') namelist= infile.read() infile.close() processednamelist= namelist.replace(" ","") PrecinctNameList= processednamelistnamelist.split('\n')
999,569
c52431b0f6f3ce21628f83a72ae43d09debc73c4
import ipdb import numpy as np import sympy as sp import scipy as sc import matplotlib.pyplot as plt from numpy import sin,cos,tan,sqrt from numpy.linalg import inv import pickle import time EndTime = 0.55 ChangeInTime = 0.0001 Time = np.arange(0,EndTime+ChangeInTime,ChangeInTime,float) #NumberOfAdditionalLoops = 99 ...
999,570
761213381bf54047b49a9e79c3916a90c7184e58
from common_fixtures import * # NOQA logger = logging.getLogger(__name__) def test_dns_activate_svc_dns_consumed_svc_link(client): port = "31100" service_scale = 1 consumed_service_scale = 2 env, service, consumed_service, consumed_service1, dns = \ create_env_with_2_svc_dns( ...
999,571
b4e7a56146fbe12a9ce4716885eeeea366330232
#------------------------------------------------------------------------------- # Name: module1 # Purpose: # # Author: dzylc # # Created: 26-06-2014 # Copyright: (c) dzylc 2014 # Licence: <your licence> #------------------------------------------------------------------------------- import numpy ...
999,572
2340e5567550de2b60ae9c1dfbc5e4b00f6cce98
import math pi = math.pi #Число Пи. Примерно, равное 3.141592653589793 def calculate_sphere_volume(r): try: x = int(r) if r >= 0: return 4/3*pi*r**3 else: return 'Радиус сферы не может быть отрицательным' except ValueError: return r print(calculate_sph...
999,573
0cd341324cf75b566935fcc79d196a554c66e4ce
# coding: utf-8 from argparse import ArgumentParser from collections import OrderedDict import datetime as dt import logging import sys from path_helpers import path import si_prefix as si from .. import pformat_dict from ..commands import (DEFAULT_INDEX_HOST, freeze, get_plugins_directory, in...
999,574
5a2fe7dccab72dc1ae350ec7b1e8d6ac441de776
import os import math import numpy as np import pandas as pd from utils import data_loader import utils.display as display from sklearn.metrics.pairwise import haversine_distances from scipy.stats import norm from dask.distributed import Client from dask import delayed def find_sequence(c_s, weight, p...
999,575
aeacdd905ca7d1b211f02bcbd8d508b5c33af7ed
# Django settings for mysite project. import os DEBUG = False TEMPLATE_DEBUG = DEBUG DATABASE_ENGINE = 'mysql' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. DATABASE_NAME = '' # Or path to database file if using sqlite3. DATABASE_USER = '' # Not used with sq...
999,576
08702d9bf80f14b4e7e24cadfc7da6e7b10f0444
#-*- coding: utf-8 -*- ##设置编码方式 import win32com.client import win32api,win32gui,win32con import time from PIL import ImageGrab def mouse_move(x,y): win32api.SetCursorPos( [x, y] ) def mouse_click(x=None,y=None): if not x is None and not y is None: mouse_move( x, y ) time.sleep(0.03) win3...
999,577
732ef01804c5d108b7dff47cd32bf7172987576a
import serial import time ser = serial.Serial('/dev/ttyACM0',115200,timeout=0.5) time.sleep(3) data = bytearray(b'R000F000R0000') ser.write(data) while 1: for i in range(100, 255): i=str(i) temp = 'R' + '000' + 'F' + i + 'R0000' data = bytes(temp, encoding='ascii') ser.write(data)...
999,578
2f8a3dde6788650807debac98a936eed3f84280c
from django.contrib import admin from shop.models import Product, Order, ProductInOrder from accounts.models import UserManager, User admin.site.register(Product) admin.site.register(Order) admin.site.register(ProductInOrder) admin.site.register(User)
999,579
fe576866ab884fa8466fbed7f28570e2abb80117
__author__ = "Jason" # DONE def camel_case(each_word): return each_word[0:1].upper() + each_word[1:].lower() # Return each word back with first letters capitalized
999,580
c285b41bdd0eb30e8eecbbe7fa8ccf11c9dcb008
""" data_curation_functions.py Extract Kevin's functions for curation of public datasets Modify them to match Jonathan's curation methods in notebook 01/30/2020 """ import os import sys import numpy as np import pandas as pd import matplotlib.pyplot as plt from matplotlib_venn import venn3 import seaborn as sns impor...
999,581
036af910011091bcc2ef0ebb9acfc81886a7bf8c
#!/usr/bin/env python import os import sys import argparse import collections import numpy as np import cv2 import math import random import time import torch import torch.nn as nn import torch.nn.parallel import torch.backends.cudnn as cudnn import torch.optim import torch.utils.data import torchvision.transforms as...
999,582
0c5490cb2a9c5920a00a05c8c78a2e6fa8cf12d7
import gin import tensorflow as tf import pandas as pd @gin.configurable def preprocess(image): """ PURPOSE: Dataset preprocessing: cropping and resizing Args: image: image to be preprocessed """ image_cbb = tf.image.crop_to_bounding_box(image, 0, 15, 256, 209) image_res...
999,583
5824a665eaed22aa7131c756db5711fc2e7c07ad
from Logic.CRUD import add from Tests.test_ALL import run_all_tests from UI.console import run_console def main(): lista=[] undol=[] redol=[] lista=add('1', 'Carmen', 'economy', 1230, 'da',lista,undol,redol) lista=add('2', 'Marius', 'economy plus', 250, 'nu',lista,undol,redol) lista=add('3', '...
999,584
a184b8063cf98b1a11d63eeb2cf3883c655777c1
import requests import json def getUpdates(offset, token): # returns the list of messages getUpdates = 'https://api.telegram.org/bot'+ token + '/getUpdates' updates = requests.get(getUpdates + "?offset={}&timeout=60".format(offset), timeout=120) data = updates.json() messages = data['result'] retu...
999,585
77ce1b8d16d9822f770f035b8c54179e102e6f47
from event_queue import * from population_graph import * from graph_node import * import numpy as np import matplotlib.pyplot as plt def build_tree(infect_rate,cure_rate,degree, gens): tree = PopulationGraph(infect_rate,cure_rate) root = tree.add_node(GraphNode(None)) counter = 0 tree_helpe...
999,586
8bbd5498368f5ed0368b4d04edc3c41239bb94aa
# Generated by Django 2.1.3 on 2019-04-26 16:52 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('mana', '0007_auto_20190426_2103'), ] operations = [ migrations.AlterField( model_name='customers', name='customer_id...
999,587
20f1f65792b983bc7ebb70266a0888c3a839c27e
# -*- coding: utf-8 -*- """ Provide a wrapper and helpers for OPEN_STACK library. See https://api-explorer.scalr.com/ for API details """ from __future__ import absolute_import import json import logging import re import requests import toil.provider.base import toil import toil.util.decorator logg...
999,588
8da58c8dce2a62e536f524a1217cb70394912781
Enonce = """ Longest Collatz sequence Problem 14 The following iterative sequence is defined for the set of positive integers: n -> n/2 (n is even) n -> 3n + 1 (n is odd) Using the rule above and starting with 13, we generate the following sequence: 13 -> 40 -> 20 -> 10 -> 5 -> 16 -> 8 -> 4 -> 2 -> 1 It can be seen...
999,589
fd531f9e88120d4aec5fb81e05c9ce98f61c57e2
from django.db import models class data(models.Model): name = models.CharField(max_length = 40) description = models.TextField(max_length = 200) Subscriptions = models.TextField(max_length = 200) payment_due = models.DateField() payment_amount = models.TextField() image = models.ImageField(b...
999,590
894979c2691f4d32d77f5d47f106d0de759de1ac
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. import asyncio import pytest import logging import json import sys import traceback from dev_utils import get_random_dict logger = logging.getLogger(__name__) log...
999,591
37db8877267adcd30bd0ba76075fe0b11f2d47ed
from processdata import CSVData from utils.normalize import NormalizeWord def main(): # path to data" path_data = "data/dictionary.csv" # Load data from csv csv = CSVData() english_words = csv.load_data(path_data) # strip() for all column in dict nm = NormalizeWord() english_words = nm...
999,592
8f23613cbc9503ebbd467a7d65e6ed1187ec6b86
import pdb primeseries = [] def findprime(n): i=0 while i<len(n): j =2 flag=0 while j < n[i]: if n[i]%j==0: flag=1 break j += 1 if flag == 0: primeseries.append(n[i]) i += 1 # print "prime num...
999,593
bde8eb41fe47084657ce1d37cf6d3eddc2b85f96
from abc import ABC, abstractmethod class BaseRetriever(ABC): @abstractmethod def retrieve(self, query, candidate_doc_ids=None, top_k=1): pass
999,594
b78b919130d96322d5a68ffc28be4ba70f01afe7
import VNE_func as fc import itertools import numpy as np from copy import copy, deepcopy filename_sub = 'substrate1209_1.txt' filename_vir = 'virtual1212.txt' cpu_substrate, bw_substrate = read_substrate(filename_sub) VNR_list = read_virtual(filename_vir) num_of_timeslots = 5000 total_cpu = sum(cpu_substrate) total...
999,595
6ec9be52fdb459d9d22e97f9eca5fb36fbb598cb
#!/usr/bin/env python """ Plot distribution of size increases """ import csv import config import matplotlib.pyplot as plt import numpy as np import math config.setup() # load data data = [] with open(config.data_path + '/strata-simplication-increase.csv', 'rb') as csvfile: spamreader = csv.reader(csvfile, delimi...
999,596
04e845f918f89ff03a673e999e2008df2c827cf3
from django.conf.urls.defaults import patterns, include, url from django.conf import settings urlpatterns = patterns('', url(r'^', include('core.urls')), ) static_files = [ r'^static/(?P<path>.*)$', r'^(?P<path>favicon.ico)$', r'^(?P<path>robots.txt)$', r'^(?P<path>humans.txt)$', r'^(?P<path...
999,597
0599c0c50233f0a3c8192e4adfccac4f3d936c58
# Copyright (c) Alibaba, Inc. and its affiliates. from easycv.datasets.segmentation import SegDataset as _SegDataset from modelscope.metainfo import Datasets from modelscope.msdatasets.cv.easycv_base import EasyCVBaseDataset from modelscope.msdatasets.task_datasets.builder import TASK_DATASETS from modelscope.utils.co...
999,598
a41078df9e66a12683870dccc7f8eed2b7b67e95
def by_example(obj): if isinstance(obj, basestring): return {'type': 'string', 'default': obj} if obj is None: return {} if isinstance(obj, (list, tuple)): ret = {'type': 'array', 'default': obj} if obj and obj[0] is not None: item = by_example(obj[0]) ...
999,599
12a5694106673a25d1e5f07a5518c76bab5e411d
from django.urls import path from . import views app_name = 'home' urlpatterns = [ path('', views.index, name='index'), # member path('add-member/', views.add_member, name='add-member'), path('member-list/', views.member_list, name='member-list'), # book path('add-book/', views...