index int64 0 1,000k | blob_id stringlengths 40 40 | code stringlengths 7 10.4M |
|---|---|---|
5,600 | 14cb702054b8caaa8899a2a3d8b65aae9b063cb6 | import pandas
import os
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import Select
from selenium.common.exceptions import NoSuchElementException
import json
CONFIG_FILE_NAME = os.path.join(os.path.dirname(__file__), 'input_info.json')
def create_ne... |
5,601 | e714fe0e27ec9ea5acb3120a4d2114d3d7674fcf | import os
import json
from page import Page
from random import choice
from os.path import join, expanduser
from file_handler import f_read, f_readlines, open_local
import config
class LetterPage(Page):
def __init__(self, page_num,n):
super(LetterPage, self).__init__(page_num)
self.title = "Letters"... |
5,602 | 3b737aaa820da8f70a80480c6404e4d3a9d2262e | """
COMPARISON OPERATORS
"""
__author__ = 'Sol Amour - amoursol@gmail.com'
__twitter__ = '@solamour'
__version__ = '1.0.0'
greaterThan = 10 > 5 # Is '10' greater than '5' ? Evaluates to True
greaterThanOrEqualTo = 10 >= 10 # Is '10' greater than or equal to '10'
# ? Evaluates to True
lessThan = 5 < 10 # Is '5' les... |
5,603 | e279ca43ce2c582c702f1c6a0c1acf37eb9bcefe | from django.shortcuts import render
def index(request):
return render(request, 'munchiesfastfood/home.html', {'drinks':['Pineapple Juice','Green Juice','Soft Drinks','Carlo Rosee Drinks'], 'dishes':['Beef Steak','Tomato with Chicken','Sausages from Italy','Beef Grilled']})
|
5,604 | 0ef172ced411213c0f7daccd632f8d5ec97379c3 | from django.apps import AppConfig
class EasyTechConfig(AppConfig):
name = 'easy_tech'
|
5,605 | f01a1b6d0de4ba685c489af2742159447f943d2d | # -*- coding: utf-8 -*-
"""
Created on Thu May 24 18:18:36 2018
@author: Nicole
"""
from __future__ import division
import Rod
import matplotlib.pyplot as plt
import math
class Truss:
def __init__(self,node1,node2,size,result,ax):
self.node1=node1
self.node2=node2
self.rod=Rod.Rod(node1,... |
5,606 | 26b0a762b8eb30f0ef3c5a914f032c2a7d24f750 | # 12.02.17
"""
nomencalura
a__b__c
a: parametro
t-temperatura
tm-temperatura minima
tM-teperatura massima
b: intervallo di tempo
a-anno
c: tabella fonte dati
g-giornaliero
"""
import db_02 as DB
def t_tm_tM__a__g(db, anno):
cmd = """
SELECT data, t, tmin, tmax
FROM Giornaliero
WHERE strft... |
5,607 | e5c30488c8c1682171c57a11a8ecedc5ccd4d851 | import numpy as np
import matplotlib.pyplot as plt
import sys
import os
from azavg_util import plot_azav
from binormalized_cbar import MidpointNormalize
from diagnostic_reading import ReferenceState
dirname = sys.argv[1]
datadir = dirname + '/data/'
plotdir = dirname + '/plots/'
if (not os.path.isdir(plotdir)):
... |
5,608 | 9a0e37aaa41f3b21ed7ad11096cd6c5dd0bb8564 | import time
t0 = time.time()
while abs(t0-time.time()<60):
pass
|
5,609 | 175e8ecdd0c9faa5fc981447f821763e0eb58b4d | import h5py
import numpy as np
from matplotlib import pyplot
from IPython.Shell import IPShellEmbed
ipshell = IPShellEmbed("Dropping to IPython shell")
filename = "SPY-VXX-20090507-20100427.hdf5"
start_day = 1
end_day = 245
#start_day = 108
#end_day = 111
start_day = 120
end_day = 245
start_day = 1
end_day = 120
s... |
5,610 | a1db566f4da16e7725212aeab29e946ef7c1672e | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('home_application', '0019_auto_20170809_1810'),
]
operations = [
migrations.CreateModel(
... |
5,611 | 9d302ff2de8280bd8786794cdd533107d2a458bc | import urllib3
import json
def download(url):
print('Downloading ', url)
userAgent = 'Mozilla/5.0 (Linux; U; Android 10; zh-cn; MI 9 Build/QKQ1.190825.002) AppleWebKit/533.1 (KHTML, like Gecko) Version/5.0 Mobile Safari/533.1'
userAgent = 'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/5... |
5,612 | e89600f109335ffdb00c13f617d61496c547ba61 | import requests, os
def lambda_handler(event, context):
print(requests)
apiKey = os.environ['newrelic_api_key']
headers = {'content-type': 'application/json', 'Accept-Charset': 'UTF-8', 'X-api-key' : apiKey}
r = requests.get('https://api.newrelic.com/v2/applications.json', headers=headers)
return ... |
5,613 | ede675c971ed233e93c14aa4d2ffb66fe7ba775a | """
This is the hourly animation program. It displays a series of images across the board.
It is hard coded to work with the Sonic images. Adjustments would need to be made to
the y values which are distance traveled. Change sonicFrame < 8 value to the total
number of frames the new animation has.
"""
from runImages im... |
5,614 | 20a238826640099e6c69aaa383c5fa7e9b02b13b | """
Contains derivative computation for BSSN formulation of ET equations.
"""
# first derivative
import cog
D = ["alpha", "beta0", "beta1", "beta2",
"B0", "B1", "B2",
"chi", "Gt0", "Gt1", "Gt2", "K",
"gt0", "gt1", "gt2", "gt3", "gt4", "gt5",
"At0", "At1", "At2", "At3", "At4", "At5" ]
# cust... |
5,615 | 3b19ee0bbd24b76dd8b933859f6a56c459926861 | from javascript import JSConstructor
from javascript import JSObject
cango = JSConstructor(Cango2D)
shapes2d = JSObject(shapes2D)
tweener = JSConstructor(Tweener)
drag2d = JSConstructor(Drag2D)
svgtocgo2d = JSConstructor(svgToCgo2D)
cgo = cango("plotarea")
x1, y1 = 40, 20
cx1, cy1 = 90, 120
x2, y2 = 120, 100
cx2, cy2... |
5,616 | d03a8076b77851ae4df5cf657ff898eb132c49c3 | # Lahman.py
# Convert to/from web native JSON and Python/RDB types.
import json
# Include Flask packages
from flask import Flask
from flask import request
import copy
import SimpleBO
# The main program that executes. This call creates an instance of a
# class and the constructor starts the runtime.
app = Flask(__na... |
5,617 | f4aaf0449bff68814090552ea4f6ccac85dacf1b | # coding=utf-8
"""SCALE UI: feature tests."""
import pytest
import xpaths
from function import (
wait_on_element,
is_element_present,
wait_on_element_disappear
)
from pytest_bdd import (
given,
scenario,
then,
when,
)
@pytest.mark.dependency(name='Set_Group')
@scenario('features/NAS-T1250... |
5,618 | 129c7f349e2723d9555da44ae62f7cfb7227b9ae | from django.shortcuts import render
from django.views.generic import View #导入View
from .models import UpdateDbData,User
from wanwenyc.settings import DJANGO_SERVER_YUMING
from .forms import UpdateDbDataForm
# Create your views here.
#添加场景的view
class UpdateDbDataView(View): #继承View
"""
测试数据复制编写页面处理
... |
5,619 | 700d6e0c7dab58ed0157265ff78021923c17e397 | j= float(input("juros"))
Q0= 1500
t= 36
Qf=Q0*(1+j)**t
print(round(Qf,2)) |
5,620 | 8a7536b998a6d122e2e7529af1ebe2a0f025303f | import requests
from datetime import date
from datetime import timedelta
def get_offset_date(modifed_date, offset_in_days):
return date.isoformat(modifed_date + timedelta(days=int(offset_in_days)))
def get_trending_repositories(start_search_date, number_of_results=20):
github_api_uri = 'https://api.github.c... |
5,621 | 40aa9e7cf0aaca24054297ca80aaf468ba485966 | """ binary_adder.py: Takes two arrays representing binary numbers,
adds them together. """
__author__ = "David Vaillant"
__credits__ = "CLRS, Chapter 2.1"
def binary_add(x, y):
""" Adds two binary arrays together. """
# Makes sure that the arrays have the same length.
# Could be chang... |
5,622 | d827c59871d58e098009c22320af73f8f40169bb | from scrapy.selector import HtmlXPathSelector
from scrapy.spiders import CrawlSpider, Rule
from scrapy.linkextractors.sgml import SgmlLinkExtractor
from scrapy.item import Item, Field
import scrapy
import config
from scrapy.linkextractors import LinkExtractor
from scrapy.http import Request
class BrokenItem(Item):
... |
5,623 | 12ca9a81574d34d1004ac9ebcb2ee4b31d7171e2 | variable_1 = 100
variable_2 = 500
variable_3 = 222.5
variable_4 = 'Hello'
variable_5 = 'world'
print(variable_1, variable_2, variable_3, sep=', ')
print(variable_4, variable_5, sep=', ', end='!\n')
user_age = input('Введите ваш возраст: ')
user_name = input('Введите ваше имя: ')
print(variable_4 + ', ' +... |
5,624 | 61388b2edb35055cccbdc98ed52caedcd0b02983 | import numpy as np
import string
import networkx as nx
import matplotlib.pyplot as plt
def PlotUndirectedGraph(A,color):
NodesNames = list(string.ascii_uppercase);
NNodes = A.shape[0]
G = nx.DiGraph()
for i in range(NNodes):
G.add_node(NodesNames[i])
for i in range(NNodes):
for ... |
5,625 | f9234741c6356b4677b5d32ffea86549d001c258 | """
Quick select (randomized selection algorithm)
- based on quick sort (ch8_sorting); used to obtain the ith-smallest element in an unordered list of items (e.g.numbers)
"""
def swap(unsorted_array, a, b):
temp = unsorted_array[a]
unsorted_array[a] = unsorted_array[b]
unsorted_array[b] = temp
def part... |
5,626 | 60b1a77d2de4a52ae9597f88917c4a3996c99923 | from src.secStructure import *
from suffix_trees import STree
import math
import re
def test_processData():
# Test1: ignoring peak position
data = ['example/example1.fa', 'example/example2.fa']
struct_data = ['example/exampleStrucData/exampleStructuralData1.fa',
'example/exampleStrucDat... |
5,627 | f494d8aeee8c72cce8fc14e44ca896bcf30c100a | from config import Config
from flask import Flask
from flask_cors import CORS
from flask_migrate import Migrate
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__)
CORS(app)
app.config.from_object(Config)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///ws.db'
# app.config['SQLALCHEMY_DATABASE_URI'] = 'mys... |
5,628 | 8c69813bc576a56c25c828fe24e2707e65ac0d0d | #!/usr/bin/python
"""
demo_mininet_topo.py
Sample topology class with Mininet.
G = {V, E}
V = {h1, h2, h3, h4, h51, h52, s0, s1, s4, s5}
# of hosts = 6
# of switches = 4
E = {
(h1, s1), (h2, s1), (h3, s1),
(h4, s4),
(h51, s5), (h52, s5),
(s0, s1), (s0, s4), (s5, s4)
}
"""
from mininet.topo import Top... |
5,629 | 9e05f883d80d7583c9f7e16b2fb5d3f67896388d | from auction_type import AuctionType
from bid import Bid
class Auction(object):
def __init__(self, name, type, status, start_price, buy_now_price):
self.name = name
self.type = type
self.status = status
if AuctionType.BID == type:
self.start_price = start_price
... |
5,630 | 535c0975c688a19963e4c53f6029626d286b41d6 | import random
import colorama
from termcolor import colored
from reusables.string_manipulation import int_to_words
from app.common_functions import comma_separated, add_dicts_together, remove_little_words, odds
from app.load_data import items, buildings, wild_mobs, names, adjectives
colorama.init()
def find_uniqu... |
5,631 | abdf5aee77ee879c50d0e605d5fd95e28a7ef7aa | import Ploneboard
import PloneboardForum
import PloneboardConversation
import PloneboardComment
|
5,632 | ba379ed90bccd05d058f69f33a960779f8b8bcd5 | from model import *
from data import *
import os
import matplotlib.pyplot as plt
from sklearn.metrics import confusion_matrix
data_gen_args = dict(horizontal_flip = True,
vertical_flip = True)
imageTargetSize = (256, 256)
trainPath = '/work/scratch/zhangbin/EmbryoTracking_ClaireBinZhang/Motili... |
5,633 | bd419d0a197a5e5a99a370e45cdb53a276ac5507 | from sklearn import cluster
from sklearn.metrics import adjusted_rand_score
import matplotlib.pyplot as plt
def test_Kmeans(*data):
x,labels_true = data
clst = cluster.KMeans()
clst.fit(x)
predicted_labels = clst.predict(x)
print("ARI: %s" % adjusted_rand_score(labels_true, predicted_labels))
p... |
5,634 | 82fc86e44d02c45d7904139e4dfdff069e2bdb90 | import time
from selenium import webdriver
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
def open_browser(browser="chrome"):
driver = None
if browser == "chrome":
driver = webdriver.Chrome()
elif browser == "firefox":
... |
5,635 | 508d016161131481ace41f3d3bda005423125fe5 | def parse(filename):
t1, t2 = open(filename).read().strip().split("\n\n")
return tuple(map(lambda x: list(map(int, x.split("\n")[1:])), [t1, t2]))
def score(deck):
res = 0
for i in range(len(deck)):
res += deck[i] * (len(deck)-i)
return res
def solution1(deck1, deck2):
while len(deck1) > 0 and len(deck2) > 0:... |
5,636 | be5178f013e639d5179ed1af380dd7a63044bff2 | import pandas as pd
import matplotlib.pyplot as plt
plt.rcParams['font.sans-serif'] = ['SimHei']
def get_ratings(file_path):
# 图书的ISBN中可能包含字符,所以在使用pandas读取文件时,需要指定编码
ratings = pd.read_table(file_path, header=0,
sep=';', encoding='ISO-8859-1')
print('前5条数据:\n{}\n'.format(rating... |
5,637 | 38a2113c0531648a90cf70c4b18d640d5ebb3f47 | '''
quick and dirty remote shell using sockets and file descriptors
'''
import socket
import os
s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
s.bind(('',8082))
s.listen(1)
conn,__=s.accept()
os.dup2(conn.fileno(),0)
os.dup2(conn.fileno(),1)
#print("asdf")
os.system('/bin/bash')
conn.close()
|
5,638 | 6546d04d3755d62d1a8756bdec1a10f6f018dcea | from django.apps import AppConfig
class FitnerappConfig(AppConfig):
name = 'fitnerapp'
|
5,639 | 1babf9f27e6792d2a1c2545a1e3bcd08fefa0975 | import cv2
import numpy as np
import random
def main():
img = cv2.imread('test_image.png',0)
res = np.zeros((img.shape[0],img.shape[1],3),np.uint8)
thresh = cv2.threshold(img, 50, 255, 0)[1]
_, contours,_ = cv2.findContours(thresh,cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE)
for cnt in contours:
... |
5,640 | 8c3c066ed37fe0f67acfd2d5dc9d57ec2b996275 | def solution(A):
if not A:
return 1
elif len(A) == 1:
if A[0] == 1:
return 2
else:
return 1
A.sort()
prev = 0
for i in A:
if i != (prev + 1):
return i - 1
else:
prev = i
return prev + 1
|
5,641 | ea414835554ea3dcac2017036692cf178526f91b | # Generated by Django 3.0.7 on 2020-12-16 15:29
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('play', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='playerA',
... |
5,642 | 74d1491280eba1ceb06ccf6f45546cdb41149687 | #!/usr/bin python3
# coding: utf-8
"""
AUTHOR: bovenson
EMAIL: szhkai@qq.com
FILE: 03.py
DATE: 17-9-25 下午7:59
DESC:
"""
from socket import socket
|
5,643 | 4cc1c8668a84cc6faadf60053568d155b8852c5f | # -*- coding: utf-8 -*-
"""Application configuration.
See https://github.com/sloria/cookiecutter-flask for configuration options with other flask-extensions
"""
import os
class Config(object):
"""Base configuration."""
SECRET_KEY = os.environ.get('DELIVERY_ASSISTANT_SECRET', 'secret-key') # TODO: Change me... |
5,644 | 2bbfbc597a4e1f8b46f58a4c6002a9943eff557a | # pylint: skip-file
from sorter.lib.request_data import read_url
from urllib2 import HTTPError
class fake_urllib(object):
def __init__(self, should_fail=False):
self.should_fail = should_fail
def urlopen(self, uri):
if self.should_fail == True:
raise HTTPError('FAKER.GTLD', 404, 'F... |
5,645 | 5d6ec1b23dcbc935fe80dd09a2e967eb7e37a363 | from knox.models import AuthToken
from rest_framework import generics, permissions, status
from rest_framework.response import Response
from accounts.serializers import UserSerializer, RegisterSerializer, LoginSerializer, ChangePasswordSerializer
# Register API
class RegisterAPI(generics.CreateAPIView):
permiss... |
5,646 | 3191fa5f9c50993d17e12e4e2e9d56cfce2108e7 | from flask_table import Table, Col
"""Lets suppose that we have a class that we get an iterable of from
somewhere, such as a database. We can declare a table that pulls out
the relevant entries, escapes them and displays them.
"""
class Item(object):
def __init__(self, name, category):
self.name = name... |
5,647 | 5485a1210a0c0361dbb000546ee74df725fad913 | #!/usr/bin/env python3.4
# -*- coding: utf-8 -*-
"""
Das Pong-Spielfeld wird simuliert.
Court moduliert ein anpassbares Spielfeld für Pong mit einem standardmäßigen Seitenverhältnis von 16:9.
Jenes Spielfeld verfügt über einen Ball und zwei Schläger, jeweils links und rechts am Spielfeldrand,
sowie einen Punktestand ... |
5,648 | 6e78d1fb2364d334f47fea89b065d859c025ca2f | #!/usr/bin/env python
#!-*-coding:utf-8 -*-
"""
@version: python3.7
@author: ‘v-enshi‘
@license: Apache Licence
@contact: 123@qq.com
@site:
@software: PyCharm
@file: Images_fade.py
@time: 2019/1/16 17:17
"""
from PIL import Image
import numpy as np
filename = "hw0_data/westbrook.jpg"
im=Image.open(filename) #open th... |
5,649 | a0dcfb738451c11ed4ff1428629c3f7bbf5c52c9 | from django.db import models
ch=[
('Garment','Garment'),
('Hardgoods','Hardgoods'),
('Home Furnishing','Home Furnishing'),
]
class Factory(models.Model):
name = models.CharField(max_length=30,choices=ch)
def __str__(self):
return self.name
class Fabric(models.Model):
n... |
5,650 | 5282e9a9e87fd7fd6053f816048f371fbe190046 | #!/usr/bin/python
# -*- coding: utf-8 -*-
from tp_global import *
from cgibase import cgibase
from tp_mongodb import *
import json
import requests
class Ccase_model(cgibase):
def __init__(self):
return cgibase.__init__(self)
def onInit(self):
cgibase.SetNoCheckCookie(self)
opr = cgiba... |
5,651 | 7b726dd8ebbd5c49f9ce5bddb4779fcfbaaeb479 | from .gsclient import GSClient
from .gspath import GSPath
__all__ = [
"GSClient",
"GSPath",
]
|
5,652 | 3313f01ed98433f4b150c4d8e877ac09eb8403b4 |
from django.conf.urls import url
from tree import views
urlpatterns = [
url('/home', views.home),
url('/about', views.about),
] |
5,653 | 0a50b31155afce2558ec066267a9fd0c56964759 | from Store import Store
from MusicProduct import MusicProduct
class MusicStore(Store):
def make_product(self, name):
'''Overides from parent - return a new MusicProduct Object'''
|
5,654 | b328ee0b6c5afaf496297cefe477f933af458a03 | import unittest
from utils import getParams
from utils.httpUtil import HttpUtil
from utils.logger import Log
logger = Log(logger='cms_getMarket').get_log()
class NavTest(unittest.TestCase):
@classmethod
def setUpClass(cls) -> None:
cls.url = getParams.get_url('cms_getMarket', 'getMarket')
Htt... |
5,655 | 8af9cc32b445402fa790b29382a802bd8afc1100 | # Generated by Django 2.2.4 on 2019-09-09 11:00
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0002_ordered'),
]
operations = [
migrations.AlterField(
model_name='generalinfo',
name='amount_available',
... |
5,656 | fbe091b1cf3ecc2f69d34e3b1c399314b38ebc4a | import arcade
WINDOW_WIDTH = 740
WINDOW_HEIGHT = 740
dark_green = (170, 216, 81)
light_green = (162, 210, 73)
snake_color = (72, 118, 235)
def square(square_x, square_y, square_width, square_height, square_color):
""" Code that sets up the squares for generation """
arcade.draw_rectangle_filled(square_x, squ... |
5,657 | 75b1d2fb927063669a962f72deb57323001c0b7a | '''
Created on 17 june, 2018
@author: sp977u@att.com (Satish Palnati)
This class is for
'''
import sys
from PySide.QtGui import *
from PySide.QtCore import *
from PySide import QtGui
from PySide import QtCore
class PingWindow:
wind_close_flg = False
def __init__(self,last_parent):
... |
5,658 | 92e414c76f4c585092a356d7d2957e91c1477c5f | __version__ = "2.1.2"
default_app_config = "channels.apps.ChannelsConfig"
DEFAULT_CHANNEL_LAYER = "default"
|
5,659 | 8894b73829978cec29aab6ee8bf09700da7fb59f | #-*- coding: utf-8 -*-
import django
if django.get_version() <= '1.3.1':
import apps.settings as settings
from django.core.management import setup_environ
setup_environ(settings)
elif django.get_version() >= '1.7.0':
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "apps.settings")
... |
5,660 | d307c3479e34a12971f62a765aca2ba0850d80d1 | import scrapy
import datetime
from tzscrape.items import CitizenItem
class CitizenSpider(scrapy.Spider):
name = 'citizen'
allowed_domains = ['thecitizen.co.tz']
start_urls = ['http://www.thecitizen.co.tz/']
def parse(self, response):
# headlines
for href in response.xpath('//*[@itempro... |
5,661 | e474cb3db74b5344bd861aacf779cb9f77830ef6 | """Functional tests for h2 frames."""
__author__ = "Tempesta Technologies, Inc."
__copyright__ = "Copyright (C) 2023 Tempesta Technologies, Inc."
__license__ = "GPL2"
from h2.errors import ErrorCodes
from h2.exceptions import StreamClosedError
from framework import deproxy_client, tester
from helpers import checks_f... |
5,662 | 90ae14d8af163343520365a5565a7c44de57059d | """
"""
import os
from alert_triage.util import filelock
MODIFIED_ALERTS_FILE = "/tmp/alert_triage_modified_alerts"
def read_modified_alert_ids():
""" Read modified alert IDs from file, then remove them from the file."""
# Return an empty list if the file doesn't exist.
if not os.path.exists(MODIFIED_AL... |
5,663 | e5a7b0cbc82b57578f6dcbf676e8f589c6e9ac1b | __author__ = 'mvoronin'
|
5,664 | 87bcf53d1c93645a08b10ba0d02edf0d5b0a4906 | #Άσκηση 3.2: Ουρά δύο άκρων
print("Οδηγίες: Το πρόγραμμα καταχωρει αριθμους σε μια λίστα! Τρέχει σε άπειρο βρόχο, έως ότου πληκτρολογήσεις 'q'. \nΑν θελήσεις να βγάλεις το πρώτο στοιχείο της λίστας, πληκτρολόγησε '0r' ενώ,\nαν θέλεις να βγάλεις το τελευταιο, πληκτρολόγησε 'r'\n ")
newNumber = input("Για να ξεκιν... |
5,665 | ab3d443c60ca8ee82f594ae04e9b485a53d53f36 | from ocr_helpers import FilePathResolver, ProblemsWriter
from ocr_google_client import CfaProblemsBuilder
from ocr_google_client_2016 import ParserTwoThousandSixteenAnswers, ParserTwoThousandSixteenQuestions
def resolve_build_and_write(year, day_part, file_part, nb_blocks_footer=0, nb_words_footer=0, headers=None, sk... |
5,666 | 6d2bc28e7742f1063a04ae96fc195515ad70598b | from django.shortcuts import render
class Person(object):
def __init__(self,username):
self.username = username
def index(request):
# p = Person("张三")
# context = {
# 'person': p
# }
# context = {
# 'person': {
# 'username':'zhiliao',
# }
# }
# p... |
5,667 | eb1737ac671129ed3459ce4feacb81d414eef371 | # -*- coding: utf-8 -*-
# Copyright European Organization for Nuclear Research (CERN) since 2012
#
# 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-... |
5,668 | aa51b2d4bfe4051f3302d14cf2123a3881a8a2e3 | import cpt_tools
from gui_helpers.gui_config import *
chisqr_str = '\u03c72'
mu_str = '\u03bc'
sigma_str = '\u03c3'
class FitWidget( object ) :
def __init__( self, plotter_widget, analyzer = None ) :
self.plotter_widget = plotter_widget
self.plotter = plotter_widget.plotter
s... |
5,669 | dc28d8aa17347f07041ae218bbe4e1b0add27c24 | import cherrypy
import config
try:
from simplejson import json
except ImportError:
import json
import routes
import urllib
import re
def redirect(url, status=None):
"""Raise a redirect to the specified address.
"""
raise cherrypy.HTTPRedirect(url, status)
def require_method(*allowed_methods):
... |
5,670 | 325770130473153d092d3058587e9666625e12d0 | # coding=utf-8
"""
@Author: Freshield
@Contact: yangyufresh@163.com
@File: a1_test_call.py
@Time: 2021-01-20 17:40
@Last_update: 2021-01-20 17:40
@Desc: None
@==============================================@
@ _____ _ _ _ _ @
@ | __|___ ___ ___| |_|_|___| |_| | @
@ | __| ... |
5,671 | 7f2ffa653486d000c9eee0087fc1e6ca0c84003c | class Solution:
def jump(self, nums: List[int]) -> int:
if len(nums) < 2: return 0
jump = 1
curr_max = max_reach = nums[0]
for i ... |
5,672 | 33c39b098cb9d3368b8f74a7433e0943fe252da5 | import unittest, warnings
from pony.orm import *
from pony.orm import core
from pony.orm.tests.testutils import raises_exception
db = Database('sqlite', ':memory:')
class Person(db.Entity):
id = PrimaryKey(int)
name = Required(str)
tel = Optional(str)
db.generate_mapping(check_tables=False)... |
5,673 | 2bccfba2448059a41185b117b224813e344b50f8 | from simple_avk.AVK import SimpleAVK
from simple_avk.exceptions import MethodError, LongpollError
|
5,674 | 4549f26cf8051535f9d3486d111fc7afe7514dea | from rest_framework import permissions
class AdminUrlUserPermission(permissions.BasePermission):
def has_permission(self, request, view):
return (request.user.is_authenticated
and (request.user.role == 'admin'
or request.user.is_superuser))
def has_object_permissi... |
5,675 | 7537deb4560e880365b23a99584d0b1f8fa3daf4 | from click.testing import CliRunner
from apitest.actions.cli import cli
def test_sendto_cli_runs_ok():
runner = CliRunner()
result = runner.invoke(cli, ["sendto"])
assert result.exit_code == 0
|
5,676 | 9101fc5b8ba04a1b72e0c79d5bf3e4118e1bad75 | #! /usr/bin/python
import math
import sys
import os
import subprocess
#PTYPES = [ "eth_ip_udp_head_t", "ip_udp_head_t", "eth_32ip_udp_head_t", "eth_64ip_udp_head_t", "eth64_64ip64_64udp_head_t", "eth6464_64ip64_64udp_head_t" ]
#PTYPES = [ "eth_ip_udp_head_t", "eth_32ip_udp_head_t", "eth_64ip_udp_head_t", "eth64_64... |
5,677 | 6f6d3fbb9a6a118e0f4026a7f9054b90b8cf2fca | # from dataclasses import InitVar, dataclass
# standard library imports
from math import floor
# third-party imports
import gym
import torch
from torch.nn import Conv2d, Linear, MaxPool2d, Module, ModuleList, ReLU, Sequential
from torch.nn import functional as F
# local imports
from tmrl.nn import TanhNormalLayer
fro... |
5,678 | 82e7e22293551e061dcb295c52714c22df0ed0ce | class tenDParameters:
def __init__(self,
b: float,
DM: float,
pm_l: float,
pm_b: float,
vrad: float,
sb: float,
spml: float,
spmb: float,
sdm: float,
vc: float):
self.b = b
self.DM = DM
# this is actually pm_l * cos b, apparently
self.pm_l = pm... |
5,679 | c36adc3cf5de2f0ae3ee9b9823304df393ebce63 | """
code: pmap_io_test.py
"""
import os
import time
import tables as tb
import numpy as np
from pytest import mark
from .. core.system_of_units_c import units
from .. database import load_db
from .. sierpe import blr
from . import tbl_functions as tbl
from .... |
5,680 | d123083358a4fd69f6f8de27fa177afac3bf80ce | from functools import update_wrapper
from django.db import models
# Create your models here.
class Product(models.Model):
product_id=models.AutoField
product_name=models.CharField(max_length=50)
category=models.CharField(max_length=50,default="")
subcategory=models.CharField(max_length=50,default="")... |
5,681 | 44e1208a2165fe68f71d0aa49baa29b26c961e02 | import pandas as pd
import copy as cp
import numpy as np
from autoencoder import *
from encoding import smtEncoding
import matplotlib
import matplotlib.pyplot as plt
from data_generator import *
from marabou_encoding import marabouEncoding
def main():
'''
Trains an autoencoder on (generated) data and checks advers... |
5,682 | 3ff3b8a1d8e74c09da9d6f39e4abf0963002a812 | #!/usr/bin/python
import sys
import cgi
import urllib2
url = sys.argv[1]
try:
response = urllib2.urlopen(url)
redir = response.geturl()
except Exception:
import traceback
redir = 'generic exception: ' + traceback.format_exc()
print redir
|
5,683 | 2044140fb2678f9507946007fdfb7edbaf11798e | from random import shuffle
"""all sorting algorithm implementation"""
class Sorts:
def quick_sort(self, elements):
"""quick sort implementation"""
if len(elements) < 2:
return elements
else:
shuffle(elements)
pivot = elements[0]
print("pivot ... |
5,684 | 0c14a6fa8b25e1791a6eb9c71290db8bb316819a | # https://kyu9341.github.io/algorithm/2020/03/11/algorithm14226/
# https://developingbear.tistory.com/138
# https://devbelly.tistory.com/108
# 이모티콘 s개 생성
# 3가지 연산 이용
# bfs 이용 => visited를 이모티콘 방문 여부 2차원 배열 => 이모티콘의 수 와 클립보드에 저장된 이모티콘의 갯수를 이용
from collections import deque
s = int(input())
q = deque()
# visited[이모티콘의 수][클... |
5,685 | 9594cda360847d2878aa2bd9c9c85fe50562b6ab | #!/usr/bin/python
import json, sys, getopt, re
# Usage: ./get_code.py -i <inputfile>
def main(argv):
inputfile = argv[0]
with open(inputfile) as json_data:
d=json.load(json_data)
json_data.close()
code_array = d["hits"]["hits"]
output_json = []
for element in code_array:
gistid = ele... |
5,686 | 6591ad20d4a07f29f22b50b6e8998c51e53600d6 | def getArticle():
text = []
idx = 1
with open('article.txt','r') as f:
data = f.readlines()
for i in data:
if i != '\n':
s = "{ 'id':" + str(idx) + "," + "'text':" + i.rstrip() + " }"
text.append(s)
idx+=1
return text
a = getArticle()
print a
'''
create a list of 100 words article
use javascri... |
5,687 | 559e46aa4e9b55f8c01acf30fa01e106ab914116 | # -*- coding: utf-8 -*-
"""
.. codeauthor:: Daniel Seichter <daniel.seichter@tu-ilmenau.de>
"""
import argparse
from glob import glob
import os
import cv2
import numpy as np
import matplotlib.pyplot as plt
import torch
import torch.nn.functional as F
from src.args import ArgumentParserRGBDSegmentation
from src.build_... |
5,688 | d8d0c181fcfc9e0692369cc7a65259c43a68e931 | #
# struct_test.py
# Nazareno Bruschi <nazareno.bruschi@unibo.it>
#
# Copyright (C) 2019-2020 University of Bologna
#
# 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.o... |
5,689 | 7b45c9e31bfb868b1abde6af0d8579b52f86d9c3 | from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from subprocess import call
app = Flask(__name__)
app.config['SECRET_KEY'] = "SuperSecretKey"
#app.config['SQLALCHEMY_DATABASE_URI'] = "postgresql://fmnibhaashbxuy:73b8e2e2485adfd45f57da653d63950b88fdcae12202a84f80c7f4c297e9e30a@ec2-23-23-222-184.compute-... |
5,690 | 5dccd015a90927e8d2a9c0ea4b11b24bfd4bb65e | import os
import pprint
import math
import sys
import datetime as dt
from pathlib import Path
import RotateCipher
import ShiftCipher
import TranspositionCipher
def process_textfile(
string_path: str,
encryption_algorithm: str,
algorithm_key: float,
output_folderpath: str = str(
... |
5,691 | 25987c15c28e3939f9f531dbc1d4bd9bf622b5a9 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Nov 14 01:32:26 2019
@author: himanshu
"""
import numpy as np
from scipy.interpolate import interp1d
from option import Option
class FFTPricing:
def __init__(self,
option : Option,
riskFreeRate,
... |
5,692 | 08b53ba116b0c5875d39af4ce18296d547d5891d | import json
def get_json_data(page):
with open('geekshop/json_data.json', encoding='utf-8-sig') as file:
json_data = json.load(file)
return json_data[page]
def get_json_products_data(file_path):
with open(file_path, encoding='utf-8-sig') as file:
json_data = json.load(file)
return js... |
5,693 | 4d57fa22282d7b3f8adabedd7a04e32767181890 | from functions.service_funcs.get_data import get_data_character
def clean_room(update):
char, db_sess = get_data_character(update, return_sess=True)
# удаляем старую комнату и всю инфу о ней
if char and char.room:
if char.room.mobs:
for mob in char.room.mobs:
db_sess.de... |
5,694 | 2f15814d97708e33585ea6b45e89b5a5e69d82fe | import json
import nltk
with open('posts.json', 'r') as infile:
posts = []
for line in infile:
posts.append(json.loads(line[0:len(line)-2]))
for post in posts:
print '\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n'
print '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~... |
5,695 | b874bb37fa59d9f1194c517bedbdbafae748786e | S = input()
T = []
sen = ["dream", "dreamer", "erase", "eraser"]
s_len = len(S)
while len(T) <= s_len:
|
5,696 | 05d21a27097cf3295e9328aeafa466973a4d2611 | /home/salmane/anaconda3/lib/python3.7/_weakrefset.py |
5,697 | 5e79a8a8fe79aac900fc0c2ff1caaa73ea08ada2 | from django import template
register = template.Library()
@register.filter(name='phone_number')
def phone_number(number): # Convert a 10 character string into (xxx) xxx-xxxx.
first = number[0:3]
second = number[3:6]
third = number[6:10]
return '(' + first + ')' + ' ' + second + '-' + third
|
5,698 | 1f94ef0aae1128089b34fc952766cc3927677cdf | #!/usr/bin/python3
# -*- coding: utf-8 -*-
#Modules externes
import os
import re
import logging
import csv
import xml.etree.ElementTree as ET
from chardet import detect
#Modules maison
from Abes_Apis_Interface.AbesXml import AbesXml
from Alma_Apis_Interface import Alma_Apis_Records
from Alma_Apis_Interface import Alma... |
5,699 | 8251a9c798b3cdc2f374d0a0406ccfaa11b7c5e3 | __version__ = '0.2.11'
# This list defines all the modules that will be loaded if a user invokes
# from climLab import *
# totally out of date!
#__all__ = ["constants", "thermo", "orbital_table",
# "long_orbital_table", "insolation", "ebm",
# "column", "convadj"]
#from climlab import radiatio... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.