index
int64
0
1,000k
blob_id
stringlengths
40
40
code
stringlengths
7
10.4M
400
68f3d3fce52d08381adc522ee032ef3181aec82a
# Generated by Django 2.2.3 on 2019-07-27 10:41 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('beerFriends', '0006_auto_20190726_1504'), ] operations = [ migrations.AlterField( model_name='beer', name='rating', ...
401
4775bef3623497e9bbe79ca2d4e9e9da0422c450
# # # # ------------------------------------------------------------------------------------------------------------------------------ # # This program have been developed by Hamed Noori and with citiation of the related publicaitons # can be used without permission. # This program is for a novel architecture f...
402
8102bdf4d29d2d3a1bdddbcfb6045b0660693996
import os import time import argparse import cPickle as pickle from definitions import OieFeatures from definitions.OieExample import OieExample class FeatureLexicon: """ A wrapper around various dictionaries storing the mined data. It holds 5 dictionaries in total. Two of them store mappings\n - str ...
403
d82412055affc96d634957c953a35ea69b7e702f
'''Turning on or off, toggling and checking the status' of a specific relay''' #!/bin/env python3 from time import sleep from gpiozero import LED RELAYS = [ LED(23), LED(24), LED(25), LED(8), LED(7), LED(1), LED(12), LED(16) ] def on_action(relay_option, number): '''To turn on t...
404
862b529741d9c3e6cf7ca50272c8af724c56ac62
from wasserstoff.wasserstoff import Config, Environment __all__ = ['Config', 'Environment']
405
6d25b0fedf0d5081a3a0a93ddacc49748464d9d0
# Required python libraries for attack.py import socket import os import sys from termcolor import colored import StringIO import time # need to find Python equivalent libraries for these import stdio import stdlib import unistd # need to find Python equivalent libraries for these import includes import killer impor...
406
e57b30a7a1cf987918abfb3cb7d612bdead2ddcd
from django.db import models # Create your models here. class Airlines(models.Model): flight_number=models.CharField(max_length=8,unique=True) airlines_id=models.CharField(max_length=10) source=models.CharField(max_length=20) destination=models.CharField(max_length=20) departure=models.TimeField() arrival=models...
407
2827a56c12c1e15a6fe26ce182aa07d76735d77f
''' MDSANIMA Setup ''' import sys import pathlib from setuptools import setup, find_packages HERE = pathlib.Path(__file__).parent CURRENT_PYTHON = sys.version_info[:2] REQUIRED_PYTHON = (3, 6) # This check and everything above must remain compatible with Python 2.7. if CURRENT_PYTHON < REQUIRED_PYTHON: sys.stde...
408
d4ac5c6f08e9baa458fbe0ca7aa90c4d9372844f
import h5py import numpy as np #import tracking dt = h5py.special_dtype(vlen=bytes) def stringDataset(group, name, data, system=None): dset = group.create_dataset(name, (1,), dtype=dt, data=data) if system: addSystemAttribute(dset, system) return dset def addStringAttribute(dset_or_group, name, d...
409
4d388c912915c3f1f9e433f1342289f0864b3a11
#/usr/bin/python # File: UdpClient.py # Author: David Zemon # Project: Project1 # # Created with: PyCharm Community Edition """ @description: """ __author__ = 'david' import logging from src.UDP import UDPClient logging.basicConfig(level="DEBUG") serverName = '127.0.0.1' serverPort = 12000 client = UDPClient()...
410
cd5945631a9dd505bf67089bab8c5a37ad375129
import pandas as pd df1 = pd.read_csv("../final/your_no.tsv", '\t') df2 = pd.read_csv("../../Downloads/me.csv", '\t') final = pd.concat([df1, df2]) final.to_csv('../../Downloads/final_con_final.tsv', sep='\t', index=False)
411
16b425d7b8cde1aabe038ccae6922091afb84415
# coding: utf-8 # In[1]: import matplotlib.pyplot as plt import matplotlib import pandas as pd import numpy as np from pandas import DataFrame, Series import os, re # In[2]: OUTPUT_EXCEL = '์›”๋ณ„์›๋‚ด์•ฝํ’ˆ์‚ฌ์šฉํ˜„ํ™ฉ.xlsx' # In[3]: # ๋ฐ์ดํƒ€์…‹ ์ค€๋น„ data_source_dir = '์‚ฌ์šฉ๋Ÿ‰์›”๋ณ„ํ†ต๊ณ„/์›๋‚ด' dfs = [] for fname in os.listdir(data_source_dir): ...
412
0eaaa81d3c8bc61368701e1916b42ede88b90d04
# EXERCISE: # Plotting distributions pairwise (2) # In this exercise, you will generate pairwise joint distributions again. This time, you will make two particular # additions: # - You will display regressions as well as scatter plots in the off-diagonal subplots. You will do this with the # argument kind='reg' (whe...
413
27e9635adf6109f3ab13b9d8dd5809973b61ca03
#Web Scraping #Make sure you have bs4, webbrowser and request installed as your third party modules import bs4, webbrowser, requests try: data = requests.get("http://en.wikipedia.org/wiki/Python") data.raise_for_status() my_data = bs4.BeautifulSoup(data.text, "lxml") print("List o...
414
f5f26819be4b98fab3d46e57e1a5431e54342aed
# coding: utf-8 """Supporting model logic for predicting emotional content of user input. """ import pandas as pd import gensim from sklearn.model_selection import train_test_split from sklearn.multiclass import OneVsRestClassifier from sklearn.svm import LinearSVC #load data for emo2vec loc = 'https://s3-us-west-1.a...
415
d2e46944ab05c5e8c1979101728b7b25900be342
import pytest from time import sleep from timeflux.helpers.background import Task class DummyWorker(): def echo(self, message='hello', delay=0, fail=False): sleep(delay) if fail: raise Exception('failed') self.message = message return(self.message) def test_default(working_path): ...
416
b2f2f1e4b7070ac867b71e538f759e527eb1ffb9
from pymouse import PyMouse m = PyMouse() w,h = m.screen_size() class base_controller: def __init__(self): pass def move(self,xy:list): ''' ็งปๅŠจ ''' m.move(xy[0]*w,xy[1]*h) def click(self, xy:list): ''' ็‚นๅ‡ป ''' m.click(xy[0]*w,xy...
417
ec9efeca7eef7b8ee25c1e089e675bdb1e53413b
# -*- coding:utf-8 -*- # Author: washing # DateTime: 2022/5/18 10:28 # File: 0668.py # Desc: CV class Solution: def findKthNumber(self, m: int, n: int, k: int) -> int: return bisect_left(range(m * n), k, key=lambda x: x // n * n + sum(x // i for i in range(x // n + 1, m + 1)))
418
13342922022f0a0e8928c81c1c4716125af0b2c4
import matplotlib.pyplot as plt import numpy as np plt.rcParams['savefig.dpi'] = 300 #ๅ›พ็‰‡ๅƒ็ด  plt.rcParams['figure.dpi'] = 300 #ๅˆ†่พจ็އ plt.rcParams['font.sans-serif']=['SimHei'] plt.rcParams['axes.unicode_minus'] = False x_axis = [20,40,60,80,100] rf = [184,174,166,159,157.5] anns = [186,179,170,164,161] adaboost = [187.5,1...
419
cb08b95e3b9c80fb74d4415b3798ddbb36cd76e7
import unittest """ Find the largest 0 to 9 pandigital that can be formed by concatenating products Take the number 6 and multiply it by each of 1273 and 9854: 6 ร— 1273 = 7638 6 ร— 9854 = 59124 By concatenating these products we get the 1 to 9 pandigital 763859124. We will call 763859124 the "concatenated product of ...
420
63a40282f16a7f27c118594f1a9468749682594f
import requests import os from jpmesh import parse_mesh_code from tqdm import tqdm url_login='https://platform.openquake.org/account/login/' client = requests.session() client.get(url_login) # Identification for openquake platform login_data = {'username':'###','password':'###'} r1=client.post(url_login,data=login_dat...
421
e695b9458c0e98521e560dbb291f6f05bda1549f
from savers.saver import SaverInterface import os from config import SaverConfig import mysql.connector import json import logging class SQLSaver(SaverInterface): # This class takes in json files and will interpret the jsons as follows. # {'tablename':[{'columnname01':'somevalue','columnname02':'somevalue'},{'columnana...
422
c55991e738c89ee09dabd79d514e710e0fcbac85
from splinter import Browser from time import sleep from datetime import datetime, timedelta import os, sys import urllib import cv2 import numpy as np from PIL import Image import imutils import csv class Scraper(): start_date = datetime(2018, 1, 8) url = 'http://spaceweather.com/' def scrape(self): ...
423
b767519229058b50183d78bb97121f050e5b6bad
# defining private variables class Privacy: def __init__(self, val): self.__val = 900; print("Private data member =",self.__val,"\n") value = Privacy(800); print("Value not changable\n") value.__val;
424
b679444fde7cd8eb819443922f37ee54c0f29de4
from pirates.teleport.AreaTeleportActor import AreaTeleportActor class DoorTeleportActor(AreaTeleportActor): pass
425
f714c7006f50379cc7508a13d710d902d38d2d1f
import torch import torch.nn as nn import torch.nn.functional as F # Const. low-rank version class xCNNlow(torch.nn.Module): def __init__(self, channels, filters, kernel_size, padding=0, stride=1, groups=1, rank=1, bias=True): super(xCNNlow, self).__init__() self.filters = filters self.time...
426
726f133bcf592315c42f8701be8308422ffbf0d9
from flask import Flask, render_template from flask_ask import Ask, statement, question, session import reverse_geocoder as rg from geopy import distance from geopy.geocoders import Nominatim import requests import time ''' :::::::: ::::::::: ::: :::::::: :::::::::: ::: ::: ::: ::: ...
427
cae49da8dd436fc51b472c4a88703d8bc6c79bda
import SCons.Util import xml.dom.minidom, re, os.path ################################################################################ # DocBook pseudobuilder # TODO: Only generate the output formats that are known ################################################################################ def generate(env) : ...
428
c139cbc3e693d75ad196e10257ff3028aa835709
# Complete the hurdleRace function below. def hurdleRace(k, height): if k < max(height): return max(height) - k return 0 print(hurdleRace(2, [2,5,4,5,2]))
429
77971b088a7e076e3bf6d7aa320981a50e7756ce
from flask import Flask from flask_ask import Ask, statement, question, session # import json, requests import random app = Flask(__name__) ask = Ask(app, "/") def get_cat_fact(): myFacts = [ "Cats should not be fed tuna exclusively, as it lacks taurine, an essential nutrient required for good feline hea...
430
124d7da330aa7c869320e10f4f89cc1c872f85f2
import matplotlib.pyplot as plt import sys sys.path.append('coin_flipping_src') from monte_carlo import monte_carlo from probability import probability plt.style.use('bmh') x_coords = range(10) probablility_results = [probability(x,10) for x in x_coords] plt.plot(x_coords,probablility_results,linewidth = 2.5) # plt.plo...
431
502da0f0dafe42d3464fabb1d92ae1b0d7ef11f3
# Check given matrix is valid sudoku or Not.
432
4e31c2a80bec77a1f5aafc8a91617fb4b2941788
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Author: Andrรฉ Pacheco E-mail: pacheco.comp@gmail.com This file implements the methods and functions to load the image as a PyTorch dataset If you find any bug or have some suggestion, please, email me. """ from PIL import Image from torch.utils import data import t...
433
6454790c98b254edeead4e68ef7f5760c9105a57
#!/usr/bin/python # # Dividend! # import os import sys import urllib2 import math import numpy from pylab import * # # Dividend adjusted! ...
434
75133dd924f8f3f028075c5d2109bb79ddc7fe87
import pymysql def testeSelect(db): #ๅˆ›ๅปบๆŸฅ่ฏขๆธธๆ ‡ cur1 = db.cursor() # ไฝฟ็”จ execute() ๆ–นๆณ•ๆ‰ง่กŒ SQL ๆŸฅ่ฏข cur1.execute("SELECT VERSION()") # ไฝฟ็”จ fetchone() ๆ–นๆณ•่Žทๅ–ๅ•ๆกๆ•ฐๆฎ. data = cur1.fetchone() print(dir(data)) print ("cur1 : %s " % cur1) print ("Database version : %s " % data) def dropTable(db): #ๅˆ›ๅปบๆŸฅ่ฏขๆธธๆ ‡ cur1 = db.curs...
435
fcc73647a5e841bcb5ea4fcd06579cc6912cfe1e
#!/usr/bin/env python import os import re import pycolor import sys pyc = pycolor.pyColor() def decompile(mainapk): print pyc.Info("Decompiling apks...") os.system("bash apktool.sh d -f %s"%mainapk) os.system("bash apktool.sh d -f temp.apk") def inject(mainapk): print pyc.Info("Injecting payload...") mk = "mkd...
436
de347b41cd88947690cb42e043880a80d81e2c5c
# Generated by Django 3.2.7 on 2021-09-11 19:38 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('cryptocurrency', '0012_rename_cancel_exists_order_cancel_exist'), ] operations = [ migrations.AlterField( model_name='order', ...
437
c26bdc3f47aa9ac0cda0334e97bdaf3f9d56eb6c
import re import os import base64 os.popen("tshark -r log.pcap -d 'tcp.port==57000,http' -d 'tcp.port==44322,http' -d 'tcp.port==44818,http' -Y 'data-text-lines' -Tfields -e http.file_data > request") def evals(text): template = "{}\['__doc__'\]\[\d+\]" keys = map(str, range(10)) keys += ['\[\]','\(\)',"'...
438
8e85740123467889bdeb6b27d5eaa4b39df280ed
from .celery import app from home.models import Banner from settings.const import BANNER_COUNT from home.serializers import BannerModelSerializer from django.core.cache import cache from django.conf import settings @app.task def update_banner_list(): # ่Žทๅ–ๆœ€ๆ–ฐๅ†…ๅฎน banner_query = Banner.objects.filter(is_delete=Fals...
439
a2421a8673a524c32539555596711a71a8e00dbf
import os import argparse import torch import model.model as module_arch from utils.util import remove_weight_norms from train import get_instance from librosa import load from librosa.output import write_wav from time import time def main(config, resume, infile, outfile, sigma, dur, half): # build model architec...
440
23a560c5f5553fc32329121ea47f8a7ae1196889
import requests import time while 1: r = requests.put("http://localhost:3000/api/4", data={"temperature": 24, "led": 1}) print r.text time.sleep(1)
441
6154979cd2853dd2bd26d1ae5df7365efa0141c2
from sqlalchemy import Column, MetaData, Table, BigInteger, String, DateTime, Integer from migrate import * meta = MetaData() table = Table( 'accesses', meta, Column('id', BigInteger, primary_key=True, nullable=False), Column('uuid', String(255), nullable=False), Column('created_at', DateTime), ) def...
442
813354c9c294c0323c1b54cda7074fbffa49cdb3
from django.utils import timezone from factory import DjangoModelFactory from djtriggers.tests.models import DummyTrigger class DummyTriggerFactory(DjangoModelFactory): class Meta: model = DummyTrigger trigger_type = 'dummy_trigger_test' source = 'tests' date_received = timezone.now() da...
443
aebc918d6a1d1d2473f74d77b8a915ac25548e3a
import cachetools cache = cachetools.LRUCache(maxsize = 3) cache['PyCon'] = 'India' cache['year'] = '2017' print("Older: " + cache['year']) cache['year'] = '2018' print("Newer: " + cache['year']) print(cache) cache['sdate'] = '05/09/2018' print(cache) cache['edate'] = '09/09/2018' print(cache)
444
d7ce6efa72c9b65d3dd3ce90f9d1f2dd8a889d26
''' syntax of if-elif-else if <condition> : code to be executed in this condition elif <new condition> : cdode tbd some code else : code runs in the else condigtion this can all be multiline code ''' a = 3 b = 2 if a == b : print "Values are equal" elif a < b : print "a is less than b" else: print "b...
445
cd234911c1f990b8029dfa792d132847bf39a6aa
import math def vol_shell(r1, r2): a=abs((4/3)*math.pi*((r1**3)-(r2**3))) return round(a,3) print(vol_shell(3,3))
446
7b5713c9a5afa911df1c2939751de30412162f15
from collections import OrderedDict import copy import numpy as np from scipy.optimize import curve_fit from ... import Operation as opmod from ...Operation import Operation from ....tools import saxstools class SpectrumFit(Operation): """ Use a measured SAXS spectrum (I(q) vs. q), to optimize the param...
447
595912753d778a0fa8332f0df00e06a9da5cde93
################################################################################ # # # This file is part of the Potato Engine (PE). # # ...
448
3b42e218acf1c93fab3a0893efa8bf32a274eb23
# Generated by Django 2.2.6 on 2019-11-13 13:11 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('interface', '0010_auto_20191104_2107'), ] operations = [ migrations.AlterField( model_name='submission', name='revie...
449
13b69ec61d6b2129f1974ce7cae91c84100b3b58
import tensorflow.keras from PIL import Image, ImageOps from os import listdir from os.path import isfile, join import numpy as np import glob import cv2 np.set_printoptions(suppress = True) # Load the model model = tensorflow.keras.models.load_model('./converted_keras/keras_model.h5') # Create the array of the righ...
450
68d537cb8488ae4f2c8300e885be78540952dec0
#!/usr/bin/env python2 # coding=utf8 from __future__ import absolute_import, division, print_function from sqlalchemy import func from walis.model.walis import walis_session from walis.model.zeus import zeus_session, zeus_db_handler from walis.model.zeus.activity import ( SubsidyProcessRecord, SubsidyPayReco...
451
a32fb683f8d46f901e8dcd2d075ace22ee81e076
import base64 import string def hexStringtoBytes(hexstring): byteArray = bytes.fromhex(hexstring) return byteArray def xorBytes(bytes1, bytes2): xored = bytes([x^bytes2[i] for i,x in enumerate(bytes1)]) return xored def xorAgainstCharacter(byteArray, character): str2 = [ord(character)] ...
452
b9c058bdb04df93beb379d05939b00f4db423cd3
import string import random import os from threading import Thread class Process(Thread): def __init__(self): Thread.__init__(self) def run(self): while True: prenom = id_generator(random.randint(4, 8)) nom = id_generator(random.randint(4, 8)) password = id_...
453
9b581df505765e895047584c5bb586faef95295f
import dash import dash_core_components as dcc import dash_html_components as html import dash_table as dt import plotly.express as px import pandas as pd import plotly.graph_objects as go import numpy as np from datetime import datetime as dat from sklearn.model_selection import train_test_split from sklearn...
454
fdcee5b3f6b3ec170c9ef3017e0cc6c4b28cf22d
from django.contrib import admin from .models import Advert, Category, ImageAd @admin.register(Advert) class AdminAdvert(admin.ModelAdmin): filter_horizontal = "categories", @admin.register(Category) class AdminCategory(admin.ModelAdmin): pass @admin.register(ImageAd) class AdminImageAd(admin.ModelAdmin)...
455
ae5f87f1c383478ea5f370af1c85d63a472a7788
#Array In Python from array import array numbers = array("i",[1,2,3]) numbers[0] = 0 print(list(numbers))
456
9c05b39a12ab29db99397e62315efddd8cdf1df4
dict1 = [ {'a':1}, {'a':2}, {'a':3} ] a = dict1[1]['a'] # print(a) correlation_dict = {'${class_id}':123} data = {'token': '${self.token}', 'name': 'apiๆต‹่ฏ•','class_id': '${class_id}'} for k in data: for key in correlation_dict: if data[k] in key: data[k] = correlation_dict[key] pr...
457
2467825d2cb01c86d3ba27562decc12551877af1
""" Script: coverage.py Identifies domains that only occur in multi-domain proteins. The main script is master. -------------------- Felix A Kruger momo.sander@ebi.ac.uk """ #### #### import modules. #### import queryDevice import operator import yaml import time #### #### Load parameters. ####...
458
51af54c55834c4bdb8e1cbe4ac55b86bdc61bf4d
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations from django.utils.timezone import utc import datetime class Migration(migrations.Migration): dependencies = [ ('notesapp', '0008_auto_20150819_1222'), ] operations = [ migrations.Ren...
459
a8b1b218e6649545000803c91c803580cfdbd4f1
import random # Imports MongoClient for base level access to the local MongoDB from pymongo import MongoClient # Imports datetime class to create timestamp for weather data storage from datetime import datetime # Importing DailyReportModel class to use the implemented method to insert data into daily_report_model ...
460
8cd582915c5abd96a4ef8a3a5309311f2a73a156
with open("file.txt", 'r') as fh: data = fh.readline() lis= data.split(' ') my_dict={} for key in lis: if key in my_dict.keys(): my_dict[key] += 1 else: my_dict[key] = 1 print(my_dict)
461
f55b286448f114f3823f099a576af7bec1780a8c
# -*- coding: utf-8 -*- try: from greenlet import getcurrent as get_current_greenlet except ImportError: get_current_greenlet = int from thread import get_ident as get_current_thread from threading import Lock if get_current_greenlet is int: # Use thread get_ident = get_current_thread else: # Use gree...
462
e864dad3f46fc9c6c472823bd06ce74fb5cb3f41
#!/usr/bin/env python import rospy import cv2 import numpy as np from cv_bridge import CvBridge from matplotlib import pyplot as plt from sensor_msgs.msg import Image from drone_app_msgs.msg import BBox, Drone, DroneArray from rospy.numpy_msg import numpy_msg # --------------------------------------- # This is an impl...
463
f3a63a22f8746d4a1f127bfe9e8c9d822109ab3c
import logging import os import textwrap from urllib.request import urlopen from bs4 import BeautifulSoup from tqdm import tqdm from doc_curation import book_data from doc_curation.md import get_md_with_pandoc from doc_curation.md.file import MdFile from doc_curation.scraping.misc_sites import iitk from doc_curation....
464
90bb70b0a97c7872c8581a176ebacc50df8e1f72
import datetime def year_choices(): return [(r,r) for r in range(1984, datetime.date.today().year + 1)] def current_year(): return datetime.date.today().year
465
d1b2420778e788d78be2a12a27c80f5fa1b15a0f
import functools import re from pprint import pprint def heading(*, marker=''): ''' Add a new line with the same number of heading markers as the characters in the title Need to specify marker to one of the valid rst line markups ''' def wrapper_heading(func): @functools.wraps(func) ...
466
29bee4ef11281380aa05d22ef54cb76502ecd685
from enum import Enum class CellState(Enum): EMPTY = 1 DEAD = 2 ALIVE = 3 WAS_ALIVE = 4 def __str__(self): default_str = super(CellState, self).__str__() if default_str == "CellState.EMPTY": return "E" elif default_str == "CellState.DEAD": return "D" elif default_str...
467
b453006b4d4c5f17bb58110fe8197d7796ca0c6c
# -*- coding: utf-8 -*- __author__ = 'tqs' from win32com.client import Dispatch import win32com.client import time import os import re import win32api ''' windowsๆ“ไฝœ้ƒจๅˆ†่ฏดๆ˜Ž๏ผš ่€ƒ่ฏ•ๆณขๅŠ็Ÿฅ่ฏ†็‚น๏ผš 1.ๅˆ ้™คๆ–‡ไปถๅŠๆ–‡ไปถๅคน 2.ๅคๅˆถๆ–‡ไปถๅŠๆ–‡ไปถๅคน 3.็งปๅŠจๆ–‡ไปถๅŠๆ–‡ไปถๅคน 4.ๆ–‡ไปถๅŠๆ–‡ไปถๅคนๆ”นๅ 5.ๆ–‡ไปถๅฑžๆ€ง ่€ƒ่ฏ•ๆ ทไพ‹๏ผš 1ใ€ๅœจโ€œ่•จ็ฑปๆค็‰ฉโ€ๆ–‡ไปถๅคนไธญ๏ผŒๆ–ฐๅปบไธ€ไธชๅญๆ–‡ไปถๅคนโ€œ่–„ๅ›Š่•จ็ฑปโ€ใ€‚ 2ใ€ๅฐ†ๆ–‡ไปถโ€œๆทกๆฐด่—ป.dddโ€็งปๅŠจๅˆฐโ€œ่—ป็ฑปๆค็‰ฉโ€ๆ–‡ไปถๅคนไธญใ€‚ 3ใ€่ฎพ็ฝฎโ€œ่žบๆ—‹่—ป.aaaโ€ๆ–‡ไปถๅฑžๆ€งไธบโ€œๅช่ฏปโ€...
468
170d0560c40f3f642f319f6113b68ab8a6bea9ef
import csv import matplotlib.pyplot as plt import numpy as np from scipy.optimize import curve_fit #funktion def func(w,rc): return 1/(np.sqrt(1+w**2*rc**2)) #daten einlesen with open('data/phase.csv' ) as csvfile: reader=csv.reader(csvfile, delimiter=',') header_row=next(reader) f, U, a,...
469
c9cf65eeec49eba004312491cdd2321200fa6a61
import cv2 import pandas from sklearn import tree import pydotplus from sklearn.tree import DecisionTreeClassifier import matplotlib.pyplot as plt import matplotlib.image as pltimg df = pandas.read_csv("show.csv") d = {'UK': 0, 'USA': 1, 'N': 2} df['Nationality'] = df['Nationality'].map(d) d = {'YES': 1, 'NO': 0} df['...
470
c893095be88636e6cb06eb3b939d8106fbb7a8ca
#Arushi Patel (aruship) from tkinter import * import random ###################################### #images taken from wikipedia,pixabay, #trans americas, clipartpanda,pngimg, #findicons, microsoft word ###################################### #################################### # init #####################...
471
d0448ca8e3fd2f3bb8a3a7ec052e29ab0be6351a
import matplotlib.pyplot as plt from sklearn.decomposition import PCA from sklearn.discriminant_analysis import LinearDiscriminantAnalysis import pandas as pd import numpy as np from sklearn import datasets from sklearn.datasets import make_classification from sklearn.model_selection import train_test_split # a = pd....
472
6d7db5b9a64ec25763f5af6ceec1a46d629d549c
import re import ngram import smoothedNgram def split_into_sentences(text): text = text.lower() sentences = re.split(r'(?<!\w\.\w.)(?<![A-Z][a-z]\.)(?<=\.|\?)\s', text) getSentences(sentences,text) return sentences def getTextWithoutSpaces(text): withoutLineBreaks = text.replace("\n", "") withoutS...
473
654586443e96f84aae70b3ce3263b0458a27334b
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/ads/googleads_v1/proto/services/user_interest_service.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) from google.protobuf import descriptor as _descriptor from google.protobu...
474
7bd2a29bff1e435cf813dd54109d7f4e17612425
#from tinyTensor.Node import Node import tinyTensor import plotly.plotly as py from graphviz import render #from tinyTensor.Operation import Operation def init(): global _default_graph _default_graph = None def postOrder(node): nodes_postorder = [] def recurse(node): if isinstan...
475
22da05d9bf6139a0306bfb2d1df96e9e2cf6a0c6
# vim: tabstop=4 expandtab autoindent shiftwidth=4 fileencoding=utf-8 from django.contrib.auth.decorators import login_required from django.contrib.auth import models as auth_models from django.contrib.auth import forms as auth_forms from django.contrib.auth import authenticate, login from django.core.urlresolvers i...
476
40158bbfd9c95a8344f34431d0b0e98c4a1bf6ed
''' Code for mmDGM Author: Chongxuan Li (chongxuanli1991@gmail.com) Version = '1.0' ''' import gpulearn_mm_z_x import sys, os import time import color n_hidden = (500,500) if len(sys.argv) > 2: n_hidden = tuple([int(x) for x in sys.argv[2:]]) nz=500 if os.environ.has_key('nz'): nz = int(os.environ['nz']) if os.en...
477
e543c7f7f1b249e53b8ebf82641ec398abf557af
button6 = Button(tk,text=" ",font=('Times 26 bold'), heigh = 4, width = 8, command=lambda:checker(button6)) button6.grid(row=2, column=2,sticky = S+N+E+W) button7 = Button(tk,text=" ",font=('Times 26 bold'), heigh = 4, width = 8, command=lambda:checker(button7)) button7.grid(row=3, column=0,sticky = S+N+E+W) button8 = ...
478
647dde6e3288ded29336062b78baacc3a92908a7
import re import random import requests from bs4 import BeautifulSoup import js2py from fake_useragent import UserAgent def _get_request_key(session): res = session.post("https://spys.one/en/socks-proxy-list/") soup = BeautifulSoup(res.text, 'html.parser') return soup.find("input", {"name": "xx0"}).get("v...
479
aebc8665a97ab0a71b1d8a920b5cbf2643254883
from base_page import Base_Page import locators class Product_Object: "Page Object for the table" #locators def get_all_text(self): "Get the text within the table" table_text = [] row_doms = self.get_elements(self.rows_xpath) for index,row_dom in enumerate(row_doms): ...
480
24290f3a6cf9a0a272186a505d31c62a6f278c86
#! /usr/bin/env python #printing the sum of the even Fibonacci numbers n= int(raw_input("enter your number")) sumeven=0 # Defining the Fibonacci function def fib(n): a,b = 0,1 #first numbers of the sequence while 1: yield a a,b = b,a+b #generator for the next number in the sequence a = fib(n) for i in range(n...
481
1fbd4e45b061b4d6cefb46e3bc612533ec94250b
__author__ = 'sudab' """ Generate a grid world """ import os, sys, getopt, pdb, string import random import numpy as np import pygame from skimage import io import cv2 import pygame.locals as pgl class Gridworld(): # a gridworld with uneven terrain def __init__(self, filename=None, initial=0, nrows=8, ncols=8,...
482
759ff4cc123e85bdc8c1457bb521cd35841956cd
import numpy as np import cv2 face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml') eye_cascade = cv2.CascadeClassifier('haarcascade_eye.xml') img = cv2.imread('modi.jpg') gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) faces = face_cascade.detectMultiScale(gray, 1.3, 5) #Write the for loop code h...
483
1d524312cbd3b735850046131f31c03fdfa90bbc
my_dict = {'one': '1', 'two': '2'} for key in my_dict: print('{} - {}'.format(key, my_dict[key]))
484
add56d52f3c88f814a166d12c3bc5a5906268864
from django.conf.urls import url from . import views urlpatterns = [ url(r'^class/([^/]+)/?$', views.puppet_class, name='puppet-class'), url(r'^edit-host/(?P<fqdn>[^/]+)?/?$', views.edit_host, name='edit-host'), url(r'^add-host/(?P<fqdn>[^/]+)?/?$', views.add_host, name='add-host'), url(r'^delete/([^/...
485
00e9872136e5753364117adbf60793e660c8bef0
from __future__ import annotations import pytest from pytest import param import ibis import ibis.expr.datatypes as dt from ibis.backends.base.sql.alchemy.geospatial import geospatial_supported DB_TYPES = [ # Exact numbers ("BIGINT", dt.int64), ("BIT", dt.boolean), ("DECIMAL", dt.Decimal(precision=18...
486
25aa0766505b22588107d44e15c3596e9383d4e9
import datetime from ..core.indicator import Indicator, IndicatorState from ..core.toolwindow import ToolWindow class HaakePhoenix(ToolWindow): required_devices = ['haakephoenix'] def __init__(self, *args, **wargs): self.indicators = {} super().__init__(*args, **wargs) def init_gui(self...
487
de6b9961e0572338c87802314e7ae3cded5168b4
import matplotlib.pyplot as plt import numpy as np import scipy.io as scio import estimateGaussian as eg import multivariateGaussian as mvg import visualizeFit as vf import selectThreshold as st plt.ion() # np.set_printoptions(formatter={'float': '{: 0.6f}'.format}) '''็ฌฌ1้ƒจๅˆ† ๅŠ ่ฝฝ็คบไพ‹ๆ•ฐๆฎ้›†''' #ๅ…ˆ้€š่ฟ‡ไธ€ไธชๅฐๆ•ฐๆฎ้›†่ฟ›่กŒๅผ‚ๅธธๆฃ€ๆต‹ ไพฟไบŽๅฏ่ง†ๅŒ– # ๆ•ฐๆฎ้›†...
488
e37e468d8a41b8711fb0eb4ddec7db67691f9156
''' Created on 3 Jul 2009 @author: charanpal An abstract base class which represents a graph generator. The graph generator takes an existing empty graph and produces edges over it. ''' from apgl.util.Util import Util class AbstractGraphGenerator(object): def generate(self, graph): Util.abst...
489
dc226a646af32d052c6d51832b95a340d6986e08
print('\n') # ะŸะตั€ะฒั‹ะน ะฒะฐั€ะธะฐะฝั‚ def fn1(): print("One") def fn2(): print("Two") def fn3(): print("Three") fndict = {"A": fn1, "B": fn2, "C": fn3} keynames = ["A", "B", "C"] fndict[keynames[1]]() fndict['C']() # ะ’ั‚ะพั€ะพะน ะฒะฐั€ะธะฐะฝั‚ def add(one,two): c = one+two print(c) print(type(c)) def sub(one,two...
490
a491772258a52bdfc93083343d2a2e48a240340d
# -*- coding:utf-8 -*- # Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved. # # 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...
491
2b8ca0c8c7878536da4f31652976988cdba62d89
from django.contrib import admin from main_app.models import sites, statuses, redirects # Register your models here. admin.site.register(statuses) admin.site.register(sites) admin.site.register(redirects)
492
19bb58ab440ca00bf6410a70a8b6bbc24eec96c1
from django.apps import AppConfig class MarketingemailsConfig(AppConfig): name = 'marketingemails'
493
1614157c57b3d1b30087c42cb840d617dc91eecb
# Bengisu Ayan - 2236974 # Ceren Gรผrsoy - 2237485 import numpy as np import cv2 B1 = "THE3-Images/B1.jpg" B2 = "THE3-Images/B2.jpg" B3 = "THE3-Images/B3.jpg" B4 = "THE3-Images/B4.jpg" B5 = "THE3-Images/B5.jpg" def segmentation_function(image, name, blue_mask=False, white_mask=False, yellow_mask=False): # Smo...
494
065a566b3e520c14f20d0d7d668ec58404d6e11b
# coding=utf-8 # Copyright 2016 Mystopia. from __future__ import (absolute_import, division, generators, nested_scopes, print_function, unicode_literals, with_statement) from django.db.models.signals import m2m_changed, post_save from django.dispatch import receiver from dicpick.models import...
495
dc88686d3cbb4223b4de6847bf4fc29b93054b00
#! /usr/bin/env python3 import EchooFunctions, cgi, MySQLdb, hashlib, time, requests, os print ('Content-type: text/html\n') form = cgi.FieldStorage() #database connection user = "i494f18_team34" db_pass = "my+sql=i494f18_team34" db_con = MySQLdb.connect(host="db.soic.indiana.edu", port = 3306, user=user, passwd=db_...
496
653e65281984ebb06467aeadb6f0e2b11f1bcb4d
#!/usr/bin/python3 def file_to_code(fname): mem = [] for line in open(fname,"r"): mem.extend([int(i) for i in line.split(",")]) return mem class Opcode(object): def __init__(self, mem, ptr, code, inc): """ >>> o = Opcode([1001, 2, 4, 1], 0, 1, 4) >>> o._Opcode__par_modes [0, 1] """ if mem[ptr]%100 !...
497
8d5b75dc945844d48f52159be08fc1e6aa51fdf5
# Takes in a word and makes a list containing individual characters def split(word): return [char for char in word] # Removes empty strings from a list def removeEmptyStrings(lst): while "" in lst: lst.remove("") ints = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'] tokenList = [] class Token:...
498
20649decd3ff21b1aa814d0a04180195cac3629b
#loadconc.py - possibly these classes will be added to ajustador/loader.py when ready # -*- coding:utf-8 -*- from __future__ import print_function, division import numpy as np from ajustador import xml,nrd_fitness import glob import os import operator msec_per_sec=1000 nM_per_uM=1000 nM_per_mM=1e6 class trace(ob...
499
bb2c684fd5b962c97c033d4b4c2027d52b7371fd
import voldemort import time authorStore = voldemort.StoreClient('authorStore', [{'0', 6666}]) stack = [] components = [] index = 1 # Implementation of the Tarjan algorithm for the detection of strongly connected components. # Function collects all authors in the database and outputs them as strongly connected compon...