index int64 0 1,000k | blob_id stringlengths 40 40 | code stringlengths 7 10.4M |
|---|---|---|
6,900 | f25d86e857970854b2239ce0ab5280132b89280e | # -*- coding: utf-8 -*-
'''
一球从100米高度自由落下
每次落地后反跳回原高度的一半;再落下,求它在第10次落地时,共经过多少米?第10次反弹多高?
求两个东西, 1是经过了多少米, 2是反弹多高
1: 100 100+50+50 100+50+50+25+25
2: 100 100/2=50 50/2=25 25/2=2
'''
import math
start_height = 100
rebound_rate = 0.5
meter_list = [100]
def rebound(time):
m = start_height*(r... |
6,901 | 5bb894feaf9293bf70b3f831e33be555f74efde8 | from django import forms
from .models import File, Sample, Plate, Well, Machine, Project
class MachineForm(forms.ModelForm):
class Meta:
model = Machine
fields = ['name', 'author', 'status', 'comments']
class ProjectForm(forms.ModelForm):
class Meta:
model = Project
fields = ... |
6,902 | fc06d8a26a99c16a4b38ad0b4bbb28a1dc522991 | #This script reads through a Voyager import log and outputs duplicate bib IDs as well as the IDs of bibs, mfhds, and items created.
#import regular expressions and openpyxl
import re
import openpyxl
# prompt for file names
fname = input("Enter input file, including extension: ")
fout = input("Enter output file, witho... |
6,903 | fca46c095972e8190ee9c93f3bddbb2a49363a7f | # coding: utf-8
"""
Meme Meister
API to create memes # noqa: E501
OpenAPI spec version: 0.1.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import swagger_client
from swagger_client.api.default_api import DefaultA... |
6,904 | 0b7523035fdad74454e51dc9da9fc4e9bea2f6bf | import typing
from rest_framework.exceptions import ValidationError
from rest_framework.request import Request
def extract_organization_id_from_request_query(request):
return request.query_params.get('organization') or request.query_params.get('organization_id')
def extract_organization_id_from_request_data(re... |
6,905 | 378c07c512425cb6ac6c998eaaa86892b02a37b8 | """
Like Places but possibly script based and temporary.
Like a whisper command where is keeps tracks of participants.
""" |
6,906 | ee161ff66a6fc651a03f725427c3731bdf4243eb | from django.shortcuts import render
from django.http import HttpResponse
# # Create your views here.
# def Login_Form(request):
# return render(request, 'Login.html') |
6,907 | 83a92c0b645b9a2a483a01c19a47ab5c296ccbd9 | import numpy as np
import sys
import os
import os.path
import json
import optparse
import time
import pandas as pd
#Randomize and split the inference set according to hor_pred
#Generate .npy file for each hp selected
#Coge valores aleatorios de la columna de etiquetas en función del horizonte de predicció... |
6,908 | 3d854c83488eeafa035ccf5d333eeeae63505255 | thisdict = {"brand": "ford", "model": "Mustang", "year": 1964}
module = thisdict["modal"]
print("model:", module)
thisdict = {"brand": "ford", "model": "Mustang", "year": 1964}
module = thisdict.get["modal"]
print("model:", module) |
6,909 | c024e12fe06e47187c25a9f384ceed566bf94645 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Module that defines a controller for database's operations over business rules
"""
# built-in dependencies
import functools
import typing
# external dependencies
import sqlalchemy
from sqlalchemy.orm import sessionmaker
# project dependencies
from database.table im... |
6,910 | d82b68d5c83ae538d7a8b5ae5547b43ac4e8a3d4 | from models.readingtip import ReadingTip
from database import db
class ReadingTipRepository:
def __init__(self):
pass
def get_tips(self, user, tag="all"):
if tag == "all":
return ReadingTip.query.filter_by(user=user).all()
else:
return ReadingTip.query.filter_by... |
6,911 | 8535020e7157699310b3412fe6c5a28ee8e61f49 | # coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import copy
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import _ut... |
6,912 | 8474205d49aef2d18755fc1a25a82718962f4120 | times = np.linspace(0.0, 10.0, 100)
result = mesolve(H, psi0, times, [np.sqrt(0.05) * sigmax()], [sigmaz(), sigmay()])
fig, ax = plt.subplots()
ax.plot(times, result.expect[0]) # doctest: +SKIP
ax.plot(times, result.expect[1]) # doctest: +SKIP
ax.set_xlabel('Time') # doctest: +SKIP
ax.set_ylabel('Expectation values') #... |
6,913 | dfe79d2f4bf4abc1d04035cf4556237a53c01122 | import bisect
import sys
input = sys.stdin.readline
N = int(input())
A = [int(input()) for _ in range(N)]
dp = [float('inf')]*(N+1)
for a in A[::-1]:
idx = bisect.bisect_right(dp, a)
dp[idx] = a
ans = 0
for n in dp:
if n != float('inf'):
ans += 1
print(ans) |
6,914 | aa0a69e3286934fcfdf31bd713eca1e8dd90aeaa | from omt.gui.abstract_panel import AbstractPanel
class SourcePanel(AbstractPanel):
def __init__(self):
super(SourcePanel, self).__init__()
def packagePath(self):
"""
This file holds the link to the active panels.
The structure is a dictionary, the key is the class name
... |
6,915 | 44c04cf79d02823318b06f02af13973960413bea | #!/usr/bin/env python
import os, glob, sys, math, time, argparse
import ROOT
from ROOT import TFile, TTree, TH2D
def main():
parser = argparse.ArgumentParser(description='Program that takes as an argument a pattern of LEAF rootfiles (* wildcards work) enclosed by quotation marks ("<pattern>") and creates a root... |
6,916 | a9876c61578a53f29865062c0915db622aaaba72 | from PIL import Image
from pdf2image import convert_from_path
import glob
from pathlib import Path
import shutil, os
from docx import Document
import fnmatch
import re
import shutil
def find_files_ignore_case(which, where='.'):
'''Returns list of filenames from `where` path matched by 'which'
shell patter... |
6,917 | 6a8007e44d2c4b56426cd49772cbc23df2eca49c | #program_skeleton.py
#import load_json_files as bm
import write
import merge as m
import load_df as ldf
import load_vars as lv
import log as log
import clean_df as clean
import download as dl
import gc
import confirm_drcts as cfs
import fix_files as ff
import readwrite as rw
import df_filter as df_f
import realtor_scr... |
6,918 | 78ddae64cc576ebaf7f2cfaa4553bddbabe474b7 | from django.db import models
from orders.constants import OrderStatus
from subscriptions.models import Subscription
class Order(models.Model):
subscription = models.OneToOneField(
Subscription,
on_delete=models.CASCADE,
related_name='order',
)
order_status = models.CharField(
... |
6,919 | 5cd767564e8a261561e141abeebb5221cb3ef2c2 | # Generated by Django 2.2.1 on 2019-05-23 14:07
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('presentes', '0015_caso_lugar_del_hecho'),
]
operations = [
migrations.AddField(
model_name='organizacion',
name='des... |
6,920 | 4d722975b4ffc1bbfe7591e6ceccc758f67a5599 | # Multiple Linear Regression
# To set the working directory save this .py file where we have the Data.csv file
# and then press the Run button. This will automatically set the working directory.
# Importing the data from preprocessing data
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
d... |
6,921 | 253d37f29e33f61d7e1a5ec2f9a1d6307a2ae108 | """
Tests for parsers.py
@author Kevin Wilson <khwilson@gmail.com>
"""
import crisis.parsers as undertest
import datetime
import unittest
class TestParsers(unittest.TestCase):
def test_parse_date(self):
date = '8/5/2013 16:14'
self.assertEqual(datetime.datetime(2013, 8, 5, 16, 14),
undertest.parse_date(da... |
6,922 | 23ba9e498dd153be408e973253d5f2a858d4771b | """Module just for fun game"""
# -*- coding: utf-8 -*-
from __future__ import print_function
from itertools import chain
import tabulate
import numpy
class Game(object):
"""Класс игры"""
def __init__(self):
self.field = numpy.array([(-10, -10, -10), (-10, -10, -10), (-10, -10, -10)])
self.rende... |
6,923 | e60fcf19560b4826577797c8ae8b626ff984dcfd | from pynput import keyboard
# list of chars entered by the user
list = []
number_of_chars = 0
# if entered chars go above MAX LENGTH they will be written inside a file
MAX_LENGTH = 300
def on_press(key):
global number_of_chars
global list
list.append(key)
number_of_chars+=1
if number_of_cha... |
6,924 | ffd11d49f8499b4bfec8f17d07b66d899dd23d2e | # -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-02-26 20:13
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('Cbrowser', '0002_links_l_title'),
]
operations = [
migrations.AddField(
... |
6,925 | 5bcfb0d4fd371a0882dd47814935700eed7885ec | import sys
def main(stream=sys.stdin):
"""
Input, output, and parsing, etc. Yeah.
"""
num_cases = int(stream.readline().strip())
for i in xrange(num_cases):
rows, cols = map(int, stream.readline().strip().split())
board = []
for r in xrange(rows):
board = board +... |
6,926 | f8bb2851192a53e94e503c0c63b17477878ad9a7 | import os
import pandas as pd
from sklearn.decomposition import PCA
import matplotlib.pyplot as plt
name="/home/t3cms/thessel/Workflow1.5/stop_data/stop_train_sig_wc.csv"
name_bkg="/home/t3cms/thessel/Workflow1.5/stop_data/stop_train_bkg_wc.csv"
drop_cols=[0,1,2,15]
names = [i for i in range(16)]
#columns=[]... |
6,927 | 46aa795bb72db0fcd588b1747e3559b8828be17c | #!/usr/bin/env python3.7
import Adafruit_GPIO
import Adafruit_GPIO.I2C as I2C
import time
import sys
import argparse
import os
argparser = argparse.ArgumentParser(
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
description="Select I2C channel multiplexed by TCA9548A")
argparser.add_argument... |
6,928 | d211594a034489d36a5648bf0b926fbd734fd0df | import xdrlib,sys
import xlrd
def open_excel(file='D:\基金公司\数据库-制表符\资产组合-基金公司维度.xlsx'):
try:
data=xlrd.open_workbook('D:\基金公司\数据库-制表符\资产组合-基金公司维度.xlsx')
return data
except Exception as e:
print (str(e))
def excel_table_byindex(file='D:\基金公司\数据库-制表符\资产组合-基金公司维度.xlsx',colnameindex=0,by_inde... |
6,929 | f37d016dc49820239eb42198ca922e8681a2e0a6 | import simplejson as json
json_list = [ "/content/squash-generation/squash/final/Custom.json",
"/content/squash-generation/squash/temp/Custom/final_qa_set.json",
"/content/squash-generation/squash/temp/Custom/generated_questions.json",
"/content/squash-generation/squash... |
6,930 | c700af6d44cd036212c9e4ae4932bc60630f961e | #!/usr/bin/env python3
import os
import fileinput
project = input("Enter short project name: ")
if os.path.isdir(project):
print("ERROR: Project exists")
exit()
os.mkdir(project)
os.chdir(project)
cmd = "virtualenv env -p `which python3` --prompt=[django-" + project + "]"
os.system(cmd)
# Install django wi... |
6,931 | a3ccd526b70db2061566274852a7fc0c249c165a | class Solution(object):
def rotate(self, nums, k):
"""
:type nums: List[int]
:type k: int
:rtype: void Do not return anything, modify nums in-place instead.
"""
ln=len(nums)
k=k%ln
nums[:]=nums+nums[:ln-k]
del nums[0:ln-k]
#menthod 2自己输入[1,2],k=... |
6,932 | 475cc5130e847b1a74a33bfa5cbc202a6bf31621 | from codar.cheetah import Campaign
from codar.cheetah import parameters as p
from codar.savanna.machines import SummitNode
import copy
def get_shared_node_layout (n_writers, n_readers):
nc = SummitNode()
for i in range(n_writers):
nc.cpu[i] = "writer:{}".format(i)
for i in range(n_readers):
... |
6,933 | 4c927f14065d0557dbe7b371002e133c351d3478 | import collections
import itertools
from . import stats
__all__ = [
'Party',
'HoR',
'Coalition'
]
Party = collections.namedtuple('Party', 'name,votes,seats')
class HoR(object):
"""House of Representatives"""
def __init__(self, parties, name='HoR'):
self.name = name
self._parties... |
6,934 | 44274446673225c769f63191d43e4747d8ddfbf7 | # ===================================================================
# Setup
# ===================================================================
from time import sleep
import sys, termios, tty, os, pygame, threading
# ===================================================================
# Functions
# ================... |
6,935 | e47e614c88c78fb6e8ff4098ea2b89d21bfa9684 | import numpy as np
from .metrics import r2_score
class LinearRegression:
def __init__(self):
self.coef_ = None # 系数
self.interception_ = None # 截距
self._theta = None
def fit_normal(self, X_train, y_train):
assert X_train.shape[0] == y_train.shape[0], ""
#!!!impor... |
6,936 | c70681f5ff8d49a243b7d26164aa5430739354f4 | # Uses python3
from decimal import Decimal
def gcd_naive(a, b):
x = 5
while x > 1:
if a % b != 0:
c = a % b
a = b
b = c
else:
x = 1
return b
there = input()
store = there.split()
a = int(max(store))
b = int(min(store))
factor = gcd_naive(a,b)
... |
6,937 | 7539042b92a5188a11f625cdfc0f341941f751f0 | # -*- coding:utf-8 -*-
import requests
from lxml import etree
import codecs
from transfrom import del_extra
import re
MODIFIED_TEXT = [r'一秒记住.*?。', r'(看书.*?)', r'纯文字.*?问', r'热门.*?>', r'最新章节.*?新',
r'は防§.*?e', r'&.*?>', r'r.*?>', r'c.*?>',
r'复制.*?>', r'字-符.*?>', r'最新最快,无.*?。',
... |
6,938 | 3fdf67c3e0e4c3aa8a3fed09102aca0272b5ff4f | from django.db.models import Exists
from django.db.models import OuterRef
from django.db.models import QuerySet
from django.utils import timezone
class ProductQuerySet(QuerySet):
def available(self):
return self.filter(available_in__contains=timezone.now(), category__public=True)
def annotate_subprod... |
6,939 | 47476fbb78ca8ce14d30bf226795bbd85b5bae45 | import os
import numpy as np
import matplotlib.pyplot as plt
from scipy.spatial import distance
with open('input.txt', 'r') as f:
data = f.read()
res = [i for i in data.splitlines()]
print(res)
newHold = []
for line in res:
newHold.append((tuple(int(i) for i in line.split(', '))))
print(newHold)
mapper = np.... |
6,940 | dc2c429bae10ee14737583a3726eff8fde8306c7 | from src import npyscreen
from src.MainForm import MainForm
from src.ContactsForm import ContactsForm
from src.SendFileForm import SendFileForm
from src.MessageInfoForm import MessageInfoForm
from src.ForwardMessageForm import ForwardMessageForm
from src.RemoveMessageForm import RemoveMessageForm
class App(npyscreen.... |
6,941 | 98841630964dd9513e51c3f13bfdb0719600712d | from flask import Flask, render_template, request, jsonify, make_response
app = Flask(__name__)
@app.route("/")
def hello():
# return render_template('chat.html')
return make_response(render_template('chat.html'),200)
if __name__ == "__main__":
app.run(debug=True) |
6,942 | 32c62bb8b6e4559bb7dfc67f4311bc8e71e549c9 | s = 'Daum KaKao'
# s_split = s.split()
# s = s_split[1] + ' ' + s_split[0]
s = s[5:] + ' ' + s[:4]
print(s) |
6,943 | 3346ca7cdcfe9d9627bfe08be2b282897b3c319c | import os
from pathlib import Path
from sphinx_testing import with_app
@with_app(buildername="html", srcdir="doc_test/doc_role_need_max_title_length_unlimited")
def test_max_title_length_unlimited(app, status, warning):
os.environ["MAX_TITLE_LENGTH"] = "-1"
app.build()
html = Path(app.outdir, "index.htm... |
6,944 | d3425017d4e604a8940997afd0c35a4f7eac1170 | from django import forms
from .models import Appointment, Prescription
from account.models import User
class AppointmentForm(forms.ModelForm):
class Meta:
model = Appointment
fields = '__all__'
widgets = {
'date': forms.DateInput(attrs={'type': 'date'}),
'time': for... |
6,945 | fd564d09d7320fd444ed6eec7e51afa4d065ec4d | import os, time
def counter(count): # run in new process
for i in range(count):
time.sleep(1) # simulate real work
print('[%s] => %s' % (os.getpid(), i))
import pdb;pdb.set_trace()
for i in range(5):
pid= os.fork()
if pid !... |
6,946 | 63d9aa55463123f32fd608ada83e555be4b5fe2c | from tkinter import *
import psycopg2
import sys
import pprint
import Base_de_datos
import MergeSort
class Cliente:
def __init__(self,id=None,nombre=None):
self.id=id
self.nombre=nombre
def ingresar(self):
self.ventanaIngresar= Toplevel()
self.ventanaIngresa... |
6,947 | a25fb9b59d86de5a3180e4257c4e398f22cdbb05 | #!/usr/bin/python
import os
from nao.tactics import Tactic
from nao.inspector import Inspector
def test_file():
print("\n[*] === file ===")
name_libmagic_so = 'libmagic.so.1'
inspector = Inspector("./sample/file", debug=True)
# find_addr = 0x1742D # ret block of is_tar
find_addr = 0x173F8 # return ... |
6,948 | d73832d3f0adf22085a207ab223854e11fffa2e8 | """
"""
import json
import logging
import re
import asyncio
from typing import Optional
import discord
from discord.ext import commands
import utils
logging.basicConfig(level=logging.INFO, format="[%(asctime)s] [%(name)s] [%(levelname)s] %(message)s")
log = logging.getLogger("YTEmbedFixer")
client = commands.Bot... |
6,949 | 56a681015ea27e2c8e00ab8bcc8019d5987c4ee1 | import os
f_s_list = [2, 1.5, 1, 0.5, 0.2]
g_end_list = [500, 1000, 2000, 5000, 10000, 20000, 60000]
h_i_list = [(10000 * i, 10000 * (i + 1)) for i in range(6)]
i_seed_list = [1, 12, 123, 1234, 12345, 123456]
for s in f_s_list:
os.system("python SKs_model.py " + str(s) + " 0 10000 0 relu")
for train_end in g_... |
6,950 | f8f538773693b9d9530775094d9948626247a3bb | import cv2
import numpy as np
import os
from tqdm import tqdm
DIR = '/home/nghiatruong/Desktop'
INPUT_1 = os.path.join(DIR, 'GOPR1806.MP4')
INPUT_2 = os.path.join(DIR, '20190715_180940.mp4')
INPUT_3 = os.path.join(DIR, '20190715_181200.mp4')
RIGHT_SYNC_1 = 1965
LEFT_SYNC_1 = 1700
RIGHT_SYNC_2 = 5765
LEFT_SYNC_2 = 128... |
6,951 | 20722cf82371d176942e068e91b8fb38b4db61fd | from scipy.optimize import newton
from math import sqrt
import time
def GetRadius(Ri,DV,mu):
def f(Rf):
return sqrt(mu/Ri)*(sqrt(2*Rf/(Rf+Ri))-1)+sqrt(mu/Rf)*(1-sqrt(2*Ri/(Rf+Ri)))-DV
return newton(f,Ri)
if __name__ == '__main__':
starttime = time.time()
print(GetRadius(10000.0,23546.2146710... |
6,952 | 616ff35f818130ebf54bd33f67df79857cd45965 | ../testing.py |
6,953 | 77884dd72f5efe91fccad27e6328c4ad34378be2 | import os
import logging
from datetime import datetime
import torch
from naruto_skills.training_checker import TrainingChecker
from data_for_train import is_question as my_dataset
from model_def.lstm_attention import LSTMAttention
from utils import pytorch_utils
from train.new_trainer import TrainingLoop, TrainingLog... |
6,954 | 328c483bf59c6b84090e6bef8814e829398c5a56 | #!/usr/bin/env python
from lemonpie import lemonpie
from flask_debugtoolbar import DebugToolbarExtension
def main():
lemonpie.debug = True
lemonpie.config['DEBUG_TB_INTERCEPT_REDIRECTS'] = False
toolbar = DebugToolbarExtension(lemonpie)
lemonpie.run('0.0.0.0')
if __name__ == '__main__':
main()
|
6,955 | 28978bc75cb8c5585fd0d145fe0d0c0c5456ad2e | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
from django.contrib.auth.models import User
class Tweet(models.Model):
owner = models.ForeignKey(User, related_name='tweets')
content = models.CharField(max_length=255)
when_created = models.DateTimeField(auto_no... |
6,956 | de4c31ad474b7ce75631214aceafbe4d7334f14b | import testTemplate
def getTests():
tests = []
suite=testTemplate.testSuite("Sample Test Cases")
testcase = testTemplate.testInstance("3\n1 1 1\n1 1 1\n1 1 1" , "6" , "Sample #1")
suite.add(testcase)
testcase = testTemplate.testInstance("11\n1 0 0 1 0 0 0 0 0 1 1 \n1 1 1 1 1 0 1 0 1 0 0 \n1 0 0 1 0 0 1 1 0 1 0 ... |
6,957 | 84b98ebf6e44d03d16f792f3586be1248c1d0221 | # Copyright (c) 2015, the Fletch project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE.md file.
{
'variables': {
'mac_asan_dylib': '<(PRODUCT_DIR)/libclang_rt.asan_osx_dynamic.dylib',
},
... |
6,958 | 24f3284a7a994951a1f0a4ef64c951499bbba1b4 | """
pytest.mark.parametrize(“变量参数名称”,变量数据列表[‘123’,‘34’,‘567’,‘78’])
上面的变量个数有4个,测试用例传入变量名称后,会依序4次使用变量的数据,执行4次测试用例
def test001(self,"变量参数名称")
assert 变量名称
""" |
6,959 | cd564ebb51cf91993d2ed1810707aead44c19a6b | #! /usr/bin/env python
# -*- conding:utf-8 -*-
import MySQLdb
import os
import commands
from common import logger_init
from logging import getLogger
import re
from db import VlanInfo,Session,WafBridge
def getVlan(): # get vlan data from t_vlan
session=Session()
vlanport=[]
for info in session.query(VlanIn... |
6,960 | 5eee3953193e0fc9f44b81059ce66997c22bc8f1 | # Make an array of dictionaries. Each dictionary should have keys:
#
# lat: the latitude
# lon: the longitude
# name: the waypoint name
#
# Make up three entries of various values.
waypoints = [
{ 'lat': 106.72888 },
{ 'lon': 0.69622 },
{ 'name': 'Kepulauan Riau' }
]
# Write a loop that prints out all the... |
6,961 | b1573f80395d31017ceacbb998e421daf20ab75f | # class Mob:
# def __init__(self, name, health=10):
# self.name = name
# self.health = health
# def get_hit(self, power):
# self.health -= power
# print(
# f"I, {self.name} was hit for {power} points. {self.health} pts remaining")
# hero = Mob("Sir Barks-alot", 30)... |
6,962 | fa511411e59880fd80fba0ccc49c95d42cb4b78d | import requests
from requests.auth import HTTPBasicAuth
def __run_query(self, query):
URL = 'https://api.github.com/graphql'
request = requests.post(URL, json=query,auth=HTTPBasicAuth('gleisonbt', 'Aleister93'))
if request.status_code == 200:
return request.json()
else:
... |
6,963 | 4d5b2ed016cfc6740c3ee5397c894fabc1bec73f | class CustomPrinter(object):
def __init__(self, val):
self.val = val
def to_string(self):
res = "{"
for m in xrange(64):
res += hex(int(self.val[m]))
if m != 63:
res += ", "
res += " }"
return res
def lookup_type(val):
if str... |
6,964 | fd52379d125d6215fe12b6e01aa568949511549d | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import datetime
class Migration(migrations.Migration):
dependencies = [
('products', '0007_auto_20150904_1320'),
]
operations = [
migrations.AddField(
model_name='custome... |
6,965 | b63221af86748241fdce34052819569a06d37afe | # this is for the 12/30/2015 experiments
# varied over 1, 10, 25, 50, 100 repeat particles per particle
# 10000 particles total per filter
# bias is at 0.8 in both the "real" world (realWorld.cpp)
files = ['data0Tue_Dec_30_20_37_34_2014.txt',
'data0Tue_Dec_30_20_37_49_2014.txt',
'data0Tue_Dec_30_20_38_04_2014.txt',
'd... |
6,966 | 778ee9a0ea7f57535b4de88a38cd741f2d46e092 | txt = './KF_neko.txt.mecab'
mapData = {}
listData = []
with open('./KF31.txt', 'w') as writeFile:
with open(txt, 'r') as readFile:
for text in readFile:
# print(text)
# \tで区切って先頭だけ見る
listData = text.split('\t')
# 表層形
surface = listData[0]
... |
6,967 | c0216dbd52be134eb417c20ed80b398b22e5d844 | from sklearn.cluster import MeanShift
from sklearn.datasets.samples_generator import make_blobs
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import style
style.use('ggplot')
# Create random data points whose centers are the following
centers = [[20, 0, 0], [0, 20, 0], [0, 0... |
6,968 | d13b402b90bb948e5722f45096a8c0a33e4cac67 | import cv2
cam = cv2.VideoCapture("./bebop.sdp")
while True:
ret, frame = cam.read()
cv2.imshow("frame", frame)
cv2.waitKey(1)
|
6,969 | c3bfcb971a6b08cdf98200bd2b2a8fe6ac2dd083 | from partyparrot import convert_with_alphabet_emojis, convert
def test_convert_char_to_alphabet():
assert convert_with_alphabet_emojis("") == ""
assert convert_with_alphabet_emojis(" ") == " "
assert convert_with_alphabet_emojis("\n") == "\n"
assert (
convert_with_alphabet_emojis(" one two")... |
6,970 | 7245d4db6440d38b9302907a6203c1507c373112 |
from django.http import HttpResponse
from django.views.decorators.http import require_http_methods
from django.shortcuts import render, redirect
from app.models import PaidTimeOff, Schedule
from django.utils import timezone
from django.contrib import messages
from app.decorators import user_is_authenticated
from app.... |
6,971 | 2a5c6f442e6e6cec6c4663b764c8a9a15aec8c40 | import hashlib
import json
#import logger
import Login.loger as logger
#configurations
import Configurations.config as config
def generate_data(*args):
#add data into seperate variables
try:
station_data = args[0]
except KeyError as e:
logger.log(log_type=config.log_error,params=e)
... |
6,972 | 179a9cf0713001e361f39aa30192618b392c78c7 | pal = []
for i in range(100, 1000):
for j in range( 100, 1000):
s = str(i*j)
if s[::-1] == s:
pal.append(int(s))
print(max(pal)) |
6,973 | 88a469eba61fb6968db8cc5e1f93f12093b7f128 | from api.decidim_connector import DecidimConnector
from api.participatory_processes_reader import ParticipatoryProcessesReader
from api.version_reader import VersionReader
API_URL = "https://meta.decidim.org/api"
decidim_connector = DecidimConnector(API_URL)
version_reader = VersionReader(decidim_connector)
version = ... |
6,974 | 1cca94040cdd8db9d98f587c62eff7c58eae7535 | from mathmodule import *
import sys
print("Welcome to my basic \'Calculator\'")
print("Please choose your best option (+, -, *, /) ")
# user input part
while True:
try:
A = int(input("Now Enter your first Value="))
break
except:
print("Oops!", sys.exc_info()[0], "occurred.")
while True:
mathoparet... |
6,975 | 427d3d386d4b8a998a0b61b8c59984c6003f5d7b | import subprocess as sp
from .dummy_qsub import dummy_qsub
from os.path import exists
from os import makedirs
from os import remove
from os.path import dirname
QUEUE_NAME = 'fact_medium'
def qsub(job, exe_path, queue=QUEUE_NAME):
o_path = job['o_path'] if job['o_path'] is not None else '/dev/null'
e_path = ... |
6,976 | 6ab5ac0caa44366268bb8b70ac044376d9c062f0 | # Code By it4min
# t.me/it4min
# t.me/LinuxArmy
# -- Combo List Maker v1 --
import time, os
os.system("clear")
banner = '''
\033[92m .o88b. .d88b. .88b d88. d8888b. .d88b.
d8P Y8 .8P Y8. 88'YbdP`88 88 `8D .8P Y8.
8P 88 88 88 88 88 88oooY' 88 88
8b 88 88 88 88 88 88~~~b. 88 88
Y8b... |
6,977 | 9d8d8e97f7d3dbbb47dc6d4105f0f1ffb358fd2f | from enum import Enum
import os
from pathlib import Path
from typing import Optional
from loguru import logger
import pandas as pd
from pydantic.class_validators import root_validator, validator
from tqdm import tqdm
from zamba.data.video import VideoLoaderConfig
from zamba.models.config import (
ZambaBaseModel,
... |
6,978 | 210fcb497334ad8bf5433b917fc199c3e22f0f6e | # -*- coding: utf-8 -*-
#COMECE AQUI ABAIXO
p1=float(input('digite o p1:'))
c1=float(input('digite o c1:'))
p2=float(input('digite o p2:'))
c2=float(input('digite o c2:'))
if p1*c1=p2*c2:
print('O')
if pi*c1>p2*c2:
print('-1')
else:
print('1') |
6,979 | 7b2ad0b4eca7b31b314e32ad57d51be82f0eaf61 | from bs4 import BeautifulSoup
from aiounfurl.parsers import oembed
def test_oembed_not_match(oembed_providers):
oembed_url_extractor = oembed.OEmbedURLExtractor(oembed_providers)
url = 'http://test.com'
assert oembed_url_extractor.get_oembed_url(url) is None
def test_oembed_founded(oembed_providers):
... |
6,980 | 5ee2a51ea981f0feab688d9c571620a95d89a422 | __author__ = 'anderson'
from pyramid.security import Everyone, Allow, ALL_PERMISSIONS
class Root(object):
#Access Control List
__acl__ = [(Allow, Everyone, 'view'),
(Allow, 'role_admin', ALL_PERMISSIONS),
(Allow, 'role_usuario', 'comum')]
def __init__(self, request):
... |
6,981 | 36a7d3ed28348e56e54ce4bfa937363a64ee718f | A, B = map(int, input().split())
K = (B ** 2 - A ** 2) / (2 * A - 2 * B)
print(int(abs(K))) if K.is_integer() else print('IMPOSSIBLE')
|
6,982 | 5186400c9b3463d6be19e73de665f8792d8d68c7 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import tornado.web
from sqlalchemy import desc
from sqlalchemy.orm import contains_eager
from main_app.models.post import Post
from main_app.models.thread import PostThread, User2Thread
from main_app.handlers.base_handler import BaseHandler
class API_Comments(BaseHan... |
6,983 | f93b7f2939bbee9b0cb5402d3e5f5d6c482d37c4 | import pandas as pd
import sweetviz as sv
b = pd.read_csv("final_cricket_players.csv", low_memory=False)
b = b.replace(to_replace="-",value="")
b = b.replace(to_replace="[]",value="")
b = b.replace(to_replace="{}",value="")
b.drop(b.columns[b.columns.str.contains('unnamed',case = False)],axis = 1, inplace = Tru... |
6,984 | 3b613ec75088d6d9a645443df2bbc2f33b80000b | #!/usr/bin/env python
# Creates a new task from a given task definition json and starts on
# all instances in the given cluster name
# USAGE:
# python ecs-tasker.py <task_definition_json_filename> <cluster_name>
# EXAMPLE:
# python ecs-tasker.py ecs-task-stage.json cops-cluster
import boto3
import json
import sys
im... |
6,985 | 4ae24d1e39bdcde3313a8a0c8029a331864ba40e | from tkinter import *
janela = Tk()
janela.title("Teste de frame")
janela.geometry("800x600")
frame = Frame(janela, width = 300, height = 300, bg = 'red').grid(row = 0, column = 0)
#frames servem para caso queira colocar labels e butoes dentro de uma area especifica
#assim deve se declarar o frame como pai no inicio ... |
6,986 | 388772386f25d6c2f9cc8778b7ce1b2ad0920851 | # Generated by Django 2.2 on 2021-01-31 14:11
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app', '0004_product_pr_number'),
]
operations = [
migrations.RemoveField(
model_name='payment',
name='PA_id',
... |
6,987 | b47f15a79f7a82304c2be6af00a5854ff0f6ad3e | import csv
import json
from urllib import request
from urllib.error import HTTPError
from urllib.parse import urljoin, urlparse, quote_plus
from optparse import OptionParser
HEADER = ["id", "module", "channel", "type", "value", "datetime"]
def parse_options():
parser = OptionParser()
parser.add_option("-H", "... |
6,988 | b76c868a29b5edd07d0da60b1a13ddb4ac3e2913 | class Config(object):
DEBUG = False
TESTING = False
class ProductionConfig(Config):
CORS_ALLOWED_ORIGINS = "productionexample.com"
class DevelopmentConfig(Config):
DEBUG = True
CORS_ALLOWED_ORIGINS = "developmentexample.com"
class TestingConfig(Config):
TESTING = True
|
6,989 | a38a5010c9edbed0929da225b4288396bb0d814e | #
# Copyright (c) 2018 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
6,990 | 9dd59fee46bd4bec87cc8c40099110b483ad0496 | import ambulance_game as abg
import numpy as np
import sympy as sym
from sympy.abc import a, b, c, d, e, f, g, h, i, j
def get_symbolic_pi(num_of_servers, threshold, system_capacity, buffer_capacity):
Q_sym = abg.markov.get_symbolic_transition_matrix(
num_of_servers=num_of_servers,
threshold=thres... |
6,991 | b58cc08f8f10220373fa78f5d7249bc883b447bf | from mathgraph3D.core.plot import *
from mathgraph3D.core.functions import *
|
6,992 | 43eb221758ebcf1f01851fc6cda67b72f32a73c7 | #!/usr/bin/python
if __name__ == '__main__':
import sys
import os
sys.path.insert(0, os.path.abspath('config'))
import configure
configure_options = [
'CC=icc',
'CXX=icpc',
'FC=ifort',
'--with-blas-lapack-dir=/soft/com/packages/intel/13/update5/mkl/',
'--with-mkl_pardiso-dir=/soft/com/pack... |
6,993 | 11259c92b005a66e5f3c9592875f478df199c813 | # Name: Calvin Liew
# Date: 2021-01-29
# Purpose: Video game final project, Tic-Tac-Toe 15 by Calvin Liew.
import random
# Function that reminds the users of the game rules and other instructions.
def intro():
print("""\n####### ####### ####### # ... |
6,994 | 007caece16f641947043faa94b8a074efe8ebadb | #!/usr/bin/env python
import rospy
from std_msgs.msg import *
__print__ = ''
def Print(msg):
global __print__
target = int(msg.data.split(';')[0]) * 2
if target == 0:
__print__ = msg.data.split(';')[-1] + '\n' + '\n'.join(__print__.split('\n')[1:])
else:
__print__ = '\n'.join(__print... |
6,995 | 227b71cb6d4cde8f498ad19c1c5f95f7fc572752 | from collections import defaultdict, Counter
import numpy as np
import sys
import re
def parseFile(file, frequency_tree):
readnumber = re.compile('[r]+\d+')
line_spliter = re.compile('\t+')
colon_spliter = re.compile(':')
forward_reads = 0
reverse_reads = 0
unmatched_reads = 0
read_position... |
6,996 | ea0a59953f2571f36e65f8f958774074b39a9ae5 | '''
'''
import numpy as np
from scipy.spatial import distance
def synonym_filter(WordVectors_npArray, WordLabels_npArray):
'''
'''
pass
def synonym_alternatives_range(WordVectors_npArray,
AlternativesVectorOne_npArray,
Alternati... |
6,997 | 50b2b9d1edc8eaa44050e2b3b2375e966f16e10c | '''
-Medium-
*BFS*
You are given a 0-indexed integer array nums containing distinct numbers, an integer start, and an integer goal. There is an integer x that is initially set to start, and you want to perform operations on x such that it is converted to goal. You can perform the following operation repeatedly on the ... |
6,998 | 8240e6483f47abbe12e7bef02493bd147ad3fec6 | from flask import Flask, render_template, flash, request
import pandas as pd
from wtforms import Form, TextField, TextAreaField, validators, StringField, SubmitField
df = pd.read_csv('data1.csv')
try:
row = df[df['District'] == 'Delhi'].index[0]
except:
print("now city found")
DEBUG = True
app = Flask(__name_... |
6,999 | b8f9633ab3110d00b2f0b82c78ad047fca0d3eee | import discord
from app.vars.client import client
from app.helpers import delete, getUser, getGuild
@client.command()
async def inviteInfo(ctx, link):
try:
await delete.byContext(ctx)
except:
pass
linkData = await client.fetch_invite(url=link)
if (linkData.inviter):
inviterData... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.