index int64 0 1,000k | blob_id stringlengths 40 40 | code stringlengths 7 10.4M |
|---|---|---|
11,300 | 93f36cc93021abaed35a8147764fff977d79c0eb | eachLine = input()
counter, wrongPass, totIn = 0, 0, 1
while True:
lower = int(eachLine[0 : eachLine.find('-')])
upper = int(eachLine[(eachLine.find('-') + 1) : eachLine.find(' ')])
letterToCount = eachLine[eachLine.find(' ') + 1]
passToCheck = eachLine[(eachLine.find(' ') + 4):]
if lower <= pass... |
11,301 | 23f5de44ef98011f075c4957212f3f5d772b6bde | from knock30 import neko_mecab
for line in neko_mecab():
if line['pos'] == '名詞' and line['pos1'] == 'サ変接続':
print(line['surface'])
|
11,302 | 78f42c9b3d868febeab59433ee470959bd2a39d4 | import collections
import six
import tensorflow as tf
import os
import sys
class ImageReader(object):
def __init__(self, image_format='jpeg'):
with tf.Graph().as_default():
self._decode_data = tf.placeholder(dtype=tf.string)
self._image_format = image_format
self._... |
11,303 | fa52dded5ed4a9863e796d2e840d3e04f6d79f30 | #!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# 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 o... |
11,304 | 24398c627ac4764511b66629b41da24a1873c123 | import sys
import math
read = sys.stdin.readline
def find(x) :
if par[x] == x : return par[x]
else :
par[x] = find(par[x])
return par[x]
def merge(x,y) :
p_x = find(x)
p_y = find(y)
if p_x == p_y : return
par[p_x] = p_y
def dist(x,y) :
return math.sqrt((x[0]-y[0])**2 + (... |
11,305 | 70aa24b0f2d62fea5c02c6af09ac256a316f2d27 | #!/usr/bin/python
""" Use with firmware version 2.2.5 or later.
Cubro Packetmaster REST API demo. Menu driven interface for interacting with
a Cubro Packetmaster via the REST API. """
#Import necessary Python libraries for interacting with the REST API
from __future__ import print_function #Requires Python 2.... |
11,306 | d076c8817f409a4280ed22a49e39ac9e0ce3ed7e |
import os
import errno
import aria as aria_
from aria import core as aria_core
from aria.orchestrator import (
plugin,
workflow_runner
)
from aria.storage import sql_mapi
from aria.storage import filesystem_rapi
class AriaCore():
def __init__(self, root_dir=None):
self._root_dir = root_dir or \... |
11,307 | f646a46ec4291684e35412cff58b4b50616968ca | import pandas as pd
from transformation_script.property_function import rename_properties, remove_trailing_zero
import os
def nucleic_acid_transformation(nucleic_acid_file_name, log, input_files, output_folder):
log.info('Transforming nucleic_acid.csv')
nucleic_acid_df = pd.read_csv(nucleic_acid_file_name)
... |
11,308 | dbaa204b196602a87e08891ee238d55f9360cc81 | import tkinter as tk
from time import sleep
qntr =0
ml = 0
toma = 0
meta = 0
# width = Largura
# height = altura
tconf = tk.Tk()
def quit():
global tconf
tconf.quit()
def confirm(a):
global meta
try:
meta = int(a)
except:
aviso = tk.Label(frame,text = 'V... |
11,309 | b3f7e1292a60918af5a0dc16180e6bf15ecf383e | import requests
from bs4 import BeautifulSoup
import pickle
import os
from urllib.parse import urlparse, unquote, quote, parse_qs
import pandas as pd
import json
from datetime import datetime, timedelta
from base64 import b64encode
class FacebookPostsScraper:
# We need the email and password to access Facebook,... |
11,310 | 1bd04361fac2b37d8e8d0d6b9ff82878033dddf3 | #cmd /K "$(FULL_CURRENT_PATH)"
# -*- coding: utf-8 -*-
# Copyright 2018 Twitter, Inc.
# Licensed under the MIT License
# https://opensource.org/licenses/MIT
"""
Author: Zachary Nowak and Ethan Saari
Date: 01/03/2019
Program Description: Analyze the given
data for sentiment and return value
candidate, date, tweet, li... |
11,311 | ee49cc7deb93273f6922ac80a6db485e4315eae1 | import os
from aiohttp import web
import discord
from linebot import LineBotApi, WebhookParser
from linebot.exceptions import InvalidSignatureError, LineBotApiError
from linebot.models import MessageEvent, TextMessage, StickerMessage, TextSendMessage
class BotVars:
"""bot variables"""
def __init__(self, var_names... |
11,312 | 3b2f78e9d5598d3e2f87de999b67fbd528dfa6a3 | from .models import *
from django.views.generic import ListView, DetailView
from django.shortcuts import render
from django.template.loader import render_to_string
from django.http import JsonResponse
from signals.models import Signals
class PLCListView(ListView):
model = ModuleInPLC
template_name = 'plc/inde... |
11,313 | 73e62cd16dc815b45bb05480b6f1fcd07ff0d638 | #Filename: exercise19
#Author: Kyle Post
#Date: May 14, 2017
#Purpose: To practice with functions
#and variables
#Define the function cheese & crackers with two values/parameters
def cheese_and_crackers(cheese_count, boxes_of_crackers):
print "You have %d cheeses!" % cheese_count
print "You have %d boxes of... |
11,314 | 0bb323a2c49d8bf84d87c5320464dce803033ca4 | ORIGIN_LIST = ['NSW', 'VIC', 'QLD', 'SA', 'WA', 'TAS', 'NT', 'ACT']
ORIGIN_CODE = [['1', '2'], ['3', '4'], ['5', '6'], ['7', '8'], ['9', '10'], ['11'], ['12'], ['13']]
PARENT_LIST = ['YES', 'NO', 'DONT_KNOW']
PARENT_CODE = [['1'], ['0', '2'], ['9']]
CH15TO24_LIST = ['YES', 'NO', 'DONT_KNOW']
CH15TO24_CODE = [['1'], [... |
11,315 | 6dc8cc7e7f45e58d708dce5a435152a474933fe6 |
def equation(x1,x2,y1,y2,x):
a = (y2 - y1) / (x2 - x1)
b = y1 - x1*a
y = a * x + b
return y
with open("valeurs_short_waves.txt","w") as file:
file.write("x1,x2,y1,y2,x,y\n")
while True:
x1 = float(input("x1 : "))
x2 = float(input("x2 : "))
y1 = float(input("y1 : "))
... |
11,316 | 9f9bf4ab0fd0d529b58b3542c8691a57a7dabe4b | #!/usr/bin/python2.7
# -*- coding:utf-8 -*-
# Author: NetworkRanger
# Date: 2019/1/28 7:24 PM
import time
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
driver = webdriver.Firefox()
driver.get('http://www.baidu.com')
assert u'百度' in driver.title
elem = driver.find_element_by_name('wd'... |
11,317 | b8c99d9235bd42cc5889d3a2b7ff0b6789c9e76d | from knmi_database.models import NeerslagStation, Station, MeteoData
from django.contrib.gis.geos import Point
from dateutil import parser
from ftm.settings import DATA_ROOT
WGS84 = 4326
RDNEW = 28992
def importneerslag(fil):
with open(fil) as f:
f.readline()
line = f.readline()
while lin... |
11,318 | ba7bc8aed164ac7029141645b0dbcf39eca0ff0b | '''
Created on Dec 7, 2016
# assume Both lists are sorted
@author: anand
'''
def findMedianSortedArrays(nums1, nums2):
"""
:type nums1: List[int]
:type nums2: List[int]
:rtype: float
"""
sumM = len(nums1)+len(nums2)
mergeAIndex = sumM /2
if sumM %2 ==0:
evenMerge = True
... |
11,319 | 614b022f5b8e519ced516b3576820c0058197c00 | import sys
import socket
HOST = "10.0.0.1"
PORT = 9000
BUFSIZE = 1000
def main(argv):
#Create socket
serversocket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
serversocket.bind((HOST, PORT))
#Keep server on
while True:
msg, addr = serversocket.recvfrom(BUFSIZE)
print("mes... |
11,320 | 57a17f68c10c59fa5928754829d156e3956cfc9d | import codecs
import sys
write = sys.stdout.write
def gcd(x, y):
x = abs(x)
y = abs(y)
while y:
x, y = y, x % y
return x
with codecs.open("C-small-attempt0.in", "r", "utf- 8") as f:
temp = f.readlines()
num = int(temp[0].strip())
line = 1
for i in xrange(num):
t = temp[line].strip().split()... |
11,321 | 4ecb33e240817f2ef3b19a05965ce8b2559c9588 | from typing import *
import copy
class GenericObjectEditorHistory():
MAX_HISTORY_COUNT=10
def __init__(self):
self.m_History=[] #type:List
def add(self,obj:object):
obj=copy.deepcopy(obj)
if obj in self.m_History:
self.m_History.remove(obj)
self.m_History.... |
11,322 | 1258573364d7c70bc18f581a05741779ca955e10 | import socket
from cifrar import *
import asyncio
import datetime
Direcciones={"El_Ocho":("127.0.0.1",5005),"Profesor":("127.0.0.1",5004)}
def dispara_y_olvida(f):
def envuelto(*args, **kwargs):
return asyncio.get_event_loop().run_in_executor(None, f, *args, *kwargs)
return envuelto
def enviar_al_equ... |
11,323 | 43205adca4beb0f1cae9fc83d67b8049f879bf81 | # Generated by Django 3.1.5 on 2021-02-09 20:26
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cms', '0039_blog_short_link'),
]
operations = [
migrations.AlterField(
model_name='shorturls',
name='short',
... |
11,324 | 87e7de70df4df496390e30eeed211881c198f371 | from rest_framework import viewsets, permissions
from kongdae.permissions import IsOwnerOrReadOnly
from reviews.models import Review, Comment
from reviews.serializers import ReviewSerializer, CommentSerializer
# Create your views here.
class ReviewsViewSet(viewsets.ModelViewSet):
queryset = Review.objects.all()
... |
11,325 | 73fca57c04e3a776f2387151f9bb353bd9314f8e | import sys
import csv
from members.models import Team, Player, Pass, MembershipHercules
from django.contrib.auth.models import User
from guardian.shortcuts import assign
#### TODO:
## sportlink nieuw bestand nieuwste spelers importeren.
# reguliere expressie om data om te draaien veranderen.
## aanvoerders rechten ge... |
11,326 | f44fef3f6742599c715f52ab4f2fe11f68c2359e | from flask import Flask, render_template, Response, request, flash, jsonify
import re
import pickle
import sklearn
import pandas as pd
# from script.parseImg import *
app = Flask(__name__)
def bin_count(x):
if x >= 48:
return 1
return 5
def word_count(x):
return x.apply(lambda x: bin_count(len(x.... |
11,327 | 120a34bdd12d6dd40eef1a966a011110739348b3 | import matplotlib.pyplot as plt
import pickle
from os.path import abspath
# loads a saved model from <filename>
def load_model(filename):
if not filename.endswith('.pkl'):
filename += '.pkl'
filename = abspath(filename)
with open(filename, 'rb') as f:
return pickle.load(f)
# plot errors ... |
11,328 | d643542e572255cd4c8d18742dcffa48c2df5eda | import src.helper as helper
import src.conf as conf
import numpy as np
def obs_to_matrix_baseline(obs, control_ship_id, player_id, own_ship_actions, size):
''' Baseline input function. Takes into consideration the following separate 9 images of size 21x21:
halite, ships, shipyards, enemy ships, enemy shipyard... |
11,329 | 2b8ec5601039d52e98628d2b624b40f7fbd89d1f | class filters:
def __init__(self):
self.LPF_cut_off_freq = 200
self.LPF_numtaps = 40
def lpf(self):
print "TESTING" |
11,330 | e27bf02865cf0c19058b6d76fe68a4b85a688b55 | # Generated by Django 3.0.1 on 2021-01-19 16:59
import django.utils.timezone
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('COVID_19_Tracker', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='global',
... |
11,331 | f7d22ca7ec2f03212aa9ca30dd22ad7303cb5885 | #!/usr/bin/env python
import json
import falcon
from email.utils import formatdate
# resource endpoints
class JSONResource(object):
def on_get(self, request, response):
response.set_header('Date', formatdate(timeval=None, localtime=False, usegmt=True))
json_data = {'message': "Hello, world!"}
... |
11,332 | 03ecdbf4be101446e71195431c274a1bda9a1d44 | # encoding=utf-8
import matplotlib.pyplot as plt
'''
将标注OURS1改成OURS2,将OURS3改成OURS1
'''
def read_wrq(pro_name,E,K,D):
#name*epsilon*k*delta
means=[]
for p in range(len(pro_name)):
means.append([])
for e in range(len(E)):
means[p].append([])
for k in range(len(K)):
... |
11,333 | 6daee70c7abf135423229f5ede652404139216ea | """Here we write all the doc string examples. This way we can be sure that they
still work.
A method is written for each python file of dpf-core.
If a failure occurs, the change must be done here and in the corresponding
docstring."""
import doctest
import os
import pathlib
import pytest
@pytest.mark.skipif(os.name ... |
11,334 | 94a7faf18bb252a3497b1044f280e06f23ddb0b2 | #MenuTitle: Batch Create Intermediate Layer
# -*- coding: utf-8 -*-
__doc__="""
Batch create intermediate layers for selected glyphs, based on selected master layer. Useful for creating "clamped" interpolation for small glyphs(E.g. fraction figures). (Single Axis Only)
"""
# from GlyphsApp import *
import vanilla
fo... |
11,335 | 4e2b760f1a6d8ea94d89bae4ee7b56970c4f3df8 | import codecs, re
from sections import Section, SectionFactory
class WebOfScienceSectionFactory(SectionFactory):
def __init__(self, text_file, fact_file, sect_file, fact_type, language, verbose=False):
SectionFactory.__init__(self, text_file, fact_file, sect_file, fact_type, language)
self.sec... |
11,336 | 77110bc63dfec8b62d0bcf3c9454867004982218 | # Generated by Django 2.2 on 2020-07-26 19:15
import datetime
from django.db import migrations, models
from django.utils.timezone import utc
class Migration(migrations.Migration):
dependencies = [
('manage', '0006_auto_20200726_1409'),
]
operations = [
migrations.AlterFiel... |
11,337 | 41e7c15ab9ed4ab93130d597d8712d02c28ce250 | from .view import as_json
|
11,338 | 42fcb753359348cd9143861bc507c4719c81dd23 | # !/usr/bin/env python
# -*- coding: utf-8 -*-
"""Handlertypes for filerotation."""
class HandlerType(object):
"""Static types to represent a file handler."""
ROTATING_FILE_HANDLER = -2
TIME_ROTATING_FILE_HANDLER = -1
|
11,339 | e3d0e9f9e482e1a88d5cf2ae49475ba456ceba3f | #coding: utf-8
import requests
def Frases():
get = requests.get("http://allugofrases.herokuapp.com/frases")
return get.json()
def fraseAleatoria():
get = requests.get("http://allugofrases.herokuapp.com/frases/random")
return get.json()
def fraseID(id):
get = requests.get("http://allugofrases.hero... |
11,340 | 5c6eed8db6dbb401f260d44926f1175ed9670b4a | import logging
import queue
import sys
import threading
from server import Endpoint, PingMsg, CrawlServer
from secp256k1 import PrivateKey
logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.INFO)
#read threadcount from args
threadcount = 1
if len(sys.argv) == 2:
threadcount = int(sys.argv[1])
#g... |
11,341 | b4fb6d5c64e07741394631dfca7563c1a867001e |
from .OutlierNormalizer import OutlierNormalizer
from .StandardNormalizer import StandardNormalizer
from .WinsorizationNormalizer import WinsorizationNormalizer
from weakref import ReferenceType
from numpy import ndarray
class MatrixNormalizerAdapter:
def __init__(self, matrix_reference: ReferenceType):
... |
11,342 | 7e6c3470a9f30dc48c7bae7d1d7041bddf49ac2e | import numpy as np
from numpy import pi
import pyqg
def test_the_model(rtol=0.1):
""" Test the sqg model similatly to BT model. Numbers come from
a simulations in Cesar's 2014 MacPro with Anaconda 64-bit """
# the model object
year = 1.
m = pyqg.SQGModel(L=2.*pi,nx=128, tmax = 10*year,
... |
11,343 | ea6ce75aaf92e6a89611d7845a7436a21f87bd2d | from django import forms
from .models import Article,Message
class ArticleForm(forms.ModelForm):
class Meta:
model = Article
fields = [
"pic",
"year",
"km",
"price",
"make",
"model",
"transmission",
"fuel... |
11,344 | 8a751c129dbad10aa8c59b06603f6d1cf1da0b39 | #!/usr/bin/python3
import sys
sys.path.insert(0, '/home/user/aqua/')
from server import app as application
|
11,345 | 47e9a8d6adf0fb1c72297bbc9f2ff980e3483a12 | code_dict = {}
accumulator = 0
line_nr = 0
do_substitute = True
saved_code_dict = 0
saved_accumulator = 0
saved_line_nr = 0
def load_code():
code_dict = {}
line_nr = 0
with open('input.txt', 'r') as file:
lines = file.readlines()
for line in lines:
line = line.strip('\n')
... |
11,346 | f026e21cb47794c45d7458446d6360dbe0dc0113 | import requests
import time
from traffic_data_utils import get_duration_from_request, get_payload
URL = 'http://api.sl.se/api2/TravelplannerV2/trip.json'
def execute_request(latitude, longitude):
response = None
payload = get_payload(latitude, longitude)
try:
response = requests.get(URL, params=p... |
11,347 | f2b4e12aed7cd39ba7c75671b9c01735024a9763 | words = input().split()
searched_word = input()
palindromes = [el for el in words if el == el[::-1]]
print(palindromes)
print(f"Found palindrome {palindromes.count(searched_word)} times") |
11,348 | b971c0aa958ce2c5adb76dc88275c22022e3913a | import pygame
my_name = "Harrison Kinsley"
pygame.init()
my_font = pygame.font.SysFont("arial", 64)
name_surface = my_font.render(my_name, True, (0, 0, 0), (255, 255, 255))
pygame.image.save(name_surface, "name.png")
|
11,349 | 87605b235c11ea02b30b5787f2ec5ffa590397b9 | from random import randrange
from character import Character
class Medic(Character):
def __init__(self, level = 1, health = 10, power = 2):
self.health = health
self.power = power
self.level = level
def attack(self, hero):
heal = randrange(5)
if heal == 4:
... |
11,350 | 7ab893cc106f78573d03faf3c6c14e7579e3ab2e | #fisierele de citire pentru fiecare automat
fisier_citire_lnfa = open('lnfa.in')
fisier_citire_nfa = open('nfa.in')
fisier_citire_dfa = open('dfa.in')
#functie de citire pentru LNFA
def Citire_LNFA(fisier):
nr_stari = int(fisier.readline())
lista_stari=[stare for stare in range(nr_stari)] #de la 0 la nr_sta... |
11,351 | 7afccbfd0046b51c60029f3831b32a02b8711653 | from ._State import *
|
11,352 | ba2ae3b290e38cffe18b075d01f95ae1501eaef9 | from chatbot import Chatbot
import json
import random
agents = ["IR", "ML", "RB", "HM"]
for agent in random.shuffle(agents) :
### Information Retrieval System
if agent == 'IR':
print("Say something")
from chatbot import IR_Bot
ir = IR_Bot('ir')
ir.loadDictJson('irDictionar... |
11,353 | 2959229d17ee622bfddbd0a2be4de689f500c0ce | import matplotlib.pyplot as plt
import numpy as np
from scipy.stats import norm
w = np.array([-0.03314521 -0.99945055])
z = np.linspace(-3,2,500)
points = np.column_stack([z,z])
projection_points = points*w
normal_point_1 = norm.pdf(z,0,1)
normal_point_2 = norm.pdf(z,1,1)
normal_vector_1 = np.column_stack([normal_point... |
11,354 | b4c8aa6cc93a5986125de33a56a904a8a1b5872c | # Generated by Django 2.0 on 2018-09-17 23:00
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('catalog', '0020_product_creator'),
]
operations = [
migrations.AlterField(
... |
11,355 | 050bbe3eb25453d5f0d8bbea020edca11fbb2fb1 | import os
import sys
import urllib.request
import gzip
import numpy as np
def print_download_progress(count, block_size, total_size):
decimals = 1
format_str = "{0:." + str(decimals) + "f}"
bar_length = 100
pct_complete = format_str.format((float(count * block_size) / total_size) * 100)
... |
11,356 | 2da16bf5cfe7f888bcb02c4d39a18c9e65002c7b | from datetime import datetime, timezone
from bson.objectid import ObjectId
from bson.errors import InvalidId
from typing import Any, Generator, Union, Dict
from pydantic import BaseConfig, BaseModel
# class MongoModel(BaseModel):
# class Config(BaseConfig):
# allow_population_by_alias = True
# js... |
11,357 | 2e499ff56e32665ab2ed93f630dc48d0d759e484 | import configparser
from logging.config import fileConfig
from pathlib import Path
from paste.deploy import loadapp
configfile = str(Path(__file__).resolve().parents[2] / "production.ini")
try:
fileConfig(configfile)
except configparser.NoSectionError:
pass
application = loadapp("config:" + configfile, name... |
11,358 | cf5690fe770b49265ec6cdb39c3eeab05b4d9969 | import time
from typing import List, Tuple
import PySimpleGUI as sg
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
import brainflow as bf
class TkPlot:
def __init__(self, canvas: sg.tk.Canvas):
self.canvas = canvas
fig, self.axes... |
11,359 | 59a60a8da4aea85fb69b2b27b1e7ec27bf80a8ea | import os
from PIL import Image
import urllib.parse
from flask import Flask, send_file, abort
from time import sleep
from selenium import webdriver
from selenium.webdriver import ChromeOptions
app = Flask(__name__)
options = ChromeOptions()
options.headless=True
options.add_argument('--ignore-certificate-errors')
op... |
11,360 | 15cdd6593bf8a0066c46512ba27c5c9fd201d824 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2014 YooWaan. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
... |
11,361 | efe4a34f35b1f14dbed55c7e4c799f9332b3eb56 | import tensorflow as tf
import os
import numpy as np
from matplotlib import pyplot as plt
from tensorflow.keras.preprocessing.image import ImageDataGenerator
np.set_printoptions(threshold=np.inf)
mnist_dataset = tf.keras.datasets.mnist
(training_data, training_label), (val_data, val_label) = mnist_dataset.load_data()
t... |
11,362 | 9a48cfb042b60d0cedd6a9c1a25eff47b522436e | from flask import Flask, jsonify, request, redirect
from flask_sqlalchemy import SQLAlchemy
from datetime import datetime, date
from uuid import uuid4
from urllib.parse import urlparse
from flask_cors import CORS
# create an instance of the flask WSGI app
app = Flask(__name__)
# configurations for the app
app.confi... |
11,363 | 4bf53adcf3eb2419d927815d417640ca6abdea8d | import sqlite3
import json
from isbntools.app import *
if __name__ == "__main__":
conn = sqlite3.connect('isbn_data.db', timeout=10)
read_cursor = conn.cursor()
write_cursor = conn.cursor()
files = ['/Volumes/Byeeee/xisbn/vinay_wishlist_jan2018_files.ndjson', '/Volumes/Byeeee/xisbn/raw_isbn_files.ndjson','/Vo... |
11,364 | 9790d24e872b8c522bf64c2f29f0e178b0b85a1a | import os
import sys
import gzip
import lz4.block
import lzma
try:
import snappy
SNAPPY_SUPPORT = True
except ImportError:
SNAPPY_SUPPORT = False
sys.path.append(
os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
from python_utils.base import BaseFormatter
__version__ = '0.0.1'
DESCRIPTI... |
11,365 | fbfbddd21afd6d712b1b0061d3cb318ea7aee4c2 | import token
# Node class holds
# a label consiste
# nt with the name
# of each function
# that creates eac
# h node. every fu
# nction creates e
# xactly one singl
# e tree node, eit
# her that or no t
# ree nodes. the c
# hildren are four
# max. all syntact
# ic tokens are ca
# st away, while a
# ll... |
11,366 | c9d2fa3d42b2f1f642c5411786b7ff62938d8d94 | import discord, discord.errors
import os
import platform
import subprocess
import asyncio
import random
import time
import re
import globals
import log
from platform_specific import PlatformSpecific
from data import DataPermissions
def is_int(s):
try:
int(s)
return True
except ValueError:
return False
def is... |
11,367 | db51ce76628f582ba56f2f9376c70a27d208b565 | from time import sleep
from path import path
here = path(__file__).abspath()
if __name__ == '__main__':
import os
import sys
sys.path.append(here.parent)
os.chdir(here.parent)
from bar import Bar
b = Bar('hello')
#emit_signal('on_start')
b.start()
sleep(3)
b.stop()
#emi... |
11,368 | d76d4903e9946e7103ce223e517e17a2e49fa6da | # Mantid Repository : https://github.com/mantidproject/mantid
#
# Copyright © 2021 ISIS Rutherford Appleton Laboratory UKRI,
# NScD Oak Ridge National Laboratory, European Spallation Source
# & Institut Laue - Langevin
# SPDX - License - Identifier: GPL - 3.0 +
"""
DNS script helpers for single crystal TOF... |
11,369 | e216bb9ff5ed086f71b6aeda574d8777f10eeb95 | import os
from table_multiplication import *
# test de la fonction table
table(4, 40)
os.system("pause")
|
11,370 | 0857374afaa57514426d1f424366513d091bc20d | from selenium.webdriver.support import wait
class waitObject:
def __init__(self, driver):
self.driver = driver
self.getWaitObj = wait.WebDriverWait(self.driver, 10)
def getElement(self, name, key):
return self.getWaitObj.until(lambda driver: self.driver.find_element(by=name, value=ke... |
11,371 | 122c814e9171f1de4f53dc180487df266662559c | #!/usr/bin/env python
import os, sys
import shutil
from scipy import *
import utils
import indmffile
import find3dRotation as f3dr
import find5dRotation as f5dr
if __name__ == '__main__':
hybrid_infty = False # whether to diagonalize hybridization in infinity or at zero
w2k = utils.W2kEnvironment() ... |
11,372 | 48273c8d13bf64bac2069e361751385468d3efcc | # -*- coding: utf-8 -*-
"""
Created on Mon Nov 18 10:07:36 2019
@author: Julie
Crétion d'un fichier contenant la séquence d'ADN (brin sens et brin non sens)
ainsi que les Read et leurs valeurs de qualité.
id_read : numéro du read (0, 1, 2, etc...)
read : liste des reads
valeur de qualité : valeur de chaqu... |
11,373 | 86595d1224e1be6f9e9500004769920dc5bb6446 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-07-18 16:00
from __future__ import unicode_literals
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operatio... |
11,374 | 930d8214de85ed6cdb33212101158ab1d6625b4d | #!/usr/bin/env python
u"""
compute_tide_corrections.py
Written by Tyler Sutterley (12/2020)
Calculates tidal elevations for correcting elevation or imagery data
Uses OTIS format tidal solutions provided by Ohio State University and ESR
http://volkov.oce.orst.edu/tides/region.html
https://www.esr.org/research/p... |
11,375 | 817a26808d22f7d7f195d678a72805aa7fe64924 | import io
import pathlib
import h5py
import PIL.Image
import numpy as np
from torch.utils.data import Dataset
from tqdm import tqdm
# For high performance PIL operations use
# pillow-simd instead of pillow
# https://python-pillow.org/pillow-perf/
# https://github.com/uploadcare/pillow-simd
import pkg_resources
try:
... |
11,376 | 0263a23c969bc5e2a5b9b0bf6acc26370586cf17 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from dblogic import dictionary_writer, dictionary_report_naming_miner, dictionary_report_parameters_miner, dictionary_report_name_getter, update_report_local_name, dictionary_report_parameters_getter, update_param_local_name
def dictionary_refresh(lang_id):
report_na... |
11,377 | da7b78bdcd251d474c033fb2eda1653b7adf55a6 | from django.conf.urls.defaults import patterns, url, include
from django.contrib import admin
admin.autodiscover()
from rec import views
urlpatterns = patterns('',
url(r'^admin/', include(admin.site.urls)),
url(r'^$', views.start),
url(r'^(?P<name>\d+)/$',views.home)
url(r'^(?P<name>\d+)/movie/$',views.movie)... |
11,378 | ca123533a5cc88a986deabacb41cff00492ffb1c | # 一般,回归问题可以使用恒等函数,二元分类问题可以使用sigmoid函数,
# 多元分类问题可以使用softmax函数
# --------------------------------------------------
# 机器学习的问题大致可以分为分类问题和回归问题。分类问题是数据属于哪一个类别的问题。
# 比如,区分图像中的人是男性还是女性的问题就是分类问题。
# 而回归问题是根据某个输入预测一个(连续的)数值的问题。
# 比如,根据一个人的图像预测这个人的体重的问题就是回归问题(类似“57.4kg”这样的预测)
|
11,379 | 2c81dbac183843e63a2894afe4ab0a56f18a1d1f | """
Copyright 2019, ETH Zurich
This file is part of L3C-PyTorch.
L3C-PyTorch is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
any later version.
L3C-PyTorch is distributed in ... |
11,380 | 1078c15742dec11b673747f040b79716ab362b4f | __author__ = 'nikita_kartashov'
def split_to_function(input_string, split_string, f, strip_string=None):
"""
Splits the strings, then strips every component, then calls a function on them
:param input_string: the string to be processed
:param split_string: characters to split on
:param f: function... |
11,381 | a0cabc6315b4070dc7dd98ea14786976ccd3f4ca | # -*- coding: utf-8 -*-
# qualify_textgrid.py - usage: python qualify_textgrid src_file[src_root] [timeit]
# to validate the format of a textgrid
# or to calculate the sum time of text in respectively categories
# author: Xiao Yang <xiaoyang0117@gmail.com>
# date: 2016.02.16
import os
import sys
import re
import codecs... |
11,382 | 6193c7945a8ef77df00cce322024db64605514f2 | from thunder.model import Base
class User(Base):
def __init__(self):
Base.__init__(self)
self.tablename = 'users'
class Image(Base):
def __init__(self):
Base.__init__(self)
self.tablename = 'images'
|
11,383 | 7eec75c76e3001107db5e5ffde0c6fbdaab48b93 | #!/usr/bin/env python
test = None
|
11,384 | f7c595237bcf563256f70ffba0f87e3b75f482aa | # Copyright (c) 2015 Cloudbase Solutions SRL
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unle... |
11,385 | 8504896793c5b1ef58773d10b93dc630e5e02983 | def weather(temp):
if temp <= 10:
result = "COLD"
elif temp > 10 and temp <= 25:
result = "WARM"
else:
result = "HOT"
return result
user_input = float(input("Please enter a temperature: "))
print("The weather is",weather(user_input)) |
11,386 | 1b8bf2231c2aaa0eb17dbcf3a53d0c4df9d83367 | from i3pystatus import IntervalModule
from i3pystatus.core.command import run_through_shell
class DeviceNotFound(Exception):
pass
class NoBatteryStatus(Exception):
message = None
def __init__(self, message):
self.message = message
class Solaar(IntervalModule):
"""
Shows status and loa... |
11,387 | 387965ad8ecbcf8596bcc133f5369e9dbc3d1832 | /home/septiannurtrir/miniconda3/lib/python3.7/weakref.py |
11,388 | bb993edb6b6b87f110ac68e903f5f84ef102c8ec | from haystack.forms import SearchForm
class NotesSearchForm(SearchForm):
def no_query_found(self):
return self.searchqueryset.all()
class ProductSearchForm(SearchForm):
def no_query_found(self):
return self.searchqueryset.all() |
11,389 | 10a0502057b95d90b538c5377484a3b2d462e084 | import pytest
from solution import n_back
@pytest.mark.parametrize(
('sequence', 'n', 'expected'),
(
([1, 1, 1, 1, 1], 1, 4),
([1, 1, 1, 1, 1], 2, 3),
([1, 2, 1, 2, 1], 1, 0),
([1, 2, 1, 2, 1], 2, 3),
([1, 2, 3, 4, 5, 6, 7, 8, 9, 1], 9, 1),
([], 1, 0),... |
11,390 | 6aa303d2747ea9c54a40e42cce69d7715c0c96bb | from django.contrib import admin
from quiz_app.forms import BaseAnswerInlineFormset
from quiz_app.models import Category, Quiz, Question, Answer
@admin.register(Category)
class CategoryAdmin(admin.ModelAdmin):
list_display = ['name', 'slug', ]
prepopulated_fields = {'slug': ('name', )}
class QuestionAdminI... |
11,391 | b197e669918cbb7512bbb88405c51e3fe0e82405 | # -*- coding: utf-8 -*-
from django.contrib.auth import get_user_model
from tina.projects.models import Project
from tina.base.utils.slug import slugify
import pytest
pytestmark = pytest.mark.django_db
def test_slugify_1():
assert slugify("漢字") == "han-zi"
def test_slugify_2():
assert slugify("TestExampl... |
11,392 | b881d3cc377b7a71c7d4db5c7360e325dfbb5936 | '''
Using subplot() (2)
Now you have some familiarity with plt.subplot(), you can use it to plot more plots in larger grids of subplots of the same figure.
Here, you will make a 2×2 grid of subplots and plot the percentage of degrees awarded to women in Physical Sciences (using physical_sciences), in Computer Science ... |
11,393 | 55b92b5c7b4db9b95ac7517e708fc955aab059e7 | from oandapyV20 import API
accountID = ""
access_token = ""
api = API(access_token=access_token, environment="practice")
|
11,394 | 65eb89e294bdebe0827964c8164d725ec166764b | ax = float(input())
ay = float(input())
bx = float(input())
by = float(input())
dist = (((bx - ax) ** 2) + ((by - ay) ** 2)) ** 0.5
print(round(dist,2)) |
11,395 | ea9b506c4a248e883124d93374dd73ef1d8104c9 | from collections import defaultdict
from datetime import datetime, timedelta
from aiogram import types
from aiogram.utils.text_decorations import markdown_decoration
from i17obot import bot, config
from i17obot.models import User
def docsurl(resource):
corner_cases = {
"library--multiprocessing_shared_m... |
11,396 | 7370a3394f1f459b0583f5bf79e2ebbce7f7ab4f | # Load the Python Standard and DesignScript Libraries
import sys
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
# The inputs to this node will be stored as a list in the IN variables.
listOfService = IN[0]
# Custom variables
PAREDE_RVT_COD = []
CHAPISCO_EXT_RVT_COD = []
EMBO... |
11,397 | d3b8e0109d1b6ad5ea1d34b2ad61054f1b57d2b3 | data = list(map(int, open("data", "r").read().splitlines()))
def get_checksums(preamble, result):
if(len(preamble) == 0): return result
result.extend([num + preamble[0] for num in preamble[1:]])
return get_checksums(preamble[1:], result)
def get_corrupt_number(preamble_size):
for i, _ in enumerate(data):
... |
11,398 | 46d93eb526a2ca14c53b12bb37d29abab28ff368 | class Solution(object):
def selfDividingNumbers(self, left, right):
"""
:type left: int
:type right: int
:rtype: List[int]
"""
def judge(n):
tmp = n
while tmp > 0:
div = tmp % 10
if (div == 0):
... |
11,399 | ae6e008f66fdaf94401277260ba5a8f37e8f64e0 | import sys;
from collections import Counter
print("Day 2 puzzle: Inventory Management System");
#read input
puzzle_file = "";
if(len(sys.argv) == 1):
print ("Please provide input file as argument!");
sys.exit();
else:
puzzle_file = sys.argv[1];
#open file
box_ids = []
with open(puzzle_file, 'r') as puz... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.