index
int64
0
1,000k
blob_id
stringlengths
40
40
code
stringlengths
7
10.4M
12,600
1f9130558b445e5c9058bcd1fb3f39d410fc9db0
items = [ ('Tabassum', 2), ('mony', 3), ('Tamanna', 1), ] items.sort(key=lambda item: item[1]) print(items)
12,601
0c4bc3947d5109b682325d66a57ed64365eea055
import datetime from django.db import models from base.ufunc import UploadRenameImage # moth class MarketMonthEconomic(models.Model): """ macro valuation, Weekly update """ date = models.DateField( help_text='Monthly', unique=True, default=datetime.datetime.now, ) # major econ...
12,602
d91e877754d8c9d0583025ab677b533576f2adcd
import numpy as np import os from task_optim.test_scenario.one_com_waypoint_static_test import OneComWaypointStaticTest from task_optim.solvers.robo_solver import RoboSolver from task_optim.solvers.cma_solver import CmaSolver home_path = os.path.expanduser("~") root_path = home_path + "/Optimization_Tests/cost_tests-r...
12,603
0da0317bbfc86cb0560b262787d7ed504df17069
from datetime import datetime class Timer: def __init__(self): self.start_time = datetime.now() def lap(self): now = datetime.now() duration = now - self.start_time return duration.total_seconds() def reset(self): self.start_time = datetime.now()
12,604
33787c624468cbcdb216e498177f87e80d57a122
S = input() K = int(input()) c1 = 0 ans = S[0] for i, s in enumerate(S): if s != '1': ans = s break c1 = i+1 if c1 >= K: print(1) else: print(ans)
12,605
c5504ef5a713f22f4977a721c2cc98a6bd5157c3
from geodata import * ids = [ 'KV1_38765_30109_00_KANOPUS_20190718_080631_080722.SCN10.PMS.L2', 'KV1_38765_30109_00_KANOPUS_20190718_080631_080722.SCN11.PMS.L2', 'KV1_38765_30109_00_KANOPUS_20190718_080631_080722.SCN12.PMS.L2', 'KV1_38765_30109_00_KANOPUS_20190718_080631_080722.SCN13.PMS.L2', ...
12,606
08cf1d64dd84f0cde4529ee8e5ccc5a212123d5c
# Amplitudni test # Definicije potrebne za analizo parametrov import csv import numpy as np from lmfit import minimize, Parameters, fit_report def podatki(filename,stVrst): # INITIALIZE LISTS time = [] shear = [] strain = [] comp = [] # READ FROM CSV FILE with open(filename, 'rb') as csv...
12,607
08c5006c30412a2a0c513d16386b183b1150729d
#/usr/bin/env python import sys from update_events import update_events from scrape_event import scrape_new_links from raw_results import get_new_results #update_events() scrape_new_links(sys.argv[1]) get_new_results(sys.argv[1])
12,608
7b375e6b5def9544bc1e2abb29ea50ebb926ee8f
from django.urls import path from lists import views app_name='lists' urlpatterns=[ path('', views.index, name='index'), path('todolist/add', views.addTodolist, name='add_todolist'), path('todolist/details/<int:todolist_id>',views.details,name='details'), path('todolist/addtodo/<int:todolist_id>', views.addTodo,...
12,609
48b759003f7e05e9f5c083020f31825140275b5e
#!/usr/bin/env python #import sys from setuptools import setup, find_packages # if sys.version < '2.5': # sys.exit('Python 2.5 or higher is required') setup(name='cssprefixer_py3', version='0.0.1', description="A tool that rewrites your CSS files, adding vendor-prefixed versions of CSS3 rules. ", ...
12,610
bf1bf34b226cccd7aef625a31127d6c0e6ff99b5
import pandas as pd from sklearn import linear_model import matplotlib.pyplot as plt #read data dataframe = pd.read_fwf('data.txt') x_values = dataframe[['intrest']] y_values = dataframe[['price']] #train model on data body_reg = linear_model.LinearRegression() body_reg.fit(x_values, y_values) x = 11 y = body_reg.pre...
12,611
0242e5544013368900c699dd5c05c4231a55df09
for letter in "Das Capitial": print(letter) friends = ["Tam", "Tammy", "Jerid"] for friend in friends: print(friend) for index in range(100): print(index) for index in range(5): if index == 0: print("First") print("Not first")
12,612
d28cd07eca76332692d2e651447f311474710595
class StockNotFoundException(Exception): def __init__(self, message): super(StockNotFoundException, self).__init__(message) class DateNotInRangeException(Exception): def __init__(self, message): super(DateNotInRangeException, self).__init__(message) class HTMLElementNotFoundException(Excepti...
12,613
5c84524d096a81b7b0168b4a99880f5bde259c51
def sub(num1,num2): sub_result = num1-num2 print(sub_result) sub(100,50) def mul(num1,num2): mul_result = num1*num2 print(mul_result ) mul(100,50) def div(num1,num2): div_result = num1/num2 print(div_result ) div(100,50)
12,614
1c517026b8ef990e810238ffc97a85b2c8f3d184
import unittest from sure import expect from social.tests.models import TestStorage from social.tests.strategy import TestStrategy from social.backends.utils import load_backends, get_backend from social.backends.github import GithubOAuth2 from social.exceptions import MissingBackend class BaseBackendUtilsTest(unitt...
12,615
7c21e70f442b46004f824941b64e510a4213d0b6
from bisect import bisect_left n, m, x = map(int, input().split()) a = list(map(int, input().split())) b = bisect_left(a, x) print(min(b, m-b))
12,616
49f55c9a181359adcee97f399d5ff0c00e725e0c
def ber(predict,truth,nodes): predict=set(predict) truth=set(truth) nodes=set(nodes) fp=len(predict-truth)/float(len(predict)) predict_out=nodes-predict truth_out=nodes-predict fn=len(predict_out-truth_out)/float(len(predict_out)) balance_error_rate=0.5*(fp+fn) return balance_error...
12,617
2ed1517a917caab4bc8c2dfba038085d345726cd
from IPython import get_ipython from prompt_toolkit.enums import DEFAULT_BUFFER from prompt_toolkit.filters import HasFocus, ViInsertMode, ViNavigationMode from prompt_toolkit.key_binding.vi_state import InputMode import IPython.terminal.shortcuts as shortcuts from prompt_toolkit.keys import Keys ip = get_ipython() ...
12,618
e091661c92efdc45c45ee3e4d053c8e250c8e037
from .twitter import Twitter
12,619
0a4dedce14941fb63c334fe22a01e824bb174932
# This Python module is part of the PyRate software package. # # Copyright 2020 Geoscience Australia # # 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/...
12,620
34d8ce519b2607d048455d0d15bbf226986a2c71
import tensorflow as tf def squared_loss(y, y_hat): """Squared loss function.""" y_hat = tf.reshape(y_hat, y.shape) return (y - y_hat) ** 2 / 2 def softmax(X): """Softmax implementation.""" X_exp = tf.math.exp(X) partition = tf.reduce_sum(X_exp, axis=1, keepdims=True) return X_exp / part...
12,621
56ad62c76fb3c3168cd50f8c477ae4ef82d9fe7b
#!/usr/bin/env python2.5 # # Copyright 2011 the Melange authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applic...
12,622
35fec210f4fcfe7634313aaa5cc29e723c49f776
for _ in range(int(input())): x,y = map(int,input().split()) minnum =min(x,y) n =0 for i in range(1,minnum+1): if x%i ==0 and y %i ==0 : n =i print(int(x*y/n))
12,623
6d7dcf7d46456e6ff7f8e75ee958e38ccc0d4a4f
from numpy import * # Performing Gradient Descent def gradient_descent(b_current, m_current, points, learning_rate): b_gradient = 0 m_gradient = 0 N = float(len(points)) for i in range(0, len(points)): x = points[i, 0] y = points[i, 1] b_gradient += -(2/N) * (y - (m_current * x + b_current)) m_gradient += ...
12,624
9517288d5da47e2aeb02964a20032e6d98a898f7
""" lipydomics/identification/__init__.py Dylan H. Ross 2019/10/04 description: Module for performing identification of individual lipid features """ from sqlite3 import connect import os import pickle from lipydomics.identification.id_levels import ( id_feat_any, id_feat_meas_mz_rt_ccs...
12,625
9ac8d22a4bbf9fe3591eb78d71c3c8449508a3ec
n=int(input()) hennsai=100000 for i in range(n): hennsai=int(hennsai*1.05) if hennsai % 1000>0: hennsai=(hennsai - hennsai % 1000) + 1000 print(hennsai)
12,626
361db53604e8fb88c8d56edfc386bad588f1e253
/Users/eva/anaconda3/lib/python3.6/re.py
12,627
89151d2909fbb4fc0ffd878106e70f435b868286
#!/usr/bin/env python import os import glob from time import sleep as sleep import gzip import subprocess import re import argparse def main(): print ("Parsing options") options = parse_options() sleep(1) print(" :::::\n\nMerging Arbitrary R1 and R2 coverage files") cov_files = glob.glo...
12,628
d7fee559587fd6ae14c9892c41031861e79077d9
from rf_info.data.rangekeydict import RangeKeyDict ALLOCATIONS = RangeKeyDict({ (0, 8301): (False, False, False, False, False, ['(Not Allocated)'], [], ['[5.53]: Administrations authorizing the use of frequencies below 8.3 kHz shall ensure that no harmful interference is caused to services to which the bands above...
12,629
8d117eee3cb766094bead5714c9bec8fd29167d0
""" " HACK to make this file source'able by vim as well as importable by Python: pyx import sys; sys.modules.pop("pythonhelper", None); import pythonhelper finish """ # import of required modules {{{ import re import sys import time import vim # }}} # global dictionaries of tags and their line numbers, keys are buff...
12,630
b839ecf728d56d498498dff07959fde78deef050
import socket, json, time IP = '127.0.0.1' PORT = 51001 def query(data): s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # assume that it would always success s.connect((IP, PORT)) # print("Connected") # print("Sent: ", data) s.sendall(bytes(json.dumps(data) + '\n', "UTF-8")) ret = ...
12,631
f1652b425b98c91048b49370eb6f255cda0073be
from django.db import models # Create your models here. class CourseModel(models.Model): courseId=models.IntegerField(primary_key=True) courseName=models.CharField(max_length=50) class StudentModel(models.Model): studentId=models.IntegerField(primary_key=True) StudentName=models.CharField(max_length=3...
12,632
59248b67a4c5e6d4a021babace714aa51cc1fc58
def is_palindrome(txt): res = txt.lower().replace(" ","") res = res.replace("-","") res = res.replace(",","") res = res.replace("!","") return res == res[::-1]
12,633
45ed04ee73a21349e83461ced8aed0e96e68f72c
import json from flask import Flask app = Flask(__name__) data = json.load(open('meme.json')) # memes = data['list'] @app.route("/") def index(): return "Check /all at the moment" @app.route("/all") def meme(): return data
12,634
5da6d2a529533419601962c35e2cb05bf9e750d7
import os from tempfile import NamedTemporaryFile import pytest from lhotse import ( AudioSource, CutSet, Features, FeatureSet, MonoCut, MultiCut, Recording, RecordingSet, SupervisionSegment, SupervisionSet, load_manifest, store_manifest, ) from lhotse.lazy import LazyJ...
12,635
b300c7e004ff2999ee6c2887e34fbfafbb86efdb
import urllib.request,json from .models import Source, Article #getting the key api_key = None #getting the base url source_base_url = None article_base_url = None headlines_base_url = None def configure_request(app): global api_key,source_base_url,article_base_url,headlines_base_url api_key = app.config['MY_...
12,636
750e08ccb7de906b9921d95d836f5b0d9674fdae
from client.game_client import * from time import sleep from random import randrange as rd, choice if __name__ == '__main__': gk = [] for i in range(10): gk.append(GameClient()) sleep(1) for i in range(len(gk)): x, y, direction = gk[i].connect(name=str(i)) i = 4 while True...
12,637
59cc50326c6552c93c8c9d7234193369502c5d40
#!/usr/bin/env python import sys import json import time import datetime import requests from collections import defaultdict import redis import MySQLdb as mdb import get_urls import config try: con = mdb.connect(config.HOST, config.USER, config.PASSWORD, config.DB_NAME) cur = con.cursor() sql = """CRE...
12,638
317deadaa6252837bf87fa13ef27c5a5713f2b5d
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'pyarduino.ui' # # Created by: PyQt4 UI code generator 4.11.4 # # WARNING! All changes made in this file will be lost! from PyQt4 import QtCore, QtGui import os import subprocess from serial.tools.list_ports import comports import sys import...
12,639
5069777165047042402bdcb56d0585996417ae76
from mode_constructor import library def construct(gen): c_mode = set() for i in range(len(gen)): for j in range(len(gen[0])): c_mode.add(gen[i][j]) return c_mode def transpose(s, i=0): transposed = set() for elem in s: k = int((elem + i) % 12) ...
12,640
039baa207bd20fc571fcd1a596e9786e30d9621d
# -*- coding: utf-8 -*- """ Created on Tue Jan 12 13:49:50 2021 @author: kathr """ import os import io from copy import copy from collections import OrderedDict import requests #Data science import numpy as np import scipy #Visualization import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from hy...
12,641
6fa1ed722f12f0088d42aa2321184c4a27789e6a
import requests from gtts import gTTS from playsound import playsound import time import os NAME="Monsieur" HOME_ADRESS="93 rue d'Aguesseau, 94490" WORK_ADRESS = "ESIEE Paris" LANG="fr" TEMPS_PREPARATION = 3000 API_MAPS_KEY = "AIzaSyDE5NJFi9_se8qtlF1uyVSXxnTXPueKeQI" API_WEATHER_KEY = "ff204a7f66eafb607b541f9a2ccb9032...
12,642
995712ce4d8f013d2ad81e444af6d6175f3c2343
import csv def rod(lat, lon): rlat = round(float(lat), 2) rlon = round(float(lon), 2) return rlat, rlon fin = open('folder/log_file_1000.csv') csv_log = csv.reader(fin) for fields in csv_log: name, email, s_ip, d_ip, date_time, lat, lon, num = fields rlat, rlon = rod(lat, lon) print('\n', 'la...
12,643
3331a04a704cf5c0f4703e25fc69207e5bf37258
"""Interval based series-as-features estimators.""" __all__ = ["BaseTimeSeriesForest"] from sktime.series_as_features.base.estimators.interval_based._tsf import ( BaseTimeSeriesForest, )
12,644
16ffa5710fcf200b0869cad2b88ea935f8a45ad4
# Generated by Django 3.2.2 on 2021-05-21 13:14 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('notifications', '0001_initial'), ] operations = [ migrations.AddField( model_name='notification', name='title', ...
12,645
09e44c3e132061e7d88b9ca7ee5b2fe9cd32105a
import json import OSC client = OSC.OSCClient() client.connect( ( '127.0.0.1', 57110 ) ) def oscgrain( frequency, vol, sustain ): msg = OSC.OSCMessage() msg.setAddress("s_new") msg.append("grain") msg.append(-1) msg.append(0) msg.append(1) msg.append("amp") msg.append(vol) msg.append("freq") msg.a...
12,646
24e93271f326ddb5713ceba3e9e7788f57e7862b
""" We run a loop performing a grid search over all possible configurations of models and auxiliary losses and weight sharing enabled/disabled. Batch normalization is enabled always. For each configuration we print the results specified below, and at the end we save two files (one for executi...
12,647
b22902fd28dd9321a93287360c194216a7006e73
from skimage.io import imread, imsave from skimage.transform import resize import os from tqdm import tqdm import numpy as np in_dir = 'unzippedIntervalFaces/data/%s/1.6/' img_size = (256, 256) out_dir = 'vox' format = '.jpg' if not os.path.exists(out_dir): os.makedirs(out_dir) for partition in ['train', 'test']...
12,648
241c0e299300d00546822d77c70c38cc0da2ca6e
import unittest from gamemanagerlib.storage.memory import MemoryStorage import gamemanagerlib.business.players import gamemanagerlib.business.teams class Tests(unittest.TestCase): def test_create_team(self): team = gamemanagerlib.business.teams.Team(name="test") team_bll = gamemanagerlib.busine...
12,649
208a4a8185cba721f3bb2048702ea0505df874da
#!/usr/bin/env python # -*- coding: utf-8 -*- from kivy.app import App from kivy.core.text import LabelBase from kivy.core.window import Window from kivy.uix.button import Button from kivy.utils import get_color_from_hex as C from kivy.uix.gridlayout import GridLayout from kivy.uix.scrollview import ScrollView from k...
12,650
b5d1dfdb6f1bb24c565492b4b82cdbc8ee237923
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # DESCRIPTION: # AUTHOR: artemirk@gmail.com () # =============================================================================== import sys def getmaxprofit(ray): result=0 for i in range(len(ray)-1): for l in range(i+1,len(ray)): if ...
12,651
07647faa6ad04e868aa9be77efac8ee6f8a3a39b
import os import csv root = os.path.abspath(os.getcwd()) print('root: {}'.format(root)) namesfolder = r"SSA Names List" namespath = os.path.join(root, namesfolder) print('namespath: {}'.format(namespath)) names_gender_year = dict() names_gender = dict() for namefile in os.listdir(namespath): if ...
12,652
d34c3d74324cd6820733536a04b9143be9af0c20
import smtplib import ssl import threading from datetime import datetime from selenium.webdriver import Chrome from selenium.webdriver.chrome.options import Options import time from random import randrange shoprite_url = 'https://shoprite.reportsonline.com/shopritesched1/program/Imm/patient/advisory' moderna = 'COVID ...
12,653
5cbbe9e9079b68cb83ae94dab4db767ab567730c
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ https://adventofcode.com/2015/day/7 """ from unittest import TestCase, main from aoc.year2015.day07 import part1, part2 from data.utils import get_input EXAMPLE = """123 -> x 456 -> y x AND y -> d x OR y -> e x LSHIFT 2 -> f y RSHIFT 2 -> g NOT x -> h NOT y -> i "...
12,654
977aeb8c7b03f84ca2d144f1d9543001f3142088
class Solution(object): def kthFactor(self, n, k): cnt = 0 for i in xrange(1, n + 1): if n % i == 0: cnt += 1 if cnt == k: return i return -1
12,655
b139c651b19211fc09d06c21548f72076f295ab7
#! /usr/bin/env python # -*- coding: utf-8 -*- # vim:fenc=utf-8 # # Copyright © 2016 vishalapr <vishalapr@vishal-Lenovo-G50-70> # # Distributed under terms of the MIT license. """ """ import numpy as np import math import random # Give a class ID to each output type classes = {} features = 7 current_class_id = 1 ...
12,656
74e90d7a154c7ae2b974d2707d4da657553c5b8b
# ispisivanje trocifrenih brojeva kod kojih je prva cifra jednaka poslednjoj import math def prva_jednaka_poslednjoj(broj): if broj/10>=10 and broj/10<=100: print("Broj je: ", broj) poslednja_cifra=broj%10 print("Poslednja cifra je: ",poslednja_cifra) prva_cifra=broj // 10 ** (int...
12,657
32686c972ce23fa4027197694aa4752d8f04bc46
from tkinter import * def rand(): for i in range(50): label = Label(root, text="it's a button") label.grid(row=1, column=2) root = Tk() butt1 = Button(root, text='PUsh', state=DISABLED) butt1.grid(row=1, column=1) #============================================================================= butt2 = Button(ro...
12,658
602cdbc1c5e4c1f1054967cb1ff1ba57954b14ca
t=int(raw_input()) for i in range(t): a,b=(raw_input().split()) if b=="0": print "Airborne wins." else: print "Pagfloyd wins."
12,659
b1693b5a2caefa2eaf19358ea110d9ce6b82f5a8
import math import sys import linecache # function to check palindromes def palindrome_checker(number): str_num = str(number) str_reverse_num = '' for char in str_num: str_reverse_num = char + str_reverse_num if str_num == str_reverse_num: return True else: return False list = [] ...
12,660
c325e69ab5f6903dd93c0c2f2abe9741dac5d6ed
import socket import thread addr = "" port = int(input("Enter a port to host on:")) s = socket.socket() s.bind((addr,port)) s.listen(8) while True: conn, addr = s.accept() _thread.start_new_thread(handle_connection, (conn, addr, ))
12,661
a2f3799744b160b656924c671ac8c21dafe9b91f
import psycopg2 import psycopg2.extras import database.config as c import alpaca_trade_api # cursor info referenced: https://pynative.com/python-cursor-fetchall-fetchmany-fetchone-to-read-rows-from-table/ # PostgreSQL info referenced: https://realpython.com/python-sql-libraries/#postgresql # Alpaca info URL = c.ALPACA...
12,662
92dde4b7b25191dccc81f3f0edf5b00256bc5277
import os import csv import argparse from Bio import Entrez from Bio import SeqIO ''' Lists to be used throughout code ''' #List of accession #'s (D1-2dpi, D1-6dpi, D3-2dpi, D3-6dpi) SRRs = ['SRR5660030.1', 'SRR5660033.1', 'SRR5660044.1', 'SRR5660045.1'] #List of conditions, corresponding to SRRs order conditions = ['...
12,663
4ab20ac1a835773190c1d28c70c9b57c89bdc4f0
import time import scipy import matplotlib.pyplot as plt import matplotlib.animation as animate import matplotlib import matplotlib.patches matplotlib.use("Agg") import sys import itertools import h5py import json import cPickle as pickle from matplotlib.animation import FuncAnimation from mpl_toolkits.axes_grid1.ancho...
12,664
68fb39c58efb1ce29746bb64149adbe2f964faf9
#!/bin/python3 import math import os import random import re import sys # Complete the pairs function below. def pairs(k, arr): # Making Hash Table of arr count_dict = {} pairs = 0 for num in arr: try: count_dict[num] += 1 except KeyError: count_dict[num] = 1 ...
12,665
e3b4464e401db26d27419cf2a3c8ea54a0469ba2
# Construir um programa que apresente a soma dos cem primeiros números naturais (1+2+3+ ... +98+99+100). Cont = 1 Soma = 0 while Cont <= 100: Soma = Soma + Cont Cont = Cont + 1 print('Resultado da soma dos numero é {}'.format(Soma))
12,666
aa5c9077e78a239c71b69a6e168c37e8dfc20ad4
from output.models.nist_data.list_pkg.non_negative_integer.schema_instance.nistschema_sv_iv_list_non_negative_integer_white_space_1_xsd.nistschema_sv_iv_list_non_negative_integer_white_space_1 import NistschemaSvIvListNonNegativeIntegerWhiteSpace1 obj = NistschemaSvIvListNonNegativeIntegerWhiteSpace1( value=[ ...
12,667
acc4dfeb54b26835e93d95ee79a347f30303c7cd
"""Voter Registration""" print ("Welcome to Votor Registration!") print ("In order to be eligible to vote, you must be at least 18 years old and a U.S Citizen") # Array of all state abbreviations us_states = ['AL', 'AK', 'AZ', 'AR','CA', 'CO','CT', 'DE','DC', 'FL', 'GA', 'HI', 'ID', 'IL','IN', 'IA','KS', '...
12,668
5564cfabb8fd3df8737924d14e74df416e12be29
from django.dispatch import Signal badge_awarded = Signal(providing_args=["badge"])
12,669
f349da3b9642f19790731741415cd40a28f03753
from django.db import models from datetime import datetime # Create your models here. class Rule(models.Model): id = models.IntegerField(auto_created=True, primary_key=True) description = models.CharField(max_length=300) time = models.DateTimeField(auto_now_add=True) name = models.CharField(max_length=...
12,670
92e2f8e4bdd6b7f8a6e0fc370673cf9025ad2ac4
"""Cart-related context processors.""" from .utils import get_cart_from_request def cart(request): """Inject cart in context""" return {'cart': get_cart_from_request(request)}
12,671
28f4ceac7ed0eebac655120c834390d16c30eada
#!/usr/bin/python3 import os import crypt var=input("enter username") pswd="hello"+var if var.isalpha(): code=crypt.crypt(pswd,"22") os.system("sudo useradd -m -p "+code+" "+var) print("user created") else: print("Enter valid username")
12,672
729a7f0e248b96e89616192ef075a64b77a6fd21
""" James Taylor This example demonstrates plotting path data from raw vicon data with additional highlighting of a particular subpath argument 1 is the path to the vicon data that is to be plotted Usage: python ex_plot_hilight_subpath.py <path-to-file-containing-vicon-session-data> Example: python ex_plot_hilight_s...
12,673
d34ff4cf34a1ddca75d1a857f8b62f4b74d4a41d
#!/usr/bin/env python3 #-*- coding: utf-8 -*- # File Name: save_file.py # Author: Feng # Created Time: 2017年03月27日 星期一 22时37分55秒 # Content: import cgi, os import cgitb; cgitb.enable() form = cgi.FieldStorage() # 获取文件名 fileitem = form['filename'] # 检测文件是否上传 if fileitem.filename: # 设置文件路径 fn = os...
12,674
2824aa67d636cdedd920585b71f7e460939cb374
from .folder_tools import * # from .data_module import DataModule, BucketDataset from .hdf_builder import Builder from .hdf_module import DataModule
12,675
0947246faa2faf63a6b1f8c66fd17a6b8af31797
from functools import partial import numpy as np from neupy.layers import TanhLayer, SigmoidLayer, StepOutputLayer, OutputLayer from neupy import algorithms from sklearn import datasets, preprocessing from sklearn.cross_validation import train_test_split from data import xor_input_train, xor_target_train from utils i...
12,676
a9fb285add5a20b3e1b1cca54c832df251901e26
from django.contrib import messages from django.contrib.auth.mixins import LoginRequiredMixin as LoginRequired from django.views.generic import ( DetailView, ListView, CreateView, ) from django.core.exceptions import ObjectDoesNotExist from django.http import HttpResponse, Http404 from django.urls import reverse fr...
12,677
080ad550d8e9cbb858561ef7fd01962bbcfd35ef
from __future__ import division from visual import * """ ball = sphere(pos=(-5,0,0), radius=0.5, color=color.cyan) wallR = box(pos=(6,0,0), size=(0.2,12,12), color=color.green) ball.velocity = vector(25,0,0) deltat = 0.005 t = 0 import time #varr = arrow(pos=ball.pos, axis=ball.velocity, color=color.yellow) while True...
12,678
33cf172a8807fe3a76af9dba6a9a6e3be3f4cba5
# Navigating ACSLland -- Contest 1 - 2014/15 # check the file contest_demo_input.txt to understand how this works #known error: # need to think up a way to fix the floating point roundoff error for 6:42 / 6:43 on test input 1 def process_problem(this_line): item_list = this_line.split(", ") first_startin...
12,679
0fc966b2bfbd7e4400a1ff7a376b60bc3bf8a7e2
from random import randint if _name_ == '_main_': # prime number P_Num = 23 G = 9 print('Prime number :%d' % (P_Num)) print('Primitive Root :%d' % (G)) # private key a pubA = 4 print('The Private Key of A :%d' % (pubA)) x = int(pow(G, pubA, P_Num)) # private key b pubB ...
12,680
7fb18c655369c73f7de76f587eed48c08a5d7a20
#!/usr/bin/env python """ A module with classes and functions for generating test images, plates, and overlays for the screening version of openBIS. """ import canvas import string import random def generate_tile_description(tile, time = None, depth = None): """ Generate a description for the combination of ...
12,681
6786c79c2a198641c3f6fd9213eda7b051429e02
#!/usr/bin/python # # Copyright 2015 John Kendrick # # This file is part of PDielec # # This program is free software; you can redistribute it and/or modify # it under the terms of the MIT License # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied wa...
12,682
1f20c2dff1236cec4ab02324bc29c03459342991
#!/usr/bin/python from __future__ import absolute_import, print_function, unicode_literals from optparse import OptionParser, make_option import os import sys import socket import uuid import dbus import dbus.service import dbus.mainloop.glib import mraa import time try: from gi.repository import GObject except Imp...
12,683
4540785a880d560ad0dc3d98087dd691a65eb052
""" Program to group the extracted tweets (from Tweet IDs) based on the number of hashtags Lang: py3 """ import sys import json OUTPUT_DIR = os.path.join(os.getcwd(), 'output') if(__name__ == "__main__"): if(not(len(sys.argv) == 2)): print("Usage: group_tweets.py <TWEET_DUMP_FILEPATH>") sys.exit() #Input file...
12,684
93ce504f02c2fc759742c673c69b801f937aadc4
import sys import os from dotenv import load_dotenv sys.path.append("./") from execute_notebook import * # noqa: F403, E402 def test_main(): load_dotenv() shard = os.environ["DATABRICKS_HOST"] token = os.environ["DATABRICKS_TOKEN"] workspace_path = os.environ["DATABRICKS_WORKSPACE_PATH"] library...
12,685
e085d6e9ca2e83c4437bf7dce00a235445ef30ae
"""Wiener Process""" from typing import Dict, List, Union import numpy as np from pyesg.stochastic_process import StochasticProcess from pyesg.utils import to_array class WienerProcess(StochasticProcess): """ Generalized Wiener process: dX = μdt + σdW Examples -------- >>> wp = WienerProcess.exa...
12,686
4fff48cc19b31c1f1c2264e59311c703b563b53d
import vmware.common.base_facade as base_facade import vmware.common.constants as constants import vmware.interfaces.labels as labels import vmware.common.global_config as global_config import vmware.nsx.manager.logical_switch.api.logical_switch_api_client as logical_switch_api_client # noqa import vmware.nsx.manager....
12,687
0351bc4b6e53a8468f2f5137989f739456bdde4d
from django.core.management.base import BaseCommand, CommandError from blog.models import OrdenCorrplan as OrdenCorrplan from blog.models import FotoCorrplan as FotoCorrplan from blog.models import Cartones as Cartones from blog.models import Maquinas as Maquinas from blog.models import ConsumoRollos as ConsumoRollos f...
12,688
a24d35a59ed42861705e086ee04f147c786133c2
categories = { 'title': '', 'ancestors': [], } user = { 'phone': '+989104961290', 'name': '', 'wish_list': { 'products': [], 'hows': [], }, 'notifications': [], 'page': { 'title': '', 'rank': 0, 'img': '', 'description': '' }, } user_p...
12,689
85463157476dccfb1fa3b8a5db4d456c87d0f5c0
from vyper.exceptions import InvalidLiteral, SyntaxException def test_no_none_assign(assert_compile_failed, get_contract_with_gas_estimation): contracts = [ # noqa: E122 """ @external def foo(): bar: int128 = 0 bar = None """, """ @external def foo(): bar: uint256 = 0 bar = No...
12,690
4b353108561aa9872fe0a4f950b931e82387acbd
from flask import Flask,request import requests import json from urlparse import urlparse,parse_qs import urllib from requests_oauthlib import OAuth1 import webbrowser app = Flask(__name__) apiKey = "ENTER API KEY" apiSecret = "ENTER API SECRET" requestTokenUrl = "https://api.twitter.com/oauth/request_token" tweetsU...
12,691
e99dde90f01ea6bdf6b861067fcd75ea57813b6b
import tensorflow as tf from ops import * def disc(image , df_dim , reuse = False , name = 'disc'): """ discrimitor layer :param image: tensor with shape [batch_size , height , width , channels], input image :param df_dim: int , the dimention of fitst discrimator hidden layer :param reuse: bool , w...
12,692
63042973859fd3237247b2ec4ffc030b9ba62a43
"""Return a scalar type which is common to the input arrays.""" import numpy import numpoly from .common import implements @implements(numpy.common_type) def common_type(*arrays): """ Return a scalar type which is common to the input arrays. The return type will always be an inexact (i.e. floating point...
12,693
5182d6619fceef18b5d85cd0905551dfdb835d1f
import sys f = open(sys.argv[1]) label_c = 0 l_map = {} c = 0 for l in f: if c == 0: c += 1 continue l = l.strip() p = l.split() user = p[1].split("/") n = len(user) user = user[n-2] p = p[2:] n = len(p) if user == "australia" or user == "india": ...
12,694
eaae530e215367ac730b32295f8c37084beb5350
import array a=int(input()) arr = array.array('i', []) for j in range(0,a): n=int(input()) arr.append(n); for j in range(0,a): print(arr[j], end =" ") print(j)
12,695
ba4401b44102edef0c06b001842c8ffec4a68549
import requests import random from bs4 import BeautifulSoup #get response from website response = requests.get('https://www.goodreads.com/genres/science-fiction') # turn it into html string that python can use html = BeautifulSoup(response.text, 'html.parser') # find all relevant divs on the page divs = html.find_al...
12,696
31a4e30984f62e753dcb6481155bf6d05369eaba
from __future__ import annotations import asyncio from collections import Counter from functools import partial import itertools import typing from typing import ( AsyncIterator, Dict, Iterable, NamedTuple, Optional, Set, Tuple, ) from async_service import Service from eth.abc import ( ...
12,697
db55a085c8379a44560ee8e433761cd01ab52ddc
import mapsquare class Map(object): def __init__(self, x, y): self.array = [] for i in range(x): self.array.append([]) for j in range(y): ms = MapSquare(0, 'soil', (x, y)) if i == 0: ms.setNeighborSquare('w', None) ...
12,698
09f6aeda2cec5ce5b2d0c218756b17a00e6d0c65
def pretty_square(n): for i in range(1, 2*n): for j in range(1, 2*n): value = max(abs(n - i), abs(n - j)) + 1 print(value, end=" ") print() pretty_square(3)
12,699
632671402da2f83c02423c1ce0f304b495215eb6
import datetime from typing import Optional from pydantic import BaseModel class ItemBase(BaseModel): ... class ItemCreate(ItemBase): name: str description: Optional[str] = None is_active: Optional[bool] = None class ItemUpdate(ItemBase): name: Optional[str] = None description: Optional[str] ...