index int64 0 1,000k | blob_id stringlengths 40 40 | code stringlengths 7 10.4M |
|---|---|---|
997,100 | 41fd06f6d0a1b5b5f3bb47e1a403f9f20c09bd97 | #!/usr/bin/env python
#%!%!%!%!%!%!%!%!%!%!%!%!%!%!%!%!%!%!%!%!%!%!%!%!%!%!%!%!%!%!%!%!%!%!%!%!%!%!%!%!%!%!%!%!%!%!%!%!%#
#%%% --------------------------------- ElaStic_Analyze_Energy -------------------------------- %%%#
#%!%!%!%!%!%!%!%!%!%!%!%!%!%!%!%!%!%!%!%!%!%!%!%!%!%!%!%!%!%!%!%!%!%!%!%!%!%!%!%!%!%!%!%!%!%!%!%!%... |
997,101 | 4f975abc5d6cef43c7f3e65d8c1b42a2f45055dd | #!/usr/bin/env python
# coding=utf-8
import sys
from controle.controle_drone_visao import ControleVisaoDrone, TipoNoVisao
def main(args):
controlevisaodrone = ControleVisaoDrone(TipoNoVisao.NoCameraFrontal)
controlevisaodrone.mostrar_tela_pista = True
#controlevisaodrone.mostrar_tela_inicio_pista = True
... |
997,102 | 6bf5e602851522c71e3c04c9e5dac46906584339 | from django.contrib import admin
from django.conf.urls.defaults import patterns, include
from django.conf import settings
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
admin.autodiscover()
urlpatterns = staticfiles_urlpatterns()
## or import static_urls; urlpatterns = static_urls.urlpatterns... |
997,103 | 3a91c68e3f8a880bb5453b0a3ab8d5b62ff0062f | import distro, utils, random
def _solver(stats):
(mu, sig2) = distro.extractStats(stats, [distro.Stat.Mu, distro.Stat.Sig2])
roots = utils.solve_quadratic_eqn(1, -2 * mu - 1, mu ** 2 + mu - 3 * sig2)
if roots == None:
return None
else:
a = min(roots)
b = 2 * mu - a
retur... |
997,104 | dbb09af7b58e1a13528071d0870aaa05244426fd | import os
import subprocess
from devbot import command
from devbot import config
def _chdir(func):
def wrapped(*args, **kwargs):
orig_cwd = os.getcwd()
os.chdir(args[0].local)
result = func(*args, **kwargs)
os.chdir(orig_cwd)
return result
return wrapped
class Mod... |
997,105 | 8348c03b9ea861257d4096e95684aad3dbdee54e | import requests
import re
from bs4 import BeautifulSoup
url = "https://so.csdn.net/so/search/s.do"
for p in range(10):
p = p + 1
s = 'python'
kv = {'p': '%d' % p, 'q': '%s' % s}
print(kv)
r = requests.get(url, params=kv)
print(r.url)
# {'p': '1', 'q': 'python'}
# {'p': '2', 'q': 'python'}
... |
997,106 | a61135a52e88f62645b3336c7d419c417d30dad7 | # -*- coding: utf-8 -*-
# snapshottest: v1 - https://goo.gl/zC4yUc
from __future__ import unicode_literals
from snapshottest import GenericRepr, Snapshot
snapshots = Snapshot()
|
997,107 | cb965ff89aad66db6b28d8f3a7f25ff1d571c2cc | from utils import *
from GnD import *
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
lr = 0.0006
lr_d = 0.0002
beta1 = 0.5
epochs = 1700
netG = Generator(100, 32, 3).to(device)
netD = Discriminator(3, 48).to(device)
criterion = nn.BCELoss()
#criterion = nn.MSELoss()
optimizerD = optim.Adam(ne... |
997,108 | 6407578733855ae4b98564993c955f4082ad8f74 | from django.contrib import admin
from django.urls import path
import blog.views
urlpatterns = [
path('', blog.views.home, name="home"),
path('post/<int:post_id>', blog.views.detail, name = "detail"),
path('post/new', blog.views.new, name="new"),
path('post/<int:pk>/comment', blog.views.comment_new, nam... |
997,109 | b41a00945de986b8f9a0f0855c992669c4141f1f | import os
THE_KEY = '7HUwodZj+dZiqdJcDe+KaPnH2Pdk6ZL1\n' |
997,110 | d122071caa71de5b188f0423eb3a60fc686d57c0 | from flask.ext.wtf import Form
from wtforms import (
StringField,
PasswordField,
BooleanField,
SubmitField,
TextAreaField,
)
from wtforms.validators import Required, Length, Email, EqualTo
class LoginForm(Form):
email = StringField('Email', validators=[Required(),
... |
997,111 | 05781dd9642538c11c9a3f4239e57050693fe93c | #!/bin/usr/python3
'''
Task
Students of District College have a subscription to English and French
newspapers. Some students have subscribed to only the English newspaper,
some have subscribed to only the French newspaper, and some have subscribed
to both newspapers.
You are given two sets of student roll nu... |
997,112 | 8b582ac33dba1a962ef08d2df3b5f3ac4d4400d4 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2021/01/15
# @Author : yuetao
# @Site :
# @File : 归并排序.py
# @Desc :
class Solution:
def deal(self, nums):
self.length = len(nums)
self.temp = [None] * self.length
self.sort(nums, 0, self.length - 1)
return nums
... |
997,113 | 28c206029457466806477f47b57d8fa718875547 | from google.appengine.ext import ndb
class Course(ndb.Model):
code = ndb.IntegerProperty()
departmentCode = ndb.StringProperty()
departmentName = ndb.StringProperty()
description = ndb.TextProperty()
gradeType = ndb.StringProperty()
isCommIntense = ndb.BooleanProperty()
maxCredits = ndb.Int... |
997,114 | b4846ed876cfa0e4998e1ab4e08393b5aa982fda |
def get_router():
from rest_framework.routers import DefaultRouter
router = DefaultRouter(trailing_slash=False)
return router
|
997,115 | bd089bf390a0356ad965d9155eccb6cc834b03e2 | # -*- coding: utf-8 -*-
import json
from optparse import make_option
import logging
from StringIO import StringIO
import pprint
from django.conf import settings
import psycopg2
import psycopg2.extras
import psycopg2.extensions
from django.core.management.base import BaseCommand
import requests
psycopg2.extensions.regi... |
997,116 | 6698102d14608b2c55888823451b2ced003ad8e6 |
from pylab import *
from numpy import *
from matplotlib import *
from matplotlib.pyplot import *
#from pylab import figure, show, rand
from matplotlib.patches import Ellipse
from mpl_toolkits.mplot3d import Axes3D
# load data from file
report = loadtxt("RBBM181.out")
counter = 0;
num = 1;
angle = report[:,count... |
997,117 | 7602084941b8e9a91c95d463283a3356084969c8 |
import matplotlib.pyplot as plt
from change_rate import *
from vehicle_state import *
from voltage_extreme_diff import *
filename='/home/zhao/python/data_statistic/data/all_file.csv'
filename='/home/zhao/data/车型CC7001CE02ABEV/LGWEEUA5XJE001208/LGWEEUA5XJE001208_20200701-20200801.csv'
vs=Vehicle_state()
#v... |
997,118 | 37e1c7cf8f336e3ae48fc9e4e89c6234ae9539f1 | from Bio.Seq import Seq
from Bio import SeqIO
from Bio.SeqRecord import SeqRecord
import itertools
import os,sys
def read_path(input_file):
with open(input_file) as f:
paths = [li.rstrip('\n') for li in f.readlines()]
return paths
def build_contig_names_dic(contigs_names):
l = len(contigs_names)*2
odd_idx = lis... |
997,119 | 172b1d40c473ddedcf33224aafa3faec54b15beb | import os
# #print(dir(os))
# print(type(dir(5)))
# print(type(os.getcwd()))
# os.chdir('/home/abilash/Desktop')
# print(os.getcwd())
# print(os.listdir())
# print(os.getcwd())
# os.chdir('/home/abilash/Desktop')
# os.makedirs('Abias/a')
# os.removedirs('Abias/a') #will
print(os.listdir())
os.chdir('../')
os.rena... |
997,120 | 117792510a1ec03a5f75e99e441bae8cb44c1949 | import keyboard
import time
while True:
if keyboard.is_pressed('F'):
keyboard.write("hur googlar man") #write "hej"
keyboard.send('enter') |
997,121 | f4dfefe5aba1db0b634389cf86e025c7224d37f1 | import unittest
import miner
from textwrap import dedent
class TesteMiner(unittest.TestCase):
def teste_square_matrix(self):
col = 3
row = 3
matrix = miner.start_matrix(col, row)
cells = 0
for i in matrix:
for j in i:
cells += 1
... |
997,122 | 6f4d4fed5465cde8f5c6795409f4ebec4ced95b1 | import numpy as np
from numba import jitclass # import the decorator
from numba import float32 # import the types
spec = [
('a', float32),
('b', float32),
]
@jitclass(spec)
class test(object):
def __init__(self, a, b):
self.a = a
self.b = b
def f(self, val):
retur... |
997,123 | f9fa332d245e3e69b74230d937f85a39d9b5d805 | #Question: Write a program that asks the user to enter the width and length of a rectangle,
# and then display the rectangle’s area
#• getLength – This function should ask the user to enter the rectangle’s length, and then return that value as a double.
#• getWidth – This method should ask the user to enter the rectang... |
997,124 | 59e86bcc1e6c06163748adc63c23a0b604ce44eb | from UI.Views.View import View
import os, sys
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(21,GPIO.OUT)
GPIO.setup(20,GPIO.OUT)
GPIO.setup(16,GPIO.IN)
class EndView(View):
GPIO.output(21,0)
GPIO.output(20,0)
def render(self, app):
bg = [100, 200, 100] |
997,125 | a27cf90ee690593cd1497549299b27434b8eb877 | import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from scipy import signal
import csv
plt.style.use('ggplot')
def smoothing(curve, a=51):
x = lambda a: max(a, 0)
return np.array(list(map(x, signal.savgol_filter(curve, a, 3))))
fig, axs = plt.subplots(1, 2, constrained_layout=False, figs... |
997,126 | d4b4113425bad82befea8c7e3e8c962b2f2ee7e7 | #!/usr/bin/env python
runCard="""
(run){
% general setting
EVENTS 1M; ERROR 0.99;
% scales, tags for scale variations
FSF:=1.; RSF:=1.; QSF:=1.;
SCALES METS{FSF*MU_F2}{RSF*MU_R2}{QSF*MU_Q2};
% tags for process setup
% YOUR INPUT IS NEEDED HERE
NJET:=1; LJET:=0; QCUT:=20.;
% me generator settings... |
997,127 | f56750701d24e9b689872750ed1bb7f11e802624 | /home/ramdas/anaconda3/lib/python3.7/genericpath.py |
997,128 | 268b515a4b5de1613cc6a0d338bebc2e7a9d0f33 | from flask_sqlalchemy import SQLAlchemy
from werkzeug.security import generate_password_hash, check_password_hash
db = SQLAlchemy()
import datetime
class User(db.Model):
# copied code from Lab 5
id = db.Column(db.Integer, primary_key=True)
username = db.Column(db.String(80), unique=True, nullable=False)
... |
997,129 | d317ddb7048503209228da20ed7316e2e587cdbe | import unittest
import keras_nlp
import keras
import numpy as np
import tensorflow as tf
class TestKerasNLP(unittest.TestCase):
def test_fit(self):
# From https://keras.io/api/keras_nlp/models/bert/bert_classifier/
features = {
"token_ids": tf.ones(shape=(2, 12), dtype=tf.int64),
... |
997,130 | 721a9e630fa2c8819382d0577eec0f5f31ee2acf | a=()
print(a==None) |
997,131 | 71126d52ef7a688dbf8033f402f97f2406be0aba | # Program for printing n no. of
# Fibonacci Series
def fab(n):
if n==0: # returning zero if n is equal to 0
return(0)
if n==1 or n==2: # returning one if n is equal to 1 or 2
return(1)
else:
return(fab(n-1)+fab(n-2)) # the main condition for printing whole Series
inp=int(input())... |
997,132 | d19731dc618b1a08c89ec70d88c078855116486a | #!/usr/bin/env python3
import socket
from time import time, sleep
from textwrap import dedent
from socket import AF_INET, SOCK_DGRAM, SOL_SOCKET, SO_REUSEADDR
import sys
import struct
import os
import os.path
import re
import tftp
from docopt import docopt
from socketserver import BaseRequestHandler, Thre... |
997,133 | da5079d49dc164b89f4d26957ce54ba593588037 | #!/usr/bin/python3.8
import os
import sys
import argparse
import configparser
def _argparse():
parser = argparse.ArgumentParser(description="This is description")
parser.add_argument('-c', '--config', action='store', dest='config', default='config.txt', help="this is config file")
return parser.parse_args... |
997,134 | 9338e3f0f0ea0690c141e27e9317b8199eca9215 | import sys
import copy
class Board():
_inputString = None
_boardMatrix = None
#create board using inputString
def __init__(self, inputString):
self._inputString = inputString
self._createBoardMatrix()
def _createBoardMatrix(self):
self._boardMatrix = self._inputString.spli... |
997,135 | 7dad54ad3c42d9237100443bef98ada3b9803d66 | """
This file contains the tests required by pandas for an ExtensionArray and ExtensionType.
"""
import warnings
import numpy as np
import pandas as pd
import pandas._testing as tm
import pytest
from pandas.core import ops
from pandas.tests.extension import base
from pandas.tests.extension.conftest import (
as_fra... |
997,136 | f1cc4f03968259f6faeb4377010bb1fe9d21d211 | from rest_framework import serializers
from rest_framework.permissions import IsAuthenticated
import logging
from qualiCar_API import models
# Get an instance of a logger
logger = logging.getLogger(__name__)
class qualiCarSerializer (serializers.Serializer):
""" Serializes a name field for testing our APIView ... |
997,137 | 801d907c522ddb48e870cc5dcc0d86db1b1df14a | '''
---------------------------
Licensing and Distribution
---------------------------
Program name: Pilgrim
Version : 2021.5
License : MIT/x11
Copyright (c) 2021, David Ferro Costas (david.ferro@usc.es) and
Antonio Fernandez Ramos (qf.ramos@usc.es)
Permission is hereby granted, free of charge, to any perso... |
997,138 | af1af18bf34c1d119f0e3a7e83d220a0516f403f | #!/usr/bin/env python3
"""
Defines a single function birthday_dictionary() that takes no output and performs some
standard-input & standard-output operations.
"""
def birthday_dictionary():
'''
Takes no external input (as everything is defined internally).
Final output is a message displaying the birthday... |
997,139 | 57f744c18f1ccdb18497dbca268d492eed5f8f74 | import os
import warnings
from typing import List, cast
import cv2
import numpy as np
from mtcnn.mtcnn import MTCNN
from .utils import fix_mtcnn_bb, preprocess, get_center_box
from .facenet_types import AlignResult, Face, Landmarks, Image
warnings.filterwarnings("ignore", message="numpy.dtype size changed")
war... |
997,140 | 30b08eafd667ca9d04b8f378fbdd4b6bd8c56c45 | def createCityPopDict():
file = open('pop3.txt','r')
s = file.read()
file.close()
D ={}
lines = s.split('\n')
for eachLine in range(len(lines)-1):
cityPop = lines[eachLine].split()
strPop = ''.join(cityPop[-1:])
intPop = int(strPop)
D['... |
997,141 | e9796e3647115d626179cd5e4dd775099379730b | #!/usr/bin/env python3
#
# MIT License
#
# Copyright (c) 2020 Josep Torra
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to u... |
997,142 | 0fbb9464422af43fa121c6b6e2c2a37395442f09 | def call(services, packet, response):
print(123)
print(234)
|
997,143 | 20aae9196c7bb24ef22072f08cf5222bd515f1b1 | # -*- coding: utf-8 -*-
"""Test module for client and server modules."""
import pytest
from server import BUFFER_LENGTH, OK_200, ERR_400, ERR_405, ERR_505
U_H = u'HTTP/1.1'
U_200 = u'{} {}'.format(U_H, OK_200.decode('utf-8'))
U_400 = u'{} {}'.format(U_H, ERR_400.decode('utf-8'))
U_405 = u'{} {}'.format(U_H, ERR_405.d... |
997,144 | cf81301339549a809a1997aaf56eae8491cc124b | import sys
input = sys.stdin.readline
n = int(input())
N = list(sorted(map(int, input().split()))) # 값 받자마자 정렬
m = int(input())
M = list(map(int, input().split()))
def binary(i, N, start, end) :
if start > end : # 순서가 이상하면 0
return 0
m = (start + end) // 2 ... |
997,145 | 3d80ab9bd8388c18fb54837514e566c1d0df8aef | from django.shortcuts import render, redirect
from .models import client, project, requirement, task, rol, error, comment
from .forms import client_form, project_form, requirement_form, task_form, rol_form, error_form, comment_form
from django.contrib.auth.models import User
# Login
from django.contrib.auth.form... |
997,146 | 3d44068f2673d1ce915e38e86a9404c824ddbd43 | import tensorflow as tf
import cv2, os
import numpy as np
from random import shuffle
import copy
#####
#Training setting
BIN, OVERLAP = 2, 0.1
NORM_H, NORM_W = 224, 224
VEHICLES = ['Car', 'Truck', 'Van', 'Tram','Pedestrian','Cyclist']
def compute_anchors(angle):
anchors = []
wedge = 2.*np.pi/BIN
l_i... |
997,147 | 63748e51f2776a50064505c17cfec29202d58572 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Project: EN_Char_CNN_Text_Classification
# @File : train.py
# @Author : Origin.H
# @Date : 2018/1/11
import os
import logging
import char_cnn
import config
import hyperparameters
if __name__ == "__main__":
train_name = 'ag_news'
logging.basic... |
997,148 | 0a05479d2fa6badb7214449271f38aa1e1d47341 | # encoding: utf-8
# !/usr/bin/env python
'''
@author : wersonliu
@File : forms.py
@data :
'''
from django import forms
import re
from operation.models import UserAsk
# 1.传统写法
# class UserAskForm(forms.Form):
# name = forms.CharField(required=True, min_length=2, max_length=20)
# phone = forms.CharFi... |
997,149 | c5b908e16e4cb057f6b360466aad79544c90664b | def main():
print(Node(Leaf(1), Leaf(2)).nodes())
class Node:
def __init__(self, left, right):
self.left = left
self.right = right
def nodes(self):
return self.left.nodes() + self.right.nodes() + 1
class Leaf:
def __init__(self, val):
self.val = val
def nodes(self):
... |
997,150 | 4b404c81965bff928ef9eec8a0f36fa80599e247 |
import ConfigParser
class MyIni:
def __init__(self, conf_path='my_ini.conf'):
self.conf_path = conf_path
self.cf = ConfigParser.ConfigParser()
self.cf.read(conf_path)
def get_kakou(self):
conf = {}
section = 'KAKOU'
conf['host'] = self.cf.get(section, 'host')
... |
997,151 | 5f7200b12b8a0e36a67fc78a37b34c461512cd30 | import sys
sys.path.append('./language_model/')
import msa_class
import torch
import numpy as np
import networkx as nx
from torch.autograd import Variable
from collections import defaultdict
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.metrics.pairwise import cosine_similarity
import math
im... |
997,152 | 2631a28babeec9faa7cbb8a753746ebc8b4cbefb | import nltk #splits a tweet in a list of words
import sys
import os
class Analyzer():
"""Implements sentiment analysis."""
def __init__(self, positives, negatives): #takes path to list of positive and negative words as argument
"""
Initialize Analyzer.
Loads positive and negative words... |
997,153 | b9f044b5d789a95179008980b7a529403be69a92 | from widgets.gameWidget import GameWidget
from widgets.menuWidget import MenuWidget
from widgets.intermWidget import IntermWidget
from widgets.settingsWidget import SettingsWidget
from widgets.helpDialog import HelpDialog
from widgets.conclusionWidget import ConclusionWidget
from widgets.aboutDialog import AboutDialog
... |
997,154 | b491b91bbe888d8de46cbbe2687180d47d60a50a | import unittest
from data.ticker import Ticker
from data.candle import Candle
from data.order_book import OrderBook
from data.trade_history import TradeHistory
from utils.time_utils import get_now_seconds_local, get_now_seconds_utc
from utils.debug_utils import set_logging_level, LOG_ALL_ERRORS
from binance.ticker_u... |
997,155 | f0b572268b4b1a057e2d1937f23d788e886c5272 | input = """
p cnf 9 13
-1 -2 0
-1 2 3 0
-1 4 -5 0
-6 -1 7 0
-1 -2 0
-1 2 3 0
-1 4 -5 0
-6 -1 7 0
1 -2 0
1 -3 0
1 -4 0
8 1 2 0
-9 1 2 0
"""
output = """
SAT
"""
|
997,156 | 49cdc573df0be9f24dc012f3839bd5c18608618d | import sys
from PyQt4 import QtGui, QtCore, QtSql
import mysql_table_meta
class ExpenseModel(QtSql.QSqlTableModel):
def __init__(self, tablename, db, parent=None):
QtSql.QSqlTableModel.__init__(self, parent, db)
self.tablename = tablename
self.setTable(tablename)
#self.setEditStrategy(QtSql.QSqlTableModel.O... |
997,157 | e583dfc1a8fba4507f04503e41502330ca844f79 | #!/usr/bin/env python3
import sys
T = int(sys.stdin.readline())
def main():
for x in range(1, T+1):
print("Case #{}: ".format(x), end="")
global flips, row, i, K
flips = 0
string = sys.stdin.readline()
pieces = string.split(" ")
row = list(pieces[0]) # use list instead of string so it can be modified
K... |
997,158 | b8454c1f0ee2659271d2835f0177c188e00f25c9 | """Permit List module"""
import json
import falcon
import jsend
import sentry_sdk
from screendoor_sdk.screendoor import Screendoor
class PermitList():
"""Permit List class"""
scrndr = None
scrndr_proj_id = None
logger_name = ''
referred_label_map = {
'MOD - Referred' : "Mayor's Office of D... |
997,159 | f2e250ba5a2d0e2f5c559fe42fbe0926bdf15670 | """Future-returning APIs for coroutines."""
# Copyright (c) PyZMQ Developers.
# Distributed under the terms of the Modified BSD License.
from collections import namedtuple, deque
from itertools import chain
from zmq import EVENTS, POLLOUT, POLLIN
import zmq as _zmq
_FutureEvent = namedtuple('_FutureEvent', ('future... |
997,160 | a3551f35df02f6dd1c808a2c3a5d0dc5bcd70383 | from __future__ import print_function
import torch as t
#set requires_grad, pytorch will invoke autograd automatically
x = t.ones(2, 2, requires_grad=True)
print(x)
y = x.sum()
#y = x[0, 0]*x[0, 0] + x[0,1] + 3*x[1,0] + 8
print(y.grad_fn)
y.backward()
# y = x.sum() = (x[0][0] + x[0][1] + x[1][0] + x[1][1])
# every g... |
997,161 | 9abe68eb1a9b1cb7c72c125c65d11b0352b473f8 | /home/joseu/miniconda2/lib/python2.7/warnings.py |
997,162 | 2195dd13acb266e825fea711b81e5d1cef831871 | from slackeventsapi import SlackEventAdapter
from slackclient import SlackClient
import json
import os
import pprint
# Our app's Slack Event Adapter for receiving actions via the Events API
SLACK_VERIFICATION_TOKEN = os.environ["SLACK_VERIFICATION_TOKEN"]
slack_events_adapter = SlackEventAdapter(SLACK_VERIFICATION_TOK... |
997,163 | a77dc5a4a63fe3bf70ea2e369e075c7056914055 | # this this imple DDPG method
# http://pemami4911.github.io/blog/2016/08/21/ddpg-rl.html
|
997,164 | 96714e75f84d8ec441f81c2f61ad292088a95666 | import torch.nn as nn
import torch.nn.functional as F
import torch
import numpy as np
class Seq2seq(nn.Module):
""" Standard sequence-to-sequence architecture with configurable encoder
and decoder.
Args:
encoder (EncoderRNN): object of EncoderRNN
decoder (DecoderRNN): object of DecoderRNN... |
997,165 | ce8cda1af230519d4f7f1eede844cfee92061463 |
from muntjac.api import Window
from muntjac.demo.sampler.APIResource import APIResource
from muntjac.demo.sampler.Feature import Feature, Version
class JSApi(Feature):
def getSinceVersion(self):
return Version.V62
def getName(self):
return 'JavaScript API'
def getDescription(self):
... |
997,166 | 52eb0a3e6f33c4609cacd056693a663e46bba391 | reg = {}
instru = []
def initReg(r):
if not r in reg:
reg[r] = 0
return r
def runCon(g, h, c):
if c == "==":
return g == h
if c == ">":
return g > h
if c == "<":
return g < h
if c == ">=":
return g >= h
if c == "<=":
return ... |
997,167 | 8234e61472b986ba819f1f58b47bc552967abfa0 | from sklearn.feature_extraction.text import TfidfVectorizer
import numpy as np
from nltk.corpus import stopwords
from nltk.tokenize import word_tokenize
def find_keyword_sentence(str):
icnt = 0
keyword = ''
for element in str:
if element == ' ':
icnt = icnt+1
if(icn... |
997,168 | e94f94e1ba248eb8959e96bdd658d9ad2367d7d5 | #
# Roli Tweet printer
# Written by Andrej Rolih, www.r00li.com
#
import html
import unicodedata
from unidecode import unidecode
def deEmojify(inputString):
returnString = ""
lastAdded = None
for character in inputString:
try:
character.encode("ascii")
returnString += cha... |
997,169 | 30cfa6ee1f08fda1b2b995feb85685116d13b4bf | import random
import os
import itertools
sudoko=[]
for i in range(9):
row=[] #creating an empty sudoko with '.' only
for j in range(9):
row.append(".")
sudoko.append(row)
def ransudo(): #a function to generate a random completely solved sudoko
sudoko=[
"*********",
"*********",
"*********",
"****... |
997,170 | 2ecc7ed1e1c2eb3ea116d08c1a0d9769c6d4b2ab | # !/usr/bin/python
# -*-coding:UTF-8 -*-
try:
import thread
except ImportError:
import _thread as thread
from collections import deque
import websocket
from okex_utils import cal_rate, timestamp2string
import codecs
from trade import buyin_less, buyin_more, json, ensure_buyin_less, \
ensure_buyin_more,okFu... |
997,171 | dbfae1941cdfd84ba0dd6fb5172adc081e579d4c | from app import db
from models import User
db.session.add(User('pierre','pierre@libert.xyz','sesamo'))
db.session.add(User('paris','paris@libert.xyz','sesamo'))
db.session.commit()
|
997,172 | 1a02e011d18cd322dc70d2cfd5fcb25b2a830c68 | from pathlib import Path
import pickle
import logging
import numpy as np
from scipy import sparse
import pandas as pd
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_extraction.text import TfidfVectorizer
import data.MLP400AV.mlpapi as mlpapi
def load(schema='A2', path_to_ds='../data... |
997,173 | fb7d3884efe999a946fc3b8c885cc2f263061be2 | import numpy
import scipy
import scipy.stats
import matplotlib.pyplot as plt
def mean_confidence_interval_uncorrelation_student(data, a=0.05):
# Вычисляет доверительный интервал для выборки data для доверительной вероятности confidence
n = len(data) # размер выборки
mean = numpy.mean(data) # среднее
... |
997,174 | d8c205837a3f972549fd6abd2f19de3de81c87ac | c = int(input())
print(int(c * 9 / 5 + 32))
|
997,175 | 45434c593e8f88fbdbd68242ba2bf065c1d66f4e | from django.conf.urls import include, url
from django.contrib import admin
from django.views.generic import TemplateView
from person.templates import *
urlpatterns = [
url(r'^$', TemplateView.as_view(template_name="index.html"), name='index'),
url(r'^polls/', include('polls.urls')),
url(r'^admin/', admin.s... |
997,176 | d2419a6ffaaead852f4b1f0baabbe80dc62b89ef | from pkg_resources import DistributionNotFound, get_distribution
from mpirical.decorator import mpirun # noqa: F401
try:
__version__ = get_distribution(__name__).version
except DistributionNotFound:
# package is not installed
pass
|
997,177 | aa6d95423d68b34f1ca1865749b7758ae3808ceb | """
Flowblade Movie Editor is a nonlinear video editor.
Copyright 2012 Janne Liljeblad.
This file is part of Flowblade Movie Editor <http://code.google.com/p/flowblade>.
Flowblade Movie Editor is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public Lice... |
997,178 | 847d48f395668317ab9dde29c2b3a3382a178f64 | import math
# does input contain a 3.4.5 triangle?
def is_triangle(input):
for i in range(len(input)):
for j in range(i + 1, len(input)):
for k in range(j + 1, len(input)):
if input[i] ** 2 + input[j] ** 2 == input[k] ** 2:
return True
return False
# p... |
997,179 | daf7cf68445703f157ca63a7590b4c6bbc57398f | #EXERCISE 1
class Cat:
species = 'mammal'
def __init__(self, name, age):
self.name = name
self.age = age
print(f"{name} Initialized!")
def oldest(self,*args):
ages = [i.age for i in args]
x= max(ages)
print(f"The oldest cat is {x} years old")
return x
... |
997,180 | f47fa202b4e832cd7dbb5db046b8248ffed9d3a3 | from django.conf.urls import include, url
from asgc_resource import views
urlpatterns = [
url(r'^primary_info/$', views.primaryinfo_list),
url(r'^primary_info/(?P<hostname>[a-z0-9\-]+)/$', views.primaryinfo_list_detail)
]
|
997,181 | 9a9ae6903e0244ece90cb354ed3baa61b8fb9aac | # -*-coding:utf-8-*-
# @Author: Damon0626
# @Time : 19-4-15 下午11:03
# @Email : wwymsn@163.com
# @Software: PyCharm
'''
Given a singly linked list, determine if it is a palindrome.
Example 1:
Input: 1->2
Output: false
Example 2:
Input: 1->2->2->1
Output: true
Follow up:
Could you do it in O(n) time and O(1) space?
... |
997,182 | f09f4084de667bc962c00040ba2600d47978737e | # -*- coding: utf-8 -*-
# ---------- Libraries --------------
# base library for dash
import dash
import dash_core_components as dcc #contains base dash components
import dash_html_components as html #Contains the html tags
import plotly.express as px
import plotly.graph_objs as go
import pandas as pd #For data man... |
997,183 | d553dc67f00acdcb6ec0279be3e472baa1ecace8 | lines = input()
for line in range(lines):
number = raw_input()
count = 0
for digit in s:
if digit != 0:
if int(num) % int(digit) == 0:
count += 1
print count |
997,184 | 819f6ca176e2803737a9e54653b5148acc954eb3 | import os
def list_all_files(root, filenames):
if os.path.isdir(root):
for d in os.listdir(root):
list_all_files(os.path.join(root, d), filenames)
else:
filenames.append(root)
|
997,185 | 589d73b86464d710d860a7ad5046b69350a76572 | import json
import cv2
import numoy as np
import os
import datetime
annotations={}
img_num=0
info={} #bigger
images=list(image)
annotations=list(annotation)
licenses=list(license)
description={}
info['description']=Vdot_Assets
info['url']=""
info['version']
info_bigger['images']=image
info={"description": "Vdot_Assets"... |
997,186 | 2f656dae0f4db58ba1624498bb9a4af4d1e16f7a | #!/usr/bin/python
from math import sin , log10,pow,pi,sqrt
import matplotlib.pyplot as plt
import numpy as np
def plot_model(f_m):
plt.close('all')
for i in f_m:
plt.plot(m)
#plt.ylabel('DB(Z)')
#plt.xlabel('Frequency')
#plt.xscale('log')
plt.show()
def main(plot_file):
plot_model(load_data(plot_fil... |
997,187 | a5fd65a7ac2b82e3993cb7c1c597db8763505d84 | """
The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.
Find the sum of all the primes below two million.
"""
from problems.problem_3 import is_prime
def next_prime(n):
"""Find prime number up to n"""
i = 1
known_prime = []
while i < n:
if is_prime(i, known_prime):
known_prime.... |
997,188 | 0e6b7ab56d7a88b776b426e63a22df61d4906b67 | # encoding=utf-8
from admin.route import custom_url
from admin.article.views import article
from admin.article.views import article_classify
from admin.article.views import article_comment
urlpatterns = [
custom_url('^article_list$', article.article_lists, name='article_list', alias_name=u'文章管理'),
custom_url('... |
997,189 | 268abf34cbc3cfa9a8a9ef704f6eceb3167c0ae6 | from django.conf.urls import url, include
from .views import TestView, PersonViewSet
from rest_framework.routers import DefaultRouter
touter = DefaultRouter()
touter.register(r'prson',PersonViewSet)
urlpatterns = [
url(r'^test/$', TestView.as_view()),
url(r'^', include(touter.urls))
] |
997,190 | 9d95b718589e02920e3af20037fcd92287d8e2c1 | def is_power_of_two(num):
return num > 0 and (num & (num - 1)) == 0
def is_power_of_three(num):
while(num % 3 == 0):
num /=3
return num == 1
output = is_power_of_two(64)
print(output) |
997,191 | 6003a985d89040dea3a4905a4dc4e7c9a749d888 | #descobrir o tipo do triângulo
def Q1():
A = int (input("Insira o lado A: "))
B = int (input("Insira o lado B: "))
C = int (input("Insira o lado C: "))
if A+B>C and A+C>B and B+C>A:
if (A == B == C) :
print ("ABC é um triângulo equilátero")
elif A == B and B!=C:
... |
997,192 | 3e720f6f48c359cc1e0c835ffe1fb378884a8c20 | #-
# ==========================================================================
# Copyright 1995,2006,2008 Autodesk, Inc. All rights reserved.
#
# Use of this software is subject to the terms of the Autodesk
# license agreement provided at the time of installation or download,
# or which otherwise accompanies this soft... |
997,193 | 4de43372be7aaaa10f75281f274495d7d6fc624e | from django.conf.urls import url
from django.conf.urls import include
from . import views
urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^generic/$', views.generic, name='generic'),
url(r'^elements/$', views.elements, name='elements'),
]
|
997,194 | 872589edff72922461aabc73166dabc8755816ad | # -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2015-12-31 18:18
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('api', '0002_remove_user_expiredatetokenspotify'),
]
o... |
997,195 | 1627e55715441135088c5ce89fc555e884ce9497 | import dash_html_components as html
import dash_bootstrap_components as dbc
import dash_core_components as dcc
def create_cloud_page(Scrapedreviews,freq):
layout=html.Div(children=[
html.Div(className='cloud-page-bg',children=[
html.Marquee(className='cloud-page-marquee',children=[
... |
997,196 | 6e741fcd66e8095917d54dfc5beccedc0e6beec8 | from __future__ import absolute_import
import json
import pytest
from django.urls import reverse_lazy
from le_utils.constants import content_kinds
from le_utils.constants import exercises
from .base import BaseAPITestCase
from contentcuration.models import AssessmentItem
from contentcuration.models import ContentNod... |
997,197 | b349116bb6bbb1ccb84114626da396c8b6a93694 | from typing import List
def cons(it, elem):
yield from it
yield elem
class Cosets:
def __init__(self, ngens, data=()):
assert len(data) % ngens == 0, 'invalid length starting row'
self.ngens = ngens
self.data = list(data)
self.len = len(data) // ngens
def add_row(se... |
997,198 | 52cc06c8b2f3337305e337cf6b289c7cd03c7728 | #!/usr/bin/env python
# coding: utf-8
# In[65]:
import numpy as ny
import pandas as pd
from matplotlib import pyplot as plt
plt.plot("dataR2.csv")
plt.show("dataR2.csv")
data=pd.read_csv("dataR2.csv")
x=data.drop("Classification",1)
y=data["Classification"]
from sklearn.model_selection import train_test_split
x_trai... |
997,199 | 25411849e7250b98cad4dbfc64391daaedb8b8f4 | import time
#
# k = 0
# while (k < 45):
# print("This is harry bhai")
# k += 1
#
# for i in range(45):
# print("This is harry bhai")
#
#now we have to loops for printing same value 45 times and suppose we want to know which
# loop runs faster we use time modules
initial=time.time()# this will tell time in... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.