index int64 0 1,000k | blob_id stringlengths 40 40 | code stringlengths 7 10.4M |
|---|---|---|
997,700 | fba7c1f888701dee6d2b4e6fa3ec05b89de3003c | #!/usr/bin/env python
############################################################################
#
# Script: create-master.py
#
# Description: Compute BB and CH station lists into one master list
#
############################################################################
import os
import sys
import array
import g... |
997,701 | b255f5b5d0ec7d184b8df76ae9b911572690f277 | '''
Helper functions for working with sublime
'''
import sublime
import sublime_plugin
def sublime_show_region(view, region):
''' Shows the region in the view (not moving if its already visible) '''
if not view.visible_region().intersects(region):
view.show_at_center(region)
def sublime_is_multisele... |
997,702 | c8ea14bfe7c83991e05b32bd350fed1ba755cd18 | #python 3.8
from numpy.random import dirichlet
from typing import List
from MuZeroConfig import MuZeroConfig
from Action import Action
from Player import Player
class Node(object):
def __init__(self, prior: int, to_play: Player, hidden_state = None, discount: float = 1.):
self.visit_count = 0
sel... |
997,703 | bb4f25f230b1d8a0e2d5a524f7053d8795d61afb | given = "sausage"
back = ""
for digit in range(3):
back += given[2*digit]
print(back)
|
997,704 | 71cf2600a82b3c2c7d434a95c066cc419b263300 | from django.shortcuts import render
from django.http import JsonResponse
from rest_framework.decorators import api_view
from rest_framework.response import Response
from .serializers import ProductSerializer
from .models import Product
import django_filters.rest_framework
from rest_framework import status
# Create you... |
997,705 | 208f1f5678d54279fbd4bcfadaca290d462a49b9 | from flask import Flask
import redis
from bson import json_util
from config import *
from mongo_client import Mongo
app = Flask(__name__)
mongo_client = Mongo()
redis_client = redis.Redis.from_url(REDIS_DSN)
@app.route('/')
def healthy():
return "OK", 200
@app.route('/collection/<collection>/id/<document_id>'... |
997,706 | ffe6d25356bcd18bf3b1642891d82a63580f76a0 | from __future__ import annotations
import argparse
import dxtbx.util
from dxtbx.sequence_filenames import find_matching_images
def run(args=None):
dxtbx.util.encode_output_as_utf8()
parser = argparse.ArgumentParser(
description="Find images that match a template specification"
)
parser.add_a... |
997,707 | feeab94d6ef30b3107bf1159ce592ac304c686d0 | # Generated by Django 3.0.7 on 2020-06-18 23:13
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('filmsnob', '0001_initial'),
]
operations = [
migrations.RenameField(
model_name='movies',
old_name='movie_name',
... |
997,708 | c5d40325fb37267244f921cc7370abd557e85b40 | def graphDistances(g, s):
g=Graph(g)
return g.dijkstra(s)
class Graph():
def __init__(self, graph):
self.V = len(graph)
self.graph = graph
def minDistance(self, dist, SPT):
# Initilaize min distance as large int to represent ~INF
min_ = 1e9
# Search not nearest vertex not in Shortest Path Tree
... |
997,709 | 16415d1a9fd7cc52d05e7b623110a65f60cddaba | from flask import Flask, jsonify, request, render_template, session, redirect, g, flash, url_for, make_response
from flask_cors import CORS, cross_origin
import requests
import urllib
from yandex_music import Client, exceptions
from dl.models import SentimentDiscovery
import multiprocessing as mp
import numpy as np
... |
997,710 | eaa343eb6ed95e7307d889eb87e740cf350bd684 | from bs4 import BeautifulSoup
import requests
import json
def gather_urls():
r = requests.get("http://www.politico.com/")
soup = BeautifulSoup(r.text, 'html.parser')
divs = soup.find_all('div', class_='fig-graphic')
return [div.find('a')['href'] for div in divs if div.find('a')]
def parse_data(url):
... |
997,711 | 7bbd8a519f59ff891290a7011fb74f65a152f697 | from django import forms
class CreateForm(forms.Form):
title = forms.CharField(label='Title', max_length=300, widget=forms.TextInput(attrs={'class': 'form-control'}))
text = forms.CharField(label='Text', widget=forms.Textarea(attrs={'class': 'form-control'}))
|
997,712 | 907fd2b337ddfd4b661b1ac2ecc8f48242e3c3ca | fout=open('fib.txt','wt')
def fib(num):
count = 1
a = 1
b = 1
print(count, a, file=fout)
while(count < num):
a, b = b, a+b
count += 1
print(count, a, file=fout)
fib(1000)
fout.close() |
997,713 | 54b9bb8a20b775fbff396831746a265eb1a51362 | """
MITM DNS Poisoning script
Developed by:
- Hiro
- Hiram
"""
from scapy.all import *
from collections import deque
import threading
import time
import sys
"""
Poisons gateway's and client's ARP tables, so packets are redirected the
attacker machine.
"""
class ARPPoisonThread(threading.Thread):
def __init__( ... |
997,714 | 1346f251bfa849f1cf5cd0a49b1e19e66044226c | import numpy
import scipy
import math
import sys
import getopt
import random
from scipy import spatial
from scipy.special import erfinv
import copy
import networkx as nx
# This simulation scheme follows ISO spherical coordinate system convention.
# - angle_t(theta) := polar angle [0, pi]
# - angle_p(phi) := ... |
997,715 | 0a86eece0ea3fac9a12f3ac71ab7f0534f884f37 | print ("%s is a string, %d is a decimal %.3f is a floating no. upto 3 decimal no. place")
|
997,716 | c1e4eb02911180b65833df1278727565cf19a8f5 | import argparse
#import requests
import time
import pandas as pd
#import os
from pathlib import Path
from bs4 import BeautifulSoup
from selenium import webdriver
from random import randrange
max_tries = 10
root = Path(__file__).parents[1]
descr = ("Download UNFCCC National Inventory Submissions lists "
"and... |
997,717 | ac809f0dcb62b96d8f413ae3cb779743489d2a43 | import numpy as np
import matplotlib.pyplot as plt
x = np.linspace(-np.pi, np.pi, 200)
cosy = np.cos(x) / 2
siny = np.sin(x)
plt.plot(x, cosy, linestyle="-", linewidth=1, color="red")
plt.plot(x, siny, linestyle=":", linewidth=2.5, color="green")
plt.show() |
997,718 | 8746b00b6ad68ca94c2c90038259db1c795b64b9 | ### Test : warehouses_clients.py ==> OK
import time
from warehouses_clients import *
# Warehouses
df_warehouses
# "random_clients" function
start_time = time.time()
df_complete, indexes = random_clients(5)
print("Temps d'exécution : %s secondes ---" % (time.time() - start_time))
print(f"indexes : {indexes}")
df... |
997,719 | a8fc01ceea8829fad4f5ad398d8e555afd53a54d | """
Name: Priyanka Gnanasekaran
Class: CS 521 - Fall 1
Date:10/8/2020
Final Project - Home Expense & Retirement Calculator
"""
#Requirement: The class must be imported by main program
from gpriyan_final_classes import Monthly
import datetime
print("\nHome Expense and Retirement Calculator.\n")
#Requi... |
997,720 | 02cd5d962be16ea57367d110cd7a6d89d6225ecc | keyid = 'rzp_test_ixIzmpmVcqXV1J'
keySecret = 'fCwpPR7wrXeClCzZjA7adlKg'
import razorpay
client = razorpay.Client(auth=(keyid,keySecret))
data ={
'amount' : 100*100,
"currency": "INR",
"receipt" : "TSC",
"notes":{
"name": "TEJAS",
"Payment_for" : "IOT"
}
}
order = clie... |
997,721 | ed70839ed32df6b446f5c526fe64647f1ea572fa | #!/usr/bin/env python
import os
import toml
from setuptools import setup, find_packages
REQUIREMENTS_FILE = 'requirements.txt'
README_FILE = 'README.md'
PYPROJECT_FILE = 'pyproject.toml'
SETUP_KWARGS = [
'name',
'version',
'description',
'author',
'authors',
'author_email',
'license',
... |
997,722 | 063d2224cb083832ef287a42955e51af46e38ff7 | # A Span is a slice of a Doc consisting of one or more tokens.
# Span takes at least three arguments:
#the doc it refers to, and the start and end index of the span.
# Remember that the end index is exclusive!
# Manually create a Span
from spacy.tokens import Span
doc = nlp("Hello world!")
span = Span(doc, 0, 2)
... |
997,723 | 935a02b0bb535778dfdd0f2f14e71e12b6f4478c | """
INFO8003-1
2020 - 2021
Final Project
Inverted Double Pendulum
François LIEVENS - 20103816
Julien HUBAR - 10152485
In this file we are implementing a simple Neural
network using fully connected layers in order to
approximate our non-linear Q-value function.
"""
import torch
import gym
import pybullet_envs
import nu... |
997,724 | 9b24745bd13c8c1c765eeb98e97283123f95a46a | import os
import tqdm
import json
import argparse
import torch
import numpy as np
import pandas as pd
# from functools import partial
# from multiprocessing.pool import ThreadPool
from torch.utils.data import DataLoader
from models.smp import SegmentModel, ClassifyModel
from datasets.inference import InferenceDatas... |
997,725 | 164e05981b0733702ac4cb9c230a1dbfe0e9e76a | #!/usr/bin/env python
from shapely.geometry import Point, LineString, Polygon
import math
import numpy as np
import matplotlib.pyplot as plt
class uwb_agent:
def __init__(self, ID, pos):
self.id = ID
self.pos = pos
self.incidenceMatrix = np.array([])
self.M = [self.id]
self.... |
997,726 | 832e2cf88094e76fbfa6264b0756bb9cae736b66 | import os
from dotenv import load_dotenv
load_dotenv()
CONFIG_PATH = os.path.dirname(os.path.realpath(__file__))
RESOURCES_FOLDER = os.path.join(CONFIG_PATH, 'resources')
WML_SERVICE_URL = os.getenv('WML_SERVICE_URL', 'https://us-south.ml.cloud.ibm.com')
WML_SERVICE_API_KEY = os.getenv('WML_SERVICE_API_KEY')
WML_S... |
997,727 | 82fa5b9546ebb53a5d158aca6a771b17033365fc | import logging
logger = logging.getLogger('restserver.rest_core')
class ApiError(Exception):
_message = ''
def __init__(self, **kwargs):
self._message = kwargs.get('message', self._message)
def get_description(self):
return self._message
def get_dict(self):
info = self.get... |
997,728 | f9e1ab8945f0dfb175c14633cc03aaea24df239c | from unittest import TestCase
from recommender import Recommender
# TODO: write proper testcases
class AllInOne(TestCase):
def recommend(self):
recom = Recommender(documents_n = 20, persons_n = 20)
for vizit in Data():
recom.record(vizit[0], vizit[1])
self.assertEqual(recom.rec... |
997,729 | 815654909ee73aa3e4ffb8487d1aebf82b21ba9c | # Generated by Django 2.0.3 on 2018-04-20 20:18
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('forum', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Comment',
fields=[
('id', mo... |
997,730 | 53c64ab2738c849239e19b267ffb7589d14947e1 | from collections import defaultdict
with open('perf.txt', 'r') as f:
perfs = f.readlines()
domains = ['Video_Games', 'Books', 'Toys_Games', 'Tools_Home_Improvement', 'Amazon_Instant_Video', 'Movies_TV', 'Electronics', 'Health',
'Shoes', 'Baby', 'Automotive', 'Software', 'Sports_Outdoors', 'Clothing_Acc... |
997,731 | 9634f8c206d56a1597fc1f251e09fcb38f4f8ad0 | from flask import render_template, flash, redirect, session, url_for, request, g
from flask.ext.login import login_user, logout_user, current_user, login_required
from app import app, db, lm
from forms import LoginForm
from models import User, Post, FlickrAccount, Account, PhotoAlbum
import glob
import json
import tr... |
997,732 | abe95463e187e0de0287c0c3c80d8dac7eda21cf | from math import floor
def troca(a,
i,
j):
a[i], a[j] = a[j], a[i]
def arruma_heap(a,
inicio,
fim):
raiz = inicio
while raiz * 2 + 1 <= fim:
filho = raiz * 2 + 1
trocar = raiz
if a[trocar] < a[filho]:
... |
997,733 | 54deca45c972bfad5b5b83e4893b6e66610f73c9 | # pylint: disable=C0411,C0412,C0413
import logging
from pathlib import Path
import re
from typing import Any, Optional, Union, List
from urllib.parse import urlparse
import RequestsLibrary.log
from RequestsLibrary.utils import is_file_descriptor
from robot.api import logger
from RPA.core.notebook import notebook_file... |
997,734 | bad4bc972d735eb9f96cea8fcb6eb4b004cd4a54 | import cv2 # import OpenCV module.
from matplotlib import pyplot as plt # import matplotlib
# Step 1
img = cv2.imread('Figures/PizzaOnConveyor.jpg')
img_ref = img.copy()
# "selectROI" : used to select a single RegionOfInterest bounding box.
roiTop, roiLeft, roiWidth, roiHeight = cv2.selectROI(img)
prin... |
997,735 | 7e55aca5ec79f7069f3a457ebc19b871f040bb20 | #Author: Connor P. Bain
#Code for CockyReaders server-side
#Last modified December 3, 2014
import logging
import webapp2
import jinja2
import os
import json
from google.appengine.api import users
from google.appengine.ext import db
from __builtin__ import int
jinja_environment = jinja2.Environment(
loader=jinja2... |
997,736 | 23e857de8ce487a096c673f99188a79123206a0e | import unittest
import numpy as np
from numcube import Index
class IndexTests(unittest.TestCase):
def test_create_index(self):
a = Index("A", [10, 20, 30])
self.assertEqual(a.name, "A")
self.assertEqual(len(a), 3)
a = Index("Dim", ["a", "b", "c", "d"])
self.assertEqual(a... |
997,737 | d41c5f2102188d3bc7fcf1fc66da9cd089cbdb01 | # -*- coding: utf-8 -*-
"""
Created on Tue Apr 5 11:32:38 2016
@author: maestre
"""
import matplotlib.pyplot as plt
import numpy as np
# fake up some data
#spread = np.random.rand(50) * 100
spread = np.random.randint(-15,15, 50)
#center = np.ones(1) * 50
center = np.zeros(50)
#flier_high = np.random.rand(10) * 100 ... |
997,738 | 1610e1c5da800c784d8acac4fc363b1bc4b65bbc | from datetime import timedelta, datetime
import traceback
from csv_utils import read_csv
DATE_TIME_FORMAT = '%Y-%m-%d %H:%M:%S'
def write_to_file(file_name, data):
with open(file_name, 'w') as f:
f.write('\n'.join(data))
print("File generated")
def format_rain(csv_file, start):
timeseries = r... |
997,739 | feeb1a2f4e4289dc1cb80779806fa7fffd1e9593 | import pytest
from ..__main__ import defaultdict
def test_case_1():
assert defaultdict(['a','a','b','a','b'],['a','b','c']) == [[1,2,4],[3,5],[-1]]
|
997,740 | 80610e200559754c9964fdbf41773840d3564207 | import socket, errno, struct, time
from twisted.internet import main, error
from twisted.python import log
class IcmpReader(object):
"""
This is a simple icmp reader class.
it reads all ICMP messages and does simple processing on them:
- rtt calculation
- sequence number check
"""
def __init__(self... |
997,741 | 13dda0f6c7282044139e083f013d9a9312a921e9 | # Core Pkgs
import streamlit as st
from memory_profiler import profile
@profile
def main():
st.title("Memeory Profiling Streamlit Apps")
menu = ["Home","Text Analysis","About"]
choice = st.sidebar.selectbox("Menu",menu)
if choice == "Home":
st.subheader("Home")
elif choice == "Text Analysis":
... |
997,742 | ac1f10c2bc528b6a6eef66dd13550b2b219c7dea | """ h_letters = [letter for letter in 'human']
print(h_letters)
this_list = []
for x in 'human':
this_list.append(x)
print(this_list)
h_nums = [num*2 for num in range(1,11)]
print(h_nums)
number_list = [x for x in range(20) if x % 2 == 0]
print(number_list)
number_list_two = ['Even' if x % 2 == 0 else 'Odd' for... |
997,743 | da211532a604c6b73f15759edc4fe8ba23e9caf1 | bicycles = ['trek', 'cannondale', 'redline', 'specialized']
print(bicycles)
print(bicycles[0])
message = "my first bicycle was a " + bicycles[0].title() + "."
print(message)
motorcycles = ["honda", 'yamaha', "suzuki"]
print(motorcycles)
motorcycles[0] = "ducati"
print(motorcycles)
motorcycles.append("ducati")
... |
997,744 | e81d080a47c45c6f897daabf6e88256f5e58d93d | import random
randomNumber = random.randint(0, 1000)
print(randomNumber)
|
997,745 | 9c959ec708e911a49892d9eef8ead745d289d6c2 | import numpy as np
import matplotlib.pyplot as plt
import test
import copy as cp
# Relu function
def rel(z):
return (abs(z) + z) / 2
# Show data classified result
def show_ans(x_s, y_s, m_s, subplt):
for k in range(0, m_s):
if y_s[0, k] == 1:
subplt.plot(x_s[0, k], x_s[1, ... |
997,746 | d929e0a5ffce4708ecd3042435a696254f2d0e0c | from flask_wtf import FlaskForm
from wtforms import StringField, SubmitField, DecimalField
from wtforms.validators import DataRequired
class ProductForm(FlaskForm):
name = StringField('Product Name')
description = StringField('Product Description')
price = DecimalField('Per Unit Price', places=2)
imag... |
997,747 | 39c538142b70d8bf20a6015ce1a9adeebc674225 | #testing commands
print("New Python file")
|
997,748 | baa66480eda9edf19c46c53ae933c145c66f6e2d | #/usr/bin/python
# coding: utf-8
import pytest
import os
from src import hotcount_standalone
def test_writetofile(tmpdir):
count = {'TS_L251a_21_Ampliseq_2014-11-14.fastq': {'all': 550, 'wt': 282, 'delg': 24},
'TS_L1095a_055_Ampliseq_AML_201-12-22.fastq': {'all': 317, 'wt': 151, 'delg': 22}}
res_file = tmpdir... |
997,749 | 23be3289a2537779c09796714b528d5a7f8dd92e | # methods for jet tracking that do not involve the camera
import numpy as np
from scipy.optimize import curve_fit
def gaussianslope(x, a, mean, std, m, b):
'''
Define the function for a Gaussian on a slope (Gaussian + linear)
Parameters
----------
x : float
x-coordinate
a : float
amplitude of Ga... |
997,750 | 73f51d8b3acd9ad305dda6aa1b0bf980718dd591 | from src.transpiler.syntax_tree import *
from src.grammar.nodes.expression import Expression
class Declaration(Node):
def is_init(self):
"""
Returns true, if the declaration also contains an initialization.
:return:
"""
if len(self.children) == 4:
return isinsta... |
997,751 | 306a0acad858ba4af0c4ccb83eaa285f36b81e21 | import argparse
import fasttext
from functools import reduce
import math
import pdb
import operator
from sklearn.metrics import accuracy_score
model=fasttext.load_model('./train.sentiment.bin')
def geometric_mean(precisions):
return (reduce(operator.mul, precisions))**(1.0/len(precisions))
def clip_count(cand_d... |
997,752 | 550e245065105ad7d02ef64cfd5ffec3439e6f6c | N=int(input())
S=str(input())
ls = []
for i in range(len(S)):
ls.append(S[i])
for i in range(len(S)):
x = S[i]
#print(ord(x)+N,ord("Z"))
if ord(x)+N > ord("Z"):
#print("if")
#print(ord("A")-ord("Z")+(ord(x)+N))
ls[i]=chr(ord("A")-ord("Z")+(ord(x)+N)-1)
else:
#print("e... |
997,753 | 4c61fa68366aed9a39d4bace93c6b4413e727c9c | import serial
import pycurl
import StringIO
import re
import time
import requests
ser = serial.Serial('/dev/ttyACM0', 9600)
sensorDataOld = '0'
sensorDataNew = '1'
try:
while 1 :
sensorDataNew = ser.readline()
if(sensorDataNew != sensorDataOld) :
sensorList = sensorData... |
997,754 | 26804231a1d427e50850f8b778f266b8eaadaff3 | # Generated by Django 2.1 on 2018-08-10 17:28
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Discipline',
fields=[
... |
997,755 | bed09a50076d72ab86693a3cb46345c2f7f7476b | #!/usr/bin/env python3
oldfile = open("lalala","w")
oldfile.write("hello word\n")
oldfile.close()
newfile = open("lalala", "r")
for i in newfile:
print(i, end='')
newfile.close() |
997,756 | 35411ee4dcc1df0b2b4b2a59de7c2610a1ec4e3a | """
BATCH - How it works
async def get_location(address)
1. Put the address on a queue of requests.
2. Start a background task that:
i. Waits a short time for other requests to be enqueued.
ii. Processes all queued requests as a batch.
iii. Notifies the waiting 'get_location' functions.
... |
997,757 | 1b53918d324ad62b336781e35772ccb1e52848eb | #!/usr/bin/env python
from socketIO_client import SocketIO, BaseNamespace
import requests,json,sys
'''
This file suppose deploy on the docker container with python image
pre-configed.
It will listen to the socketIO server side if there is any link event
such as node failure, link failure.
'''
# Disable warnings abo... |
997,758 | 9eabd78864709d55efb13130be4583d7c74fc2ed | from django.contrib import admin
from demo.models.application import application
from demo.models.product import product
from demo.models.indication import indication
from demo.models.personne import Personne
from import_export.admin import ImportExportModelAdmin
@admin.register(application)
class applicationAdmin(Im... |
997,759 | 2831ec2beee9ad9ea6ded5e532e1ba34fe698d97 | from django.urls import path
from .views import (
PlaceListAPIView,
PlaceDetailAPIView,
PlaceUpdateAPIView,
)
urlpatterns=[
path('',PlaceListAPIView.as_view(),name='list'),
path('<slug:slug>/detail',PlaceDetailAPIView.as_view(),name='detail'),
path('<slug:slug>/update',PlaceUpdateAPIView.as_vi... |
997,760 | a02f81207bb180262f692c7f5648902ed4f1e3bd | # invoer
dikte_papier = int(input('dikte papier (in mm): '))
afstand_hemellichaam = int(input('afstand tot hemellichaam (in mm): '))
# berekening
aantal_keer_vouwen = 0
hoogte_gevouwen_papier = dikte_papier
while hoogte_gevouwen_papier < afstand_hemellichaam:
aantal_keer_vouwen += 1
hoogte_gevouwen_papier *... |
997,761 | 6bd5f07e27e8b836cf04465ee7c47a0dd3730e45 | """Docutils transforms used by Sphinx."""
from __future__ import annotations
import re
from typing import TYPE_CHECKING, Any, cast
from docutils import nodes
from docutils.nodes import Element, Node
from sphinx import addnodes
from sphinx.errors import NoUri
from sphinx.locale import __
from sphinx.transforms impor... |
997,762 | 7f952b6b152e8c76216268b5c4cd7a97b8a3167b |
from xai.brain.wordbase.nouns._watchtower import _WATCHTOWER
#calss header
class _WATCHTOWERS(_WATCHTOWER, ):
def __init__(self,):
_WATCHTOWER.__init__(self)
self.name = "WATCHTOWERS"
self.specie = 'nouns'
self.basic = "watchtower"
self.jsondata = {}
|
997,763 | 16864dea148107076a2c6ea45b9827fd87f0eb83 | for i in range(1, 11):
# If i is equals to 6,
# continue to next iteration
# without printing
if i == 6:
continue
else:
# otherwise print the value
# of i
print(i, end=" ")
|
997,764 | 8ab2c2bcb8d2cebfc7b5bee11fbe0fdfc0a41582 | import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from zoket import client
import MySQLdb
import string
class MyTableModel(QAbstractTableModel):
def __init__(self, datain, parent=None, *args):
QAbstractTableModel.__init__(self, parent, *args)
self.arraydata = datain
def rowCount... |
997,765 | f19a7895ee072fb8a0b33d3106908455925fd375 | from sqlalchemy import *
from sqlalchemy.orm import *
from tables import *
engine = create_engine("postgresql://cavuser:cavuser@localhost:5432/cav_dblp")
Base.metadata.create_all(engine)
Session = sessionmaker(bind=engine)
session = Session()
def get_name(author_id):
return engine.execute(text("SELECT name FROM a... |
997,766 | b4d78da93511493fd9fe69cda1d089997ae16c7e |
from django.contrib.auth import get_backends, authenticate
|
997,767 | 87b206eab89ff6f4f464721bea7f8f8f2dcbb326 | # -*- coding: utf-8 -*-
import socket
import os, sys
from module_declarations import PL1012DataFormat, PL1012BYTE_N, SAMPLING_BASE_TIME, SCREEN_POS, BYTE_N, CWD_PATH
from module_declarations import SKT_PATH, SKT_PL1000, SKT_TC08, HW_SN_EN, TC08DataFormat, TC08FLOAT_N, PEAKDataFormat
from module_declarations import... |
997,768 | acd1df17e2b0964f54e8701640dce4bf02c227b8 | import sys
import os
import argparse
argparser = argparse.ArgumentParser('''
Builds Brent dataset into appropriate format for use with DNN-Seg.
''')
argparser.add_argument('dir_path', help='Path to Brent source directory')
argparser.add_argument('-o', '--outdir', default='../dnnseg_data/brent/', help='')
args = argpar... |
997,769 | 99aabb664017dc2b3e78571d5c7213b80df50307 | from volapi import Room
import argparse
import config
import os
import requests
def upload_process(room, passwd, user, userpasswd, files):
if len(files) == 0:
print("[X] No files were recognised! - Aborting upload")
return False
if room == "":
print(f"[X] You must provide a room! - Abo... |
997,770 | 6632e5c001ef557b19e1e5585ef78101f707c531 | import builtins
import difflib
import inspect
import os
# Hack that modifies the built-in `open` function in such a way that
# an assignment can be done even at other places than the server.
def find_filename(filename):
if os.path.exists(filename):
return filename
path = os.path.dirname(inspect.getfil... |
997,771 | cd08d727c9ca3cbed23a15773da5c18b04a3d9b4 | rule abundance:
input:
assembly=RESULTS + "/assemblies/{sample}_trinity.Trinity.fasta",
fwd=RESULTS + "/fastq_trimmed/{sample}.1.trimmed.fastq",
rev=RESULTS + "/fastq_trimmed/{sample}.2.trimmed.fastq",
map=RESULTS + "/assemblies/{sample}_trinity.Trinity.fasta.gene_trans_map"
outp... |
997,772 | a33ab7900b04782b3b1f27487d55fe25475d4d24 | #Favorite Genres
#https://leetcode.com/discuss/interview-question/373006
def initialize():
userSongs = {
"David": ["song1", "song2", "song3", "song4", "song8"],
"Emma": ["song5", "song6", "song7"]
}
songGenres = {
"Rock": ["song1", "song3"],
"Dubstep": ["song7"],
... |
997,773 | 2dd5860d86f9c086e99b686075f347599a0a2c25 | # -*- coding: utf-8 -*-
"""SparseRegElasticNetILC
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/17Mq9jU51uZgUpvuSK3NuXbY8oxq6H_y-
# Copmparing Sparse Regularization with Elastic Net with ILC Regularization
### Installations and imports
"""
!pip ins... |
997,774 | 2e5ab912cc4c6852e5a571518f6a0d6dcd013d2d | # modified from code at https://docs.ocean.dwavesys.com/en/stable/examples/map_coloring_full_code.html
import dwavebinarycsp
from neal import SimulatedAnnealingSampler
from dwave.system import DWaveSampler, EmbeddingComposite
import networkx as nx
import matplotlib.pyplot as plt
from datetime import datetime
import pi... |
997,775 | fe885f9ba22f347dd4351a3eb6bc21fc51657978 | fromnetid = 0.6642
rejectmin = 0.99 * fromnetid
rejectlimit = rejectmin + 0.01
f = open('edges.txt', 'r')
fo = open('edges-output.txt', 'w')
count = 0
#PR = float((1.0/685229.0)*(1.0-0.85))
PR = float(1.0/685230.0)
print PR
prevdata = 0
degree = 0
list_output = ''
prevdata1 = 0
flag = 0
tab = '\t'
delim = '\t'
edge_co... |
997,776 | 0d7f3acce257f314a5e3e67a87e636a012b44573 | class Time(object):
"""Time of day.attributes: hour, minute, second"""
t1 = Time()
t1.hour = 11
t1.minute = 59
t1.second = 30
t2 = Time()
t2.hour = 10
t2.minute = 45
t2.second = 25
def is_after(t1, t2):
t1_total_seconds = (t1.hour * 3600) + (t1.minute * 60) + t1.second
t2_total_seconds = (t2.hour * 3600)... |
997,777 | 0e52356e89e04ac83da42c77eba76e39d1134d1a | from datetime import datetime
from django.shortcuts import render, redirect, get_object_or_404 , reverse
from django.contrib.auth.decorators import login_required
from django.views.generic import ListView, DetailView
from django.db.models import Q
from django.http import JsonResponse
from django.core.paginator im... |
997,778 | 1954623bcfbd08f7cd9d9af53593217ae861cfd5 | """Repeating a beat in a loop."""
__author__ = "730330944"
# Begin your solution here...
beat: str = input("What beat do you want to repeat? ")
beat_repeat: str = beat
repeat: int = int(input("How many times do you want to repeat it? "))
if(repeat <= 0):
print("No beat...")
else:
while repeat-1 > 0:
... |
997,779 | fb1163e6c30966a80510663a25758826e99d75b3 | from __future__ import print_function, unicode_literals
from clckwrkbdgr import unittest
from clckwrkbdgr.unittest import mock
import os
import mimetypes
from .. import webserver
class MockPopen(object):
def __init__(self, rc, stdout, stderr):
self.rc = rc
self.stdout = stdout
self.stderr = stderr
def communic... |
997,780 | d454e80535c7a702d97acc28eaf387ed0713e938 | """ Tests for ParserNode interface """
import sys
import pytest
from certbot_apache._internal import interfaces
from certbot_apache._internal import parsernode_util as util
class DummyParserNode(interfaces.ParserNode):
""" A dummy class implementing ParserNode interface """
def __init__(self, **kwargs):
... |
997,781 | 0a9985334493d2f2fe5bbd9ea521e825549f9f99 | """
Quick program to add crimes into the database
"""
import csv
import psycopg2
conn = psycopg2.connect(host="localhost",database="DirectedStudiesFall2019", user="postgres", password="REDACTED")
cur = conn.cursor()
with open('random_blocks_with_location.csv', 'r') as f:
reader = csv.reader(f)
ne... |
997,782 | 8ed1b87ac8ad54ee9ae36c43de379f776a7a324e | from django.urls import path,include
from post.api.views import PostListAPIView,PostCreatelAPIView,PostDetailAPIView,PostUpdatelAPIView
app_name="post"
urlpatterns = [
path("list",PostListAPIView.as_view(),name="list"),
path("detail/<slug>",PostDetailAPIView.as_view(),name="detail"),
path("update/<slug>",P... |
997,783 | 3b58a3dc2afc8fde0902ccf87f0acf0419edfdc8 | import math
x = int(input("Enter a number between 1-10"))
y = int(input("ENter another number between 1-10"))
cal = x ** y
print(cal)
cal2 = math.sqrt(cal)
print(cal2)
while cal2<100000:
cal2 = cal2+1
if cal2 == 100000:
print(cal2) |
997,784 | 4eea87d00d8e76066af317be19440f8aeb7c1db6 | import turtle as t
#터틀이라는 것을 t로써 가져옴 이를통해 turtle이라고 통째로 안써도 됨
n = 60 # 원을 60번 그림
t.shape('turtle') #모양을 거북이로 변환시킴, 화살표등의 여러가지 있음
t.speed('fastest') # 거북이 속도를 가장 빠르게 설정
for i in range(n):
t.circle(120) # 반지름이 120인 원을 그림
t.right(360 / n)
t.mainloop() #프로그래밍을 실행하고 바로 끝나는걸 방지함
# t.shape('turt... |
997,785 | 2c2bd5bed50ebc69759323bb6af5aff4850ed966 | #!/usr/bin/env python
#
# Autogenerated by Thrift Compiler (0.7.0)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
import sys
import pprint
from urlparse import urlparse
from thrift.transport import TTransport
from thrift.transport import TSocket
from thrift.transport import THttpCli... |
997,786 | 078fa9899379ada11f6bd1ed346190b08a820ebf | import numpy as np
def loaddata():
return np.fromfile("ex1data1.txt", int, sep="\n")
if __name__ == "__mian__":
traindata = loaddata()
version = '1.0'
print(version.startswitch('1'))
print('end')
print("Hello the Pycharm!") |
997,787 | 8151b86e80afb1f028b48be72576361ddd041ff4 | from py1811.sungJuk import SungjukService
sjsrv = SungjukService.SungJukService()
std3 = sjsrv.readSungJuk()
print(std3)
sjsrv.computeSungJuk(std3)
print(std3)
|
997,788 | 68f6dc6f0dae3667a5633397655455e3b06cfb65 | import socket
from threading import Thread, Condition
from downloadInThread import MyThread
import argparse
from collections import deque
from Queue import Queue
condition = Condition()
queue = []
class Server(Thread):
def __init__(self,host,port,name):
Thread.__init__(self)
self.port = port
self.host = host
... |
997,789 | a5e88040e0a54f491bc605325bc9ee484cf50ce6 | from django.shortcuts import render
from django.http import HttpResponse
import numpy as np
import pandas as pd
# Create your views here.
from sklearn.externals import joblib
classifier=joblib.load('./models/RFModelforMPG.pkl')
def index(request):
temp={}
temp['ageVal']=50
temp['bs_fastVal']=6.8
temp... |
997,790 | 87c5d81d89e01ea4ab7ea4500a06abc5e69c7726 | import random
from signtest import compute_significance_two_tails
def crossvalidation(datas, class_count, disc, classifier, params={}, fold=10):
random.shuffle(datas)
one_fold_length = len(datas) / fold
fold_with_extra = len(datas) % fold
classification_rate = [0] * fold
start = 0
for i in xr... |
997,791 | 004eeb38bf2503633fdfc373d0cded865cb870be | __author__ = "Nikhil Mehta"
__copyright__ = "--"
#---------------------------
import tensorflow as tf
import numpy as np
import os
class DataHandler:
def __init__(self, data_dir):
self.data_dir = data_dir
self.test_data_loaded = False
def load_data(self):
train_class_file = os.path.... |
997,792 | 585c4958b50e0d3e4d1deb43c8b607864cd66d52 | import os
import json
import logging
from flask import (Blueprint, flash, g, redirect, render_template, request,
url_for, make_response, send_from_directory)
from werkzeug.exceptions import abort
from app.db import get_db, close_db
from app.auth import login_required
bp = Blueprint('hw', __name__)... |
997,793 | 0202b0c94690844c29540f6b846e8da5ae07f91e | from tkinter.constants import END
from tkinter import simpledialog
from tkinter import messagebox
import imap_tools
attachment_path = "./attachment/"
dictionary_email = {}
login_list = []
def imap_login(window):
global login_list
while 1:
window.update_idletasks()
email = simpledialog.askstri... |
997,794 | 33689be0f96cf9020252dbf7df20f84b10b225ad | import os
import random
import string
from typing import Optional, Tuple
import healpy
import pytest
from precovery.orbit import Orbit
from precovery.sourcecatalog import SourceFrame, SourceObservation
def make_sourceobs(
exposure_id: str = "exposure",
id: Optional[bytes] = None,
obscode: str = "obs",
... |
997,795 | c93638f3cd8de1b9d4950c3d8ceaaf46e477713d | from regularizationNetworks import MixGauss
import scipy.io as sio
import numpy as np
import os.path
[Xtr, Ytr] = MixGauss.mixgauss(np.matrix('0 1; 0 1'), np.matrix('0.5 0.25'), 100)
[Xts, Yts] = MixGauss.mixgauss(np.matrix('0 1; 0 1'), np.matrix('0.5 0.3'), 100)
flag = True
while flag:
file_name = raw_input('Ins... |
997,796 | a2a66aa34cdf521393e44e1ec95ea9c856391cdf | def sum(r):# 若函数中的局部变量和全局变量的变量名一样,那么优先使用局部变量
pi=3.14 # 局部变量
return (pi*2*r)
r=input("请输入半径:") # 全局变量
if r.isdigit():
print(sum(float(r)))
else:
print("输入有误")
|
997,797 | 8c1735f8b6a0d5a1f683bab7a39b2f66218405d4 | """Meat Engine
Copyright (C) 2007, Big Dice Games
One practical definition of a "game engine" is "the code you reuse on
your second game". That's mostly tongue-in-cheek, but it isn't far
from the philosophy of what's currently included in MeatEngine.
I've included a variety of pieces of code, not because they're all... |
997,798 | 3d75b0f9947e55bbc0a7b5bf6d88f5bd2c1ac33a | # Alec Dewulf
# "Hidden Palindrome" 2016 J3
# December 31, 2019
pal = input()
lengths = []
x = 1
y = 1
# getting lengths of palindromes that have a middle consisting of 1 letter
while x < len(pal) - 1:
# checking to make sure the guess is whithin the length of the palindrome
while (x + y) < len(pal) and (x - ... |
997,799 | 64dfc5c96aea30d0e420ba9ef1000325711638a6 | import math
import numpy
import matplotlib
matplotlib.use('TkAgg')
from skimage import io
from skimage import feature
from skimage import draw
from skimage import util
from skimage import color
from skimage import morphology
from skimage import filters
from skimage import measure
from skimage import transform
from sk... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.