index
int64
0
1,000k
blob_id
stringlengths
40
40
code
stringlengths
7
10.4M
998,300
9d4e40c95c9841e953e810458722920d3ed67ec7
import datetime import json import unittest import six import jsondate class RoundTripCases(object): def _test_roundtrip(self, input, expected=None, test_types=False): output = self.roundtrip(input) expected = expected if expected else input self.assertEqual(output, expected) ret...
998,301
dfe9741b1f205802be97de6968f1f4bf8131b229
# -*- coding: utf-8 -*- from django.db import models from django.contrib.auth.models import User # Create your models here. class MyUser(User): def __unicode__(self): return self.get_full_name() class MyFile(models.Model): file_name = models.CharField(max_length=50) user = models.ForeignKey(User...
998,302
91b6e3e016c7c2623aef20759cea215f892da4af
#!/usr/bin/env python import sys import argparse from itertools import izip_longest def anabl_getSeqsFromFastX(fn, X=2): it = open(fn) for head in it: try: yield (head.strip(), tuple(map(lambda x:x.strip(), ([it.next() for i in xrange(X - 1)])))) ...
998,303
57a3d3b13077b49ad800032040eb6d0d91e54f46
from django.contrib.auth.decorators import login_required from django.contrib.auth.mixins import LoginRequiredMixin from django.shortcuts import render, redirect, get_object_or_404, reverse from django.contrib import messages from django.urls import reverse_lazy from .models import Quiz, Quiz_Question, Choice, StudentA...
998,304
b85a2acb48ec21b69bdeec29d68a1b1b24544596
import gps # Listen on port 2947 (gpsd) of localhost session = gps.gps("localhost", "2947") session.stream(gps.WATCH_ENABLE | gps.WATCH_NEWSTYLE) while True: try: report = session.next() # Wait for a 'TPV' report and display the current time # To see all report data, uncomment the line below #print repo...
998,305
c8c26ba5efb9e2b5d9e5cab4be9c938b13d0488e
# used for string manipulations : # to verify string matches a particular pattern or not # for substitution in a string import re pattern = r"eggs" # r is raw string which contains "eggs" # match() acually compares or match two strings if re.match(pattern, "eggszzzzzzz"): # string should match in beginning. ...
998,306
944d116e1568f52f5624b68886ac7d7d169c6ed0
import string import random ALPHABET = string.ascii_uppercase def readfile(file): f=open(file, mode='r') message='' for ch in f.read(): if 65 <= ord(ch) <= 90 or 97 <= ord(ch) <= 122: message+=ch.upper() f.close() return message #Build shifted alphabet def offset(char, offset)...
998,307
e84b317eb2e3bfac4c86f96253da7d356b012497
from functools import lru_cache class Solution: def maxA(self, n: int) -> int: # basically we have 2 moves: # 1 move: count+1 # 3 moves: copy-paste # at least need 3 moves to do copy-paste, then we can paste as many as we want # use top-down DP # dp[n] is the so...
998,308
f08dd7d45c5a10fbb33578524779ea2e334fbf17
#!/usr/bin/env python # encoding: utf-8 from mvpa2.clfs.knn import kNN from mvpa2.measures.base import CrossValidation from pulse.lda import lda import numpy as np def reduce_dim(labels, samples): return lda(np.array(samples), np.array(labels), 2) def cv_kNN(data_set, partitioner): clf = kNN(12) clf.set_...
998,309
1696c4b21b6a01f6a0d7c18a4cdd6b8a006311b8
# **** Book class **** class Book: # **** constructor method **** def __init__(self, title, author=None): self.title = title self.author = author # **** print info about the book **** def print_info(self): print(self.title + " is written by " + self.author) #...
998,310
78f46fe8537e2b35b2ae7851a3eaa6c589b4a10d
#! /usr/bin/python3 from Metadata import Metadata from ImageSynchronizer import ImageSynchronizer import numpy as np import matplotlib.pyplot as plt tokamak = Metadata() tokamak.parse_metadata('tokamak/dataformat.txt','tokamak/tokamak.txt') x_tokamak = tokamak.get_nparray('x') y_tokamak = tokamak.get_nparray('y') fi...
998,311
cd2a072ee5a67466de8551647b0b3eea7b14b36d
import cv2 import numpy as np framewidth = 640 frameheight = 480 cap = cv2.VideoCapture(0) cap.set(3,framewidth) cap.set(4,frameheight) def empty(a): pass #create Tackbar cv2.namedWindow("HSV") cv2.resizeWindow("HSV",641,240) cv2.createTrackbar("HUE Min","HSV",0,179,empty) #here empty is a sim...
998,312
2023b041b362f3d48a71e6c24f3a963a30278607
from flask import Flask, url_for, flash ,redirect, render_template, request, abort from scoring import scoring import json app = Flask(__name__) app.secret_key = "dsfajkl23@!fesjkl#" scr = scoring() @app.route("/") def index(): rankings = scr.read_rank() return render_template("index.html", rankings = ranking...
998,313
5247b51b7a23a5abd04dcc7482f4de49f2b93e9a
# Title: 카드2 # Link: https://www.acmicpc.net/problem/2164 import sys from collections import deque as dq sys.setrecursionlimit(10 ** 6) read_single_int = lambda: int(sys.stdin.readline().strip()) def solution(n: int): d = dq([i for i in range(1, n+1)]) while len(d) > 1: d.popleft() ...
998,314
a226a3dd236d5d9f89ff5caa577be716af30ff36
from django.contrib import admin from mailing.models import SystemEmail from djcelery.models import TaskState, WorkerState, PeriodicTask, IntervalSchedule, CrontabSchedule @admin.register(SystemEmail) class SystemEmailAdmin(admin.ModelAdmin): pass admin.site.unregister(TaskState) admin.site.unregister(WorkerSta...
998,315
096ed24c2195c91ae8938ecfeabab760afef7993
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright 1999-2022 Alibaba Group Holding Ltd. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-...
998,316
258bf0913b27ae77a20bb23f2334050aceddd18d
# Generated by Django 3.1.2 on 2021-11-13 21:13 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('posts', '0006_vote_created_at'), ] operations = [ migrations.AlterField( model_name='vote', ...
998,317
330c3d14a1203ad040f4635e6212788edc14bd8b
from teacher import * s=student() s.set_details(124,"prasad","tirupati") s1=s.get_details() for x in s1: print(x) t=teacher() t.set_student_details(125) t1=t.get_student_details() print(t1) # for x in t1: # print(x)
998,318
4cd259ea483b9d89c61b9185cc3b962b2ffcb869
import argparse class ArgumentsBase(object): def __init__(self): self.parser = argparse.ArgumentParser() parser = self.parser # gpu id parser.add_argument('-gs', '--gpu-ids', type=int, nargs='+', help='multiple gpu device ids to train the network') ...
998,319
5de0089eaaec2efe7b76158aff51c394aa04e290
#!/usr/bin/python3 #+ # glibcoro example: an animated display of a sorting algorithm. # This script takes the following options: # # --algorithm=algorithm # (required) specifies which sorting algorithm to demonstrate. Currently-valid # values are "bubblesort", "quicksort" and "shellsort". # --enddelay=t # t...
998,320
1c95cf1883c38ae7669ac2c2c6ba7a35933c9aab
import xlrd import xlwt print('xlwt',xlwt.__VERSION__) def write_excel(data): wb = xlwt.Workbook(encoding='utf-8',style_compression=0) ws = wb.add_sheet('考勤统计',cell_overwrite_ok=True) for row,rowItem in enumerate(data): print(data) for col,colItem in enumerate(rowItem): ws.write(row, col, colItem) ...
998,321
c8ec5fe316e8854ffe37d4a611a9e65ae37206d6
# -*- coding: utf-8 -*- from firebase_admin import storage from helpers.helpers import mkdir_conditional _bucket = storage.bucket() def upload(blob_name: str, path: str): blob = _bucket.blob(blob_name) blob.upload_from_filename(path) def download(blob_name: str, path: str): blob = _bucket.blob(blob_name...
998,322
c3ea9ba749860e66052684315f808df9aa664cef
# # Example file for variables # # Declare a variable and initialize it f = 0 # print(f) # re-declaring the variable works """ f = "abc" print (f) """ # ERROR: variables of different types cannot be combined # print("This is a string " + str(123)) # Global vs. local variables in functions def FUNC(): glob...
998,323
b691ddc3bca8789924e3ba31e534533ef9f4b5bd
def print_bits( num ): bits = '' i = 0 while i < 16: bit = (num & 1) bits = str(bit) + bits num = num >> 1 i += 1 if i % 4 == 0 and i != 16: bits = ' ' + bits print( bits ) def insert_bits( n, m, i, j ): print_bits( n ) print_bits( m ) ...
998,324
95e23a76d96b93aabcd243cd95de1dbe1502b0f3
import pyglet from ghost import Ghost, GhostUpDown, GhostLeftRight, GhostAimBot class Mapp: def __init__(self, filename, pacman): self.pacman = pacman self.data = [] self.ghosts = [] with open(filename) as f: for line in f: self.data.append(line) ...
998,325
96d8b3416f4aa82d64a235e602547d4a5731002a
# We will use examine the effects that Horndeski models of # modified gravity/dark energy have on the growth rate of # structure fsigma8(z) from redshift z=6 to z=0. # Parameterization of background: 'lcdm' # Parameterization of gravity: 'hill_scale' import numpy as np import matplotlib.pyplot as plt #To use LaTeX...
998,326
f0a7fe81f5f22ab998219512c496689b5f2a9641
filepath = 'learning_python.txt' with open(filepath) as file_object: data = file_object.read() print(data) print() with open(filepath) as file_object: for object in file_object: print(object.strip()) print() with open(filepath) as file_object: lines = file_object.readlines() ...
998,327
de8e77d5d0d7fbb841abd4b3575decbd7bb01894
def generator(data, lookback, delay, min_index, max_index, shuffle=False, batch_size=128, step=6): """ Perform Python generator that takes the current array of time series data and yields batches of data from the recent past, along with a target. It can be used for MIMO, SISO, MISO, and SIMO. Parameters ...
998,328
e0590bacd1b8ceb72806a7dacd2d0ce5ba9072e6
import struct import pyzatt.zkmodules.defs as DEFS """ This file contains the functions to extract info of realtime events incoming from attendance devices. Author: Alexander Marin <alexuzmarin@gmail.com> """ class RealtimeMixin: def enable_realtime(self): """ Sends command to enable realtime e...
998,329
da8aa8fd1c2978000911c79f3f09635e6c250166
from consts import * def read_number(string): status = STATUS_NEW ret = 0 for c in string: if c not in NUMBER: break if status == STATUS_NEW: if c == '.': status = STATUS_POINT elif status == STATUS_POINT: if c == '.': ...
998,330
b8215a6de290ebb3a81e77f1226bcfed3a4934c3
import json import requests import game as g class Menu: def __init__(self): print("***Welcome to MLB Simulator***") self.team1 = [] self.team2 = [] def pickPlayer(self): while True: player = input() response = requests.get("http://lookup-service-prod.mlb...
998,331
f9d872c3b56d8cd0dda76af75ba29ea290f92692
lines = [line.rstrip('\n') for line in open('in.txt')] num2 = 0 num3 = 0 for x in lines: bk = {} for y in x: if y not in bk: bk[y] = 1 else: bk[y] += 1 check_num = bk.values() if 2 in check_num: num2 += 1 if 3 in check_num: num3 += 1 print(num2...
998,332
e323127a49204b61cab0caf64ae47acf192ec0e5
# This code was converted to Python3 from the Python2 code from the Youtube channel "Numberphile". # the two videos: https://youtu.be/Wim9WJeDTHQ & https://youtu.be/E4mrC39sEOQ def per(n, steps = 0): if len(str(n)) == 1: print(n) print('Total Steps ' + str(steps)) return 'DONE' steps += 1 digits = [int(i) ...
998,333
1efa379e153b44edfa25b4fe8a783b0593f2b6cb
from Auxiliary.Loader import Loader_IEMOCAP_Both from Model.BLSTMwMultiAttention import BLSTMwMultiAttention from Auxiliary.TrainTemplate import Template_FluctuateSize_BothFeatures if __name__ == '__main__': cudaFlag = True metaFlag, multiFlag = False, True for attentionName in ['StandardAttention', 'Local...
998,334
db49392f1fb290d6cce43e2a4e582f9fdc4ba489
import math import cmath import sys import string import heapq import bisect from queue import Queue,PriorityQueue,LifoQueue from collections import Counter,deque from itertools import permutations,combinations from functools import cmp_to_key def power(base,exponent): res = 1 while exponent: if expon...
998,335
3a325af0b090e0c410fc90a8975c0f7624fba8ed
from cinema.models import Film, Genre from service.objects import CachedObject from service.vectorizers import * import service.filmsfilter as flt from sklearn.feature_extraction import DictVectorizer import re filtered_films = flt.filter1() indexes = hashIndexes(filtered_films.iterator()) cDict = CachedObject('keyw...
998,336
198e641843b8fb2933cd4ba5189b86b6e112644f
import re import xlrd class Automaton: ndfa = False def __init__(self, automaton_name, states=None, edges=None): self.automaton_name = automaton_name if states is None : self.states = [] else: self.states = states if edges is None : self.ed...
998,337
b3b99dcbcd9774fe49919157f85e6bb9e13a24c8
#Alaska Miller #6/23/2020 #The Perpouse of this program is to promt the human end user anwser a series of questions and then check the anwnsers of those questions against a previously recorded list of responses and checks the inputed responses against those, if they match then the user is told they may join a club, if ...
998,338
dc4b0a630843073d1cf548b0a5e9e411d500f733
""" Boosting as described by David et al. (2007). Profiling --------- ds = datasets._get_continuous() y = ds['y'] x1 = ds['x1'] x2 = ds['x2'] %prun -s cumulative res = boosting(y, x1, 0, 1) """ from inspect import getargspec from itertools import chain, product from math import floor from multiprocessing import Pro...
998,339
81976ec91094be04dfbd0469e698db1d313d6a4f
import requests import string flag = "CHTB{" url = "http://138.68.151.248:31892/api/list" restart = True while restart: restart = False for i in string.ascii_letters + string.digits + "!@#$*.&+^()@_{}": payload = flag + i post_data = {'order': '(select case when (select count(flag) from flag...
998,340
96da8096a5d6476cf8df56b82036579958c12994
s = input() count = 0 max = 0 for i in range(len(s)): if s[i] == 'S': count =0 else: count += 1 if count > max: max = count print(max)
998,341
6457a7bb8228431264bad4e721df4da88f3cff42
import sys from PyQt5 import QtWidgets, QtGui, QtCore from PyQt5.QtWidgets import (QWidget, QLabel, QLineEdit, QTextEdit, QGridLayout, QVBoxLayout, QRadioButton, QInputDialog) from hyperparameters.hyperparameterConsts import DistanceAlgorithm from hyperparameters.hyperparametersState import CollaborativeHyperparameters...
998,342
a3e2a90725e4622d29f6216c2e2161b106253e3d
# Make sure your output matches the assignment *exactly* hours_spent_on_computer = int(input()) if hours_spent_on_computer < 2: print("That's rare nowadays!") elif hours_spent_on_computer < 4: print("This seems reasonable") else: print("Don't forget to take breaks!")
998,343
a2743b8b17bd3d5fe88bb81aead4421fed0e2764
""" This file demonstrates writing tests using the unittest module. These will pass when you run "manage.py test". Replace this with more appropriate tests for your application. """ from django.test import TestCase from users.models import Profile from goods.models import Comment from goods.views import try_ban def...
998,344
2117673308736aaa7eaef120b18418ee862ae045
# -*- coding: utf-8 -*- # Generated by Django 1.11.3 on 2018-05-15 16:09 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('users', '0001_initial'), ] operations = [ migrations.AddField( ...
998,345
b741f8939acba2b53fab16b1204bffef39ab1eed
from . import base def send_to_ml(obj, ml_name: str): """ Send an object to the specified ml process @param obj The object to be sent @param ml_name The name of the target ml process """ base.send_to_ml(obj, ml_name) def send_to_all_ml(obj): """ Send an object to all ml processes ...
998,346
31fdb46860c31b2ebe388f62b737b8ace587f187
import subprocess def gitSubmodule(): return subprocess.call(['git', 'submodule', 'update', '--init', '--recursive']) def podInstall(): return subprocess.call(['/usr/local/bin/pod', 'install']) def gitClone(url): return subprocess.call(['git', 'clone', url])
998,347
9ffda343e0353600f0758008ed61b73c021907ce
import os import subprocess import sys PATH = os.path.join(sys.exec_prefix, 'Scripts', 'pyuic5.exe') def main(): for file in os.listdir('.'): if file.endswith('.ui'): subprocess.run([PATH, file, '-o', '{}.py.'.format(os.path.splitext(file)[0])]) if __name__ == '__main__': main()
998,348
d21e4d87e9ff7931d831ae6c20aa13da0e0237ba
class BlogPost: def __init__(self , template,iden): self.template = template self.id=iden #self.img=img def listString(self): return "<a href=\"/post?page_id=" + str(self.id) + "\"></a>" def toDict(self): return { } blog_list = [ BlogPost( "stressfreeme....
998,349
ad01954db2ebecad0fd32d44f69fe622772df610
# -*- coding: utf-8 -*- """ Created on Tue May 14 11:03:30 2019 My first attempt at a game in python This is a racing game. Game will stop if car crashes @author: Steven """ ## preample ## # import library import pygame import time import random from os import path img_dir = path.join(path.dirname(__file__), 'img')...
998,350
4179f2db4e5cc4f0024365344e466e183e0e0f79
import sqlite3 conn = sqlite3.connect('../sensorData.db') c = conn.cursor() def main(): dbPath = '../sensorData.db' sql_create_sigfox_info_table = """ CREATE TABLE IF NOT EXISTS sigfoxInfo( ) """ if __name_...
998,351
0703ed422004b3bb5a9758521526aa8692ce9dd2
# Generated by Django 3.2.3 on 2021-07-13 09:46 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='menace', fields=[ ('id', models.BigAutoFiel...
998,352
1cd1ed3f0731c7b223d58b8320243b2365ff599c
import cv2 from PIL import Image import matplotlib.pyplot as plt import h5py # img = Image.open( # 'C:\\Users\\PC\\Downloads\\test_Conv\\Convolutional Models\\DatasetCreation\\data_sneakers\\Nike\\Nike Air Bakin_ Posite _ Men_s.png') # img = cv2.imdecode(img,-1) # plt.imshow(img) # plt.show() # xxx = cv2.cvtColor...
998,353
371e94a0ca7389491dfcb812434f1ff1bfb6513e
import pandas as pd from openpyxl import load_workbook import pandas.io.formats.excel from Creditos_Asignados_Por_Semestre import obtenerListas,agrega_Columna import numpy as np import xlrd #Variables a cargar en memoria codigos_todas_materias_graduados = [] codigos_materias_por_semestre = [] estado_materias = [] n...
998,354
d658f703d9edae127b01e3a29e7e383fae38cbca
from decimal import Decimal from django.test import TestCase from ratechecker.models import Product from ratechecker.ratechecker_parameters import ParamsSerializer, scrub_error class RateCheckerParametersTestCase(TestCase): def setUp(self): self.data = { "price": 240000, "loan_am...
998,355
baea307ab62477253d28a03e6188c375657ea493
from django.conf.urls import url from Test import views urlpatterns = [ url(r'^snippets/$', views.snippet_list), #url(r'^snippets/', views.snippet_detail), ]
998,356
537903f2eefce52a87dfbae7ca46ee8ae6a7170a
import astropy.io.fits as fits import utils.prologue as prologue from scipy import ndimage from matplotlib import pyplot as plt import numpy as np from utils.mosaic import * import imageio as imgio def main(args): #x_star,y_star = 3274,7977 #radius = 10 x_star,y_star = 3069,7821 radius = 15 #x_star...
998,357
fd5e848d4aed03a7ffcd7b5bd51e411973a7589d
# Charles Buyas cjb8qf import random print("Let's play Tic Tac Toe!\n") def get_human(): # Lets the player type which letter they want to be. letter = '' while not (letter == 'X' or letter == 'O'): letter = (input("Do you want to be X or O?: ")).upper() if letter == 'X': return ['X',...
998,358
40abe6762c76e2764d0f35f31473f755e361e2f6
#Letter Combinations of a Phone Number import itertools import sys def letterCombinations(digits): """ :type digits: str :rtype: List[str] """ result = [] dstr = ['', '', 'abc', 'def', 'ghi', 'jkl', 'mno', 'pqrs', 'tuv', 'wxyz'] if digits == '': return result for i in dstr[int(digits[0])]: result.append(i...
998,359
811fcdcc7930ec5266875a9b480419d56ee0a7ed
import objects.regulatorObjects as r r.rConfig.start() while r.config["filled"] is False: print("Loading Configurations") r.rEc.start() r.rHumWater.start() r.rLight.start() r.rMist.start() r.rMold.start() r.rNutrition.start() r.rPH.start() r.rPHDown.start() r.rPHUp.start() r.rRootHum.start() r.rRootPres.star...
998,360
5420c44399b99494c4fd74b9851646fc0e50061f
#PC首页 monetate_icon="//*[@id='monetate_allinone_lightbox']//i[@class='iconfont icon-close']" search_keyword = "//*[@class='search-box']//input[@name='keywords']" search_submit ="//*[@class='search-box']//button[@type='submit']" #搜索结果页 search_result_addbutton = "//*[@class='float_left items']//div[contains(text(),'加入购物...
998,361
65fbe5a46c2753d44339c5b0c4020b315b743ca5
import pandas as pd import matplotlib.pyplot as plt import random out_t=pd.read_csv("2_positive_percentage_fragmentswise_for_last_year_shampoo.csv") #lis= ["l'oreal",'Dove',"Pantene"] lis= ["l'oreal",'Dove',"Head & Shoulders"] out_t = out_t[out_t['Brand_name'].isin(lis)] x1 = list(out_t.Month.unique()) br = out_t.Bran...
998,362
ec17adc6700ea89b58266dff234f968cea277815
from fastapi import FastAPI import uvicorn app = FastAPI() @app.get("/") async def root(): return {"grade": "good", "url": "https://img1.daumcdn.net/thumb/R1280x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FkIqsC%2FbtqEGT92fDc%2FHdq9Qowhgxvbrn94igvzMK%2Fimg.png"} @app.get("/1/") async def good...
998,363
7da22eb59a6c026ac0952158788b8c3919b313fc
import logging import pytest from pathlib import Path from pprint import pprint from openpyxl import load_workbook from util.read_excel_data import get_yaml # @pytest.fixture(scope='session') # def load_testdata_from_caseexcel(): # def _load_testdata_from_caseexcel(project, apiName): # excel_path = Path...
998,364
641762c242004fd9968e2ac6f7f0093675cfc2ed
# -*- coding: utf-8 -*- # Generated by Django 1.10.6 on 2017-04-07 15:31 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('appointment', '0001_initial'), ] operations = [ ...
998,365
fcade2f9cc576c79ad8f13e9618f10136f68a986
import tarfile with tarfile.open('example.tar.gz', 'w:gz') as tar: tar.add('content1.txt') tar.add('content2.txt') tar.add('subfolder/content3.txt') tar.add('subfolder/content4.txt') with tarfile.open('example.tar.gz', 'r:gz') as tar: tar.extractall('extract_tar')
998,366
b3064d8495c99ef70f588d6414c5b74bb4e5b078
# -*-coding:utf-8 -*- # File :basicPost.py # Author:George # Date : 2018/12/4 """ 测试基本的post方法提交数据 需要提交数据的操作 编码 转码操作 字符串(str)====》字节(byte) encode编码(采取Unicode方式编码 使用双字节方式编码字符串) 字节(byte)====》字符串(str) decode解码 read()读取出来的是二进制数据(bit/byte) 转换成srt需要解码 针对post方法的编码 urllib.parse.urlencode(data).enco...
998,367
2424bdf6a3dbd194a3b9987e15fcf35d7c1608c4
import os import sys import json import laspy import runpy from src.helpers import logger,classify logger = logger.setup_custom_logger('myapp') filename = sys.argv[1] today_date=sys.argv[2] previous_date=sys.argv[3] if not(os.path.exists('./data/'+filename+'/interim')): os.mkdir('./data/'+filename+'/interim') ...
998,368
d6b495f67ee500957988c6900a6a4af6c90292a0
#!/usr/bin/env python import sys import telnetlib import json import threading import time telnet = telnetlib.Telnet('127.0.0.1', 1705) requestId = 1 def doRequest( j, requestId ): print("send: " + j) telnet.write(j + "\r\n") while (True): response = telnet.read_until("\r\n", 2) jResponse = json.loads(response...
998,369
ce49a78f155df05c24354f9717b2ce0871edea26
# -*- coding: utf-8 -*- from __future__ import division import numpy as np import pickle import math from temp.features import get_features def get_samples(_index, s_s_chs, sr, _size=1.3): instances = [] for _ind in _index: instances.append(s_s_chs[_ind:int(math.ceil(_ind + (_size * sr)))][:]) return np.array(in...
998,370
913e25e9d5e3c71c3f82443dde3e709c261181f4
import numpy as np import os import pandas import datetime import h5io from pyfileindex import PyFileIndex from pyiron_base.generic.util import Singleton def filter_function(file_name): return '.h5' in file_name class FileTable(metaclass=Singleton): def __init__(self, project): self._fileindex = Non...
998,371
ca635aa55f53e6b76038347ac6499c41807dc1d7
import json as json with open('dic.json') as dic_file: dic = json.load(dic_file) #for x in dic: # print("%s: %s" % (x, dic[x])) month = ['','January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'] count = [...
998,372
1afa263c6fc8423e448f0b626ffce70ca9454621
from __future__ import absolute_import, division, print_function from six.moves import range # LIBTBX_SET_DISPATCHER_NAME cxi.gain_map # LIBTBX_PRE_DISPATCHER_INCLUDE_SH PHENIX_GUI_ENVIRONMENT=1 # LIBTBX_PRE_DISPATCHER_INCLUDE_SH export PHENIX_GUI_ENVIRONMENT import sys,time,math import numpy from libtbx import easy_...
998,373
ff508dc8f26ab0bd0849df1743474e542393daa8
from sklearn import datasets from sklearn import svm import sklearn cancer = datasets.load_breast_cancer() x = cancer.data y = cancer.target #splitting the data into train_set and test_set x_train,x_test,y_train,y_test = sklearn.model_selection.train_test_split(x, y, test_size=0.2) clf = svm.SVC() #training the model...
998,374
b74ff037d97f43378fddd3fd297fd991eb1836d5
""" This file contains all of the relevant classes etc. for diseases, including their symptoms, method of transmission, rate of transmission, etc. """ from SINUtil import * class Disease: import PersonState as ps DISEASE_ID_COUNTER = 0 def __init__(self,name:str,calculate_R_0=False): self.name = name self....
998,375
189ffff3544e2e537c978e977b05cbb8ea04f03b
from MeteorClient import MeteorClient from misc import g_host_address import ejson # Disable escaping any ejson types since we use ObjectIds everywhere # https://www.meteor.com/ejson ejson.EJSON_KEYWORDS = () client = None callback_function = None def connect(): global client if client: return ...
998,376
b900e100f8823f86986ca1ecf016d6e21bfd9fb7
from time import time, ctime, localtime epoch = time() print() print("epoch seconds:", epoch) print() et = ctime(epoch) print("Epoch Date and Time:", et) print() ct = ctime() print("Current Date and Time:", ctime()) print() stobj = localtime() print("struct_time Object:", stobj) print() print("Year:", stobj.tm_yea...
998,377
73406afa0a2d65bed230a77652fa2914fd5bf84d
import os import pprint import pymongo import sys import boto3 session = boto3.session.Session() s3 = session.client(endpoint_url='http://s3.momenta.works', aws_access_key_id='ZXIBS6QZ6J4VA0FBDNCS', aws_secret_access_key='F4iCPNSGGCV7AglUc7s5TsSgns1hjZ9LAOKPoFBr', service_name='s3') def get_db():...
998,378
d1ded30cad87d3a0c2c1c466afe10284481432fa
import Adafruit_GPIO.PWM as pwmLib from time import time, sleep #pwm = pwmLib.get_platform_pwm() pwm = pwmLib.CHIP_PWM_Adapter() pwm.start(5, 3, 1) pwm.start(6, 15, 1) sleep(3) pwm.set_duty_cycle(5, 12) pwm.set_frequency(5, 0.2) sleep(10) pwm.stop(5); pwm.stop(6);
998,379
8fd970c9213022baed28128b22d5f5580a5eabf7
import cv2 import numpy as np from requests.exceptions import HTTPError import json import random import os txtfile = open("result0.86_negative.txt","a+") #change txtfile.write("\n" + "FRONT-FAR" +"\n") #change path1 = r"C:\Users\Supapitch\Desktop\detect_how_similar_images_are\testset\negative\front" path2 = ...
998,380
9ca6e1d8143164952e8858b1c6ac856052df8c67
from django.db import models # Create your models here. class Course(models.Model): code = models.CharField(max_length=10, blank=False, help_text='课程代码', error_messages={ 'unique': "A code with th...
998,381
b504e027ee4c10126fd4361c55b7a630c94bfc6e
#!/usr/bin/python3 """ Constructs the subgraph on the "方剂" (recipe) side. Composed by Zhand Danyang @THU Last Revision: Sep 3rd, 2019 """ import sys sys.path.insert(0, "../lib") import rdflib import json import rdf_namespace import utils import itertools graph = rdflib.Graph() with open("../database/方剂/常用中药方剂.j...
998,382
4894ce8e3b3639ec52de8939239fbd357565a8a9
#slippery pizza #sprites toch check from livewires import games import random games.init(screen_width = 640, screen_height = 480, fps = 50) class Pan(games.Sprite): """The pan which you can move with the mouse""" def update(self): """Set the object in a cursor position""" self.x = games.mouse.x self.y = gam...
998,383
0a5d0ecd3bcfe04344cd60ffd2d903caedf3ba16
#!/usr/bin/python2.7 # -*- encoding: utf8 -*- """ Copyright (C) 2012-2015 Rudolf Cardinal (rudolf@pobox.com). Department of Psychiatry, University of Cambridge. Funded by the Wellcome Trust. This file is part of CamCOPS. Licensed under the Apache License, Version 2.0 (the "License"); you may ...
998,384
054ef5320dfce49eab918832b698a1b52347521f
from ex111.utilidadescev import moeda, dado valor = float(input('Digite o valor: ')) moeda.resumo(valor,35,80)
998,385
f6893871cf24d6211701eed9d5f274e29b7e0e8c
##################################################### # Copyright (c) Xuanyi Dong [GitHub D-X-Y], 2019.01 # ##################################################### from .InferCifarResNet_width import InferWidthCifarResNet from .InferImagenetResNet import InferImagenetResNet from .InferCifarResNet_depth import InferDepthC...
998,386
6aa24979d922a13e71db107ee5cdc509c979c2ba
# -*- coding: utf-8 -*- # Generated by Django 1.11 on 2018-09-01 03:54 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('assetsapp', '0005_software'), ] operations = [ migrations.CreateModel( ...
998,387
d2b0c69d67922f19cc2c4c5bb52dfb151c3d5045
# Generated by Django 2.0 on 2020-04-06 17:05 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('main_app', '0038_updates'), ] operations = [ migrations.CreateModel( name='chat', fie...
998,388
0497bd2b287ecb5754ce5465b20b49a3067e2ee3
from FunctionBlock.CommPort import * class BluetoothPort(CommPort): def __init__(self, address): CommPort.__init__(self) self.address = address def open(self): pass def close(self): pass def send_data(self, str): CommPort.send_data(self, str) def recv_da...
998,389
3dcc4135157bbb3b4757003b007b321b659c0a9d
from TelaLogin import TelaLogin class __init__(): def __init__(self): login = TelaLogin() app = __init__()
998,390
047852d46560e16a9044d4d9dafb8f5e99421867
import os from .exceptions import ConfigException def _get_env_variable(key: str) -> str: value = os.getenv(key) if value is None: raise ConfigException() return value HOST = _get_env_variable("HOST") PORT = _get_env_variable("PORT") KAFKA_BROKER_URL = _get_env_variable('KAFKA_BROKER_URL') ...
998,391
e670dce001514921d7d55842a500587b77c66d64
#!/home/popego/envs/ALPHA-POPEGO/bin/python # EASY-INSTALL-SCRIPT: 'igraph==0.4.5','igraph' __requires__ = 'igraph==0.4.5' import pkg_resources pkg_resources.run_script('igraph==0.4.5', 'igraph')
998,392
a02ad9cfaad11ba86547f4c31ae95493d05be28f
# # chat nickname --new # chat nickname --list # chat nickname --join # # announcement: # needed so others know who should sign the participant list entries. # anyone can cook up any roomID! and insert participant entries! # key = "room"-ownerfinger-roomID # value = # closed participant list entry: # key = ...
998,393
20a4782641a9d96d1cfa5fe31f0d7b8c933c9909
# Generated by Django 3.0.7 on 2020-07-04 05:38 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('landing', '0002_dashboad_name'), ] operations = [ migrations.CreateModel( name='kyc', fields=[ ('id'...
998,394
4aca9796ee33c4bfed3d9856aabba7928b319501
from django.conf.urls import patterns, include, url from django.contrib import admin # from django.conf import settings # from django.conf.urls.static import static urlpatterns = patterns('', # Examples: url(r'^users/', include('patients.urls')), url(r'^articles/', include('articles.urls')), #url(r'^...
998,395
ba1b3cdc3488e2ddeb485ecfc4bc097f20c8c101
from __future__ import unicode_literals import copy import logging from six.moves import html_parser HTMLP = html_parser.HTMLParser() log = logging.getLogger(__name__) class QueryList: """Query a SugarCRM module for specific entries.""" def __init__(self, entry, query='', order_by='', limit='', offset=''...
998,396
bf1b45754da2311af2110e1cfe024c8a98e63089
import sys import math import numpy as np import scipy import scipy.stats from scipy.stats import zscore from scipy.spatial.distance import euclidean, squareform, pdist import pandas as pd from scipy.cluster.vq import kmeans2 import image_processing def read_cell_type(n): f = open(n) m = {} pt = 1 for l in f: l ...
998,397
8ed301e812afd7bf7e033aa2905f5e268ee4a975
from .base import FunctionalTest class CreateAccountTest(FunctionalTest): def test_login(self): self.browser.get(self.live_server_url) # go to login page self.browser.find_element_by_id("login-button").click() # fill in login data self.browser.find_element_by_id("id_usern...
998,398
b8dea4227f5b3ce9665d27bb7a558c1bac6fe006
"""Spiral movement, detection and extraction over given by ABCD points area BE SURE TO IMPORT ANY NATUITION MODULES AFTER AND ONLY AFTER(!) CONFIG.PY LOADING! This is required to prevent modules loading corrupted config before main resolves this problem. """ import threading import os import sys from turtle import sp...
998,399
07a759768ad3d79af0531dd7f9e6f8dbde2191e6
def printgrid(arr): for ar in arr: print(ar) return 0 def solution(blocks): res = [] grid = [[0]*(i+1) for i in range(len(blocks))] # printgrid(grid) for i, b in enumerate(blocks): idx, val = b # print(i, idx, val) grid[i][idx] = val for j in range(idx-1...