index int64 0 1,000k | blob_id stringlengths 40 40 | code stringlengths 7 10.4M |
|---|---|---|
9,100 | 73a778c6e4216c23ac8d82eef96ce7b73b18f661 | """This is the body of the low-level worker tool.
A worker is intended to run as a process that imports a module, mutates it in
one location with one operator, runs the tests, reports the results, and dies.
"""
import difflib
import importlib
import inspect
import json
import logging
import subprocess
import sys
impo... |
9,101 | c6a6b8f2485528af479fadbdf286e82f10a11de8 | import collect_from_webapi.api_public_data as pdapi
from collect_from_webapi import pd_fetch_tourspot_visitor
# url = pdapi.pd_gen_url("http://openapi.tour.go.kr/openapi/serviceTourismResourceStatsService/getPchrgTrrsrtVisitorList",
# YM='{0:04d}{1:02d}'.format(2017, 1),
# ... |
9,102 | 99f50d393e750bd8fa5bee21d99f08d20b9f5fe9 | from covid import FuzzyNet
import numpy as np
import time
if __name__ == '__main__':
# mx1,mx2,mx3,my1,my2,my3, dx1,dx2,dx3,dy1,dy2,dy3, p1,p2,p3,p4,p5,p6,p7,p8,p9, q1,q2,q3,q4,q5,q6,q7,q8,q9, r1,r2,r3,r4,r5,r6,r7,r8,r9
generations = 100
for generation in range(generations):
population = np.rando... |
9,103 | 010f78d952657b3d7c11fbf8e46912d0294f6cc1 | # python imports
import re
# django imports
from django.core.management.base import BaseCommand
# module level imports
from utils.spells import SPELLS
from spells.models import Spell
SPELL_SCHOOL = {
'Abjuration': 'Abjuration',
'Conjuration': 'Conjuration',
'Divination': 'Divination',
... |
9,104 | e1448e62020f87e315d219be97d9af84607441df | """SamsungTV Encrypted."""
import aiohttp
from aioresponses import aioresponses
import pytest
from yarl import URL
from samsungtvws.encrypted.authenticator import SamsungTVEncryptedWSAsyncAuthenticator
@pytest.mark.asyncio
async def test_authenticator(aioresponse: aioresponses) -> None:
with open("tests/fixtures... |
9,105 | 21fec6d307b928a295f2ffbf267456f9cd9ea722 | import os
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import cv2
import color_to_gray_operations
VIZ_PATH = '../output_data/visualizations/gray_intensities/'
def visualize_grayscale_intensities(img, out_path):
img_x, img_y = np.mgrid[0: img.shape[0], 0: img.shape... |
9,106 | 31416f1ba9f3c44a7aa740365e05b5db49e70444 | #! /usr/bin/env python3
from PIL import Image
from imtools import *
import os
cwd = os.getcwd()
filelist = get_imlist(os.getcwd())
print(filelist)
for infile in filelist:
outfile = os.path.splitext(infile)[0] + ".jpg"
if infile != outfile:
try:
Image.open(infile).save(outfile)
except IOError:
print("ca... |
9,107 | 3eaa898d1428e48aeb0449c7216d0a994262f76a | """Plotting functionality for ab_test_model."""
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
from itertools import combinations
from ._ab_test_model_utils import _ab_test_utils
# pylint: disable=no-member
class _ab_test_plotting(_ab_test_utils):
"""Provide Funcs for class to plot Baye... |
9,108 | bd96b31c5de2f0ad4bbc28c876b86ec238db3184 | n = int(input("Please input the number of 1's and 0's you want to print:"))
for i in range (1, n+1):
if i%2 == 1:
print ("1 ", end = "")
else:
print ("0 ", end = "") |
9,109 | 22f7f725d89db354b2e66ff145550192826af5ea | /opt/python3.7/lib/python3.7/_weakrefset.py |
9,110 | 687f7f4908e8a5448335f636edf74a627f03c306 | from typing import Tuple, Union
from webdnn.graph.graph import Graph
from webdnn.graph.operators.zero_padding_2d import ZeroPadding2D
from webdnn.graph.operators.convolution2d import Convolution2D
from webdnn.graph.operators.max_pooling_2d import MaxPooling2D
from webdnn.graph.operators.average_pooling_2d import Avera... |
9,111 | 4048d7bfc7922ef76d98d43e1ea266e732e0982e |
import requests
# qq推送 申请参考https://cp.xuthus.cc/
key = ''
def main():
try:
api = 'http://t.weather.itboy.net/api/weather/city/' # API地址,必须配合城市代码使用
city_code = '101070201' # 进入https://where.heweather.com/index.html查询你的城市代码
tqurl = api + city_code
response = requests.get(tqurl)
... |
9,112 | f24075ea70851ce95bb6b3cd87b6417f8141d546 | import unittest
import hospital.employee.nurse as n
class TestNurse(unittest.TestCase):
@classmethod
def setUpClass(cls):
print('Start testing nurse')
def setUp(self):
self.n1 = n.Nurse('Tess',18,"5436890982",3200,25)
self.n2 = n.Nurse('Melissa',40,"8920953924",9000,5)
def... |
9,113 | 7ea6fefa75d36ff45dcea49919fdc632e378a73f | from sqlalchemy import create_engine
from sqlalchemy import Table,Column,Integer,String,MetaData,ForeignKey
from sqlalchemy.sql import select
from sqlalchemy import text
#Creating a database 'college.db'
engine = create_engine('sqlite:///college.db', echo=True)
meta = MetaData()
#Creating a Students table
s... |
9,114 | 8f7ecbe03e9a7a1d9df8cbe4596456e21b84653b | from base64 import b64encode
from configparser import ConfigParser
import functools
from flask import (
Blueprint, flash, redirect, render_template, request, session, url_for, app
)
from requests.exceptions import SSLError
import spotipy
from spotipy import oauth2
bp = Blueprint('auth', __name__, url_prefix='/auth... |
9,115 | 51848a64102f7fe8272fcf56a9792ed50c430538 | import random
def patternToNumber(pattern):
if len(pattern) == 0:
return 0
return 4 * patternToNumber(pattern[0:-1]) + symbolToNumber(pattern[-1:])
def symbolToNumber(symbol):
if symbol == "A":
return 0
if symbol == "C":
return 1
if symbol == "G":
return 2
if sy... |
9,116 | a724b49c4d86400b632c02236ceca58e62ba6c86 | import json
import datetime
import string
import random
import logging
import jwt
from main import db
from main.config import config
def execute_sql_from_file(filename):
# Open and read the file as a single buffer
fd = open(filename, 'r')
sql_file = fd.read()
fd.close()
# All SQL commands (spli... |
9,117 | 889fdca3f92f218e6d6fd3d02d49483f16a64899 | new_tuple = (11,12,13,14,15,16,17)
new_list = ['one' ,12,'three' ,14,'five']
print("Tuple: ",new_tuple)
print("List: ", new_list)
tuple_2= tuple (new_list)
print("Converted tuple from the list : ", tuple_2) |
9,118 | e8ea307352805bf0b5129e2ad7f7b68c44e78fc9 | import src.engine.functions.root_analyzer.main as main
from src.engine.functions.function import Function
class GetRootData(Function):
def __init__(self, data_display):
self.data_display = data_display
def call(self, args):
image_folder_path = args[0]
output_path = args[1]
sel... |
9,119 | d8e9b9f7a8d5ec2a72f083ec2283e8c0724dbe0d | #coding=utf-8
import urllib.parse
import json
'''转化从charles复制下来的字串,转为json格式'''
def to_str(body_str):
'''检查需要转化的str是否符合标准'''
if not body_str == '':
par = body_str.split("&")
# print(par)
_temp = []
try:
for each in par:
if "=" not in each:
... |
9,120 | 5d988d159902e4a4cb17ee0ec61153de2dda4691 | try:
from setuptools import setup
from setuptools import find_packages
has_setup_tools = true
except ImportError:
from distutils.core import setup
has_setup_tools = false
with open("README.md", "r") as fh:
long_description = fh.read()
if has_setup_tools is True:
packages = setuptools.find_... |
9,121 | bb9ff561ff94bbe4d20f14287ba313386ea78609 | import openpyxl
from openpyxl import Workbook
import openpyxl as openpyxl
from openpyxl.chart import BarChart
wb = openpyxl.load_workbook('/Users/mac/Desktop/stu_scores _Grade 2.xlsx')
sheet = wb['stu_scores_01']
data = openpyxl.chart.Reference(sheet, min_col=3, min_row=34, max_row=34,max_col=7)
cat = openpyxl.chart.... |
9,122 | b39403171ed264c8fae5ea4ae9d17f77cfcab497 | import unittest
import sys
import os
#Add project root to path
sys.path.append('../..')
from speckle.SpeckleClient import SpeckleApiClient
class TestSpeckleStream(unittest.TestCase):
def setUp(self):
self.s = SpeckleApiClient()
self.user = {'email':'testuser@arup.com','password':'testpassword',... |
9,123 | 906b7f02d6a7968bbf4780e682d4f9a92526326a |
# Taken from: https://github.com/flyyufelix/cnn_finetune/blob/master/vgg16.py
# based on: https://gist.github.com/baraldilorenzo/07d7802847aaad0a35d3
# -*- coding: utf-8 -*-
import keras
import itertools
import sys
from sklearn.metrics import confusion_matrix
import numpy as np
import matplotlib
import ma... |
9,124 | 0c0fb3bfb81be5ef6a60584eafeefec61f171679 | import pytest
import json
import os.path
import importlib
import jsonpickle
from fixture.application import Application
fixture = None
config = None
@pytest.fixture
def app(request):
global fixture
global config
browser = request.config.getoption("--browser")
if config is None:
conf_file_pat... |
9,125 | ccc74f58eff3bb00f0be8c2c963de4208b7f0933 | from math import ceil, log2, sqrt
def constructST(s, start, end, st, i):
if start == end:
st[i] = 0
openst[i] = 1 if s[start] == '(' else 0
closedst[i] = 1 if s[start] == ')' else 0
return st[i], openst[i], closedst[i]
else:
mid = (start+end)//2
st[i], openst[i], closedst[i] = constructST(s, ... |
9,126 | aa55f1dd4f363e07d5f9104346efaa24c0457d45 | from .sgd import StochasticGradientDescent
from .momentum import Momentum
|
9,127 | e99e558ebf5938a90f00df6593c9f75a18affcb8 | import sqlparse
f = open("parse.sql")
go = open("struct.go", "w+")
dictiony = {
"uuid": "string",
"varchar": "string",
"timestamp": "time.Time",
"int": "int",
"text": "string",
"dbname": "IndividualContrAgent",
"interface": "IndividualContrAgentI",
"ica":"ica"
}
#package
go.write("packa... |
9,128 | d5d12e2269b343dde78534eddf2cce06759eb264 | # Copyright 2017 Klarna AB
#
# 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 in writing, s... |
9,129 | b9c8689dbdf451e6a981f1abdae55771266fe231 | import json
import os
from flask import Flask, request, url_for
from flask_cors import CORS
from werkzeug.utils import secure_filename
from service.Binarizacion import Binarizacion
UPLOAD_FOLDER = './public/files'
app = Flask(__name__)
app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
CORS(app)
@app.route('/')
def hell... |
9,130 | dcc1b0decf2fca6309dbb60faebd3f0a6944cd7d | #!/usr/local/bin/python
i = 0
while i == 0:
try:
print("Let's divide some numbers!")
a1 = input("Enter numerator: ")
b1 = input("Enter denominator: ")
a = int(a1)
b = int(b1)
print(a1 + " divied by " + b1 + " equals: " + str(a/b))
i += 1
except... |
9,131 | ac60fd79d7fb15624cf79adc7e456960e7523e2e | import sys
from google.appengine.ext import blobstore
from google.appengine.ext.webapp import blobstore_handlers
from google.appengine.ext import ndb
from helpers import *
def valid_pw(name, password, h):
salt = h.split(',')[0]
return h == make_pw_hash(name, password, salt)
class CVEProfile(ndb.Model):
profile_nam... |
9,132 | 06cb832c3adae95fcd1d1d2d0663641d3ac671ef | def main():
x = float(input("Coordenada x: "))
y = float(input("Coordenada y: "))
if 1 <= y <= 2 and -3 <= x <= 3:
print("dentro")
elif (4 <= y <= 5 or 6 <= x <= 7) and ( -4 <= x <= -3 or -2 <= x <= -1 or 1 <= x <= 2 or 3 <= x <= 4):
print("dentro")
e... |
9,133 | 0a90f29a4e18c2aed23cb31b4239d44d23526327 | from telegram.ext import Updater, Filters, MessageHandler, PicklePersistence
import telegram
import logging
logging.basicConfig(format='%(asctime)s %(message)s\n',
level=logging.INFO,filename='log.json')
logger = logging.getLogger(__name__)
def main():
# my_persistence = PicklePersistence(... |
9,134 | 002cced6d24a4790d29f195355c795d609f744a7 | n = int(input())
m = int(input())
x = int(input())
y = int(input())
if m<n:
if m-x < x:
x = m-x
if n-y < y:
y = n-y
else:
if n-x <x:
x=n-x
if m-y <y:
y=m-y
if x<y:
print(x)
else:
print(y)
|
9,135 | dcbbc7098410d771a7151af7c43ac4d0e4d46f18 | ##########################################################################
#
# Draw a 2-D plot for student registration number and the marks secured using gnuplot
#
##########################################################################
import Gnuplot
# create lists to store student marks and regno
student_reg=[... |
9,136 | 783326ccec31dc7a0ff46c5e4b69806e99aeda57 | # template for "Guess the number" mini-project
# input will come from buttons and an input field
# all output for the game will be printed in the console
import simplegui
import random
import math
# initialize global variables used in your code
range = 100
guesses_made = 0
guesses_remaining = 0
highest_guess = 0
lowes... |
9,137 | c812419e7e024b0bb1207832b2b4a726ef61b272 | class FieldDesigner:
"""
Designs a field for BattleShips, accepts field height and width
"""
def __init__(
self,
):
self.field = []
def design_field(
self,
height,
width,
):
self.field = [[
'~' for __
... |
9,138 | a14a1803a0bae755803c471b12035398de262dbc | import re
def molecule_to_list(molecule: str) -> list:
"""Splits up a molucule into elements and amount in order of appearance
Args:
molecule (str): The molecule to split up
Raises:
ValueError: If molecule starts with a lower case letter
ValueError: If molecule contains a non-alp... |
9,139 | 753c87a3d22aeca1001eb770831b846b175d873e | from hops import constants
class Cluster(object):
"""
Represents a Cluster in Cluster Analysis computed for a featuregroup or training dataset in the featurestore
"""
def __init__(self, cluster_json):
"""
Initialize the cluster object from JSON payload
Args:
:clust... |
9,140 | 63bfaa6e191e6090060877e737f4b003bed559cf | #! /usr/local/bin/python3
# -*- coding: utf-8 -*-
from requests_oauthlib import OAuth1Session
BASEURL = 'https://api.twitter.com/1.1/'
CK = '3rJOl1ODzm9yZy63FACdg'
CS = '5jPoQ5kQvMJFDYRNE8bQ4rHuds4xJqhvgNJM4awaE8'
AT = '333312023-6dTniMxvwlQG8bATKNYWBXaQkftz9t4ZjRBt7BWk'
AS = 'LQ8xXBTTN8F8CHQv9oDAqsGJFeexdnFf2DFzn3E... |
9,141 | 89ba805e47a9727573e1e25371a70fb887ee170d | import datetime
import operator
import geopy
from django.db import models
from django.db.models import Q
from django.db.models.query import QuerySet
from django.db.models import permalink
from django.contrib.auth.models import User
geocoder = geopy.geocoders.Google()
class City(models.Model):
name = models.C... |
9,142 | 9b3040fa02cf8f039bac146f8a73384731c56722 | #While Loop
count = 0
while count<9:
print("Number:",count)
count = count+1
print("Good Bye")
#For Loop
fruits = ['Mango','Grapes','Apple']
for fruit in fruits:
print("current fruits:",fruit)
print("Good bye")
|
9,143 | 01de85b0d480c105c8cc1a8154c3de936ab3226d | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# File: wenshu/actions.py
# Author: Carolusian <https://github.com/carolusian>
# Date: 22.09.2018
# Last Modified Date: 22.09.2018
#
# Copyright 2018 Carolusian
import time
import itertools
import re
import requests
import json
import os
from random import randint
from se... |
9,144 | a826f33361ec59824f3c4a83d01e94c6b307b0a9 | import os
#defaults = {"N":20, "K":3, "POP_SIZE":200, "MUT_RATE":.05, "TOURNAMENT_SIZE":2, "SELECTION":0, "CHANGE_RATE":100000, "MAX_GENS": 5000, "FILTER_LENGTH":50}
defaults = {"N":20, "K":3, "POP_SIZE":200, "MUT_RATE":.05, "TOURNAMENT_SIZE":2, "SELECTION":0, "CHANGE_RATE":100000, "MAX_GENS": 5000, "FILTER_LENGTH":"... |
9,145 | 19126e5041841ab1320730ae82d66c6900cf31bd | import sys, os
sys.path.insert(0, os.path.abspath("adjust_schedule_function"))
|
9,146 | 3458e1efdc492a08d8272469aa9e3f0ca72c7ba3 | import h5py
import sys
f = h5py.File(sys.argv[1], 'r+')
try:
del f['optimizer_weights']
except:
print "done"
f.close() |
9,147 | 84ece5d1a9e38b83a5b60052fc3ab089c498d2fc | from django.contrib import admin
from get_my_tweets.models import username
admin.site.register(username)
|
9,148 | 0ed0fb6f9bcc768bb005222c9ae9b454f6d962ec | #!/usr/bin/env python
from __future__ import print_function
import weechat
import sys
import pickle
import json
import math
import os.path
from datetime import datetime
from datetime import date
from datetime import timedelta
from dateutil.parser import parse as datetime_parse
from os.path import expanduser
from goog... |
9,149 | 3fadb91bd2367819a540f687530f4b48ed878423 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
help_txt = """
:help, show this help menu. :help [command] for detail
:dict [word], only find translation on dict.cn
:google [sentence], only find translation on google api
:lan2lan [sentence], translate from one language to another language
:add [word], add new word to yo... |
9,150 | f97150f60dfb3924cda2c969141d5bfe675725ef | #!env/bin/python3
from app import app
from config import config as cfg
app.run(debug=True, host=cfg.APP_HOST, port=cfg.APP_PORT)
|
9,151 | bd2edd5139a9c5050c582a54cdacca2b0739f333 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import datetime
import warnings
from functools import wraps
import re
import logging
import pandas as pd
import requests
def return_df(field="data"):
"""return DataFrame data"""
def decorator(func):
@wraps(func)
def wrapper(self, *args, **kwargs):... |
9,152 | ff26a2c2d8427f1ad4617669e701ea88b34616cd | #! /usr/bin/env python
# coding: utf-8
'''
Author: xiezhw3@163.com
@contact: xiezhw3@163.com
@version: $Id$
Last modified: 2016-01-17
FileName: consumer.py
Description: 从 rabbitmq 拿到消息并存储到数据库
'''
import pika
import json
import logging
import pymongo
import traceback
from conf import config
from code.modules.db_proce... |
9,153 | 3c053bf1b572759eddcd310d185f7e44d82171a5 | #coding:utf-8
x = '上'
res = x.encode('gbk')
print(res, type(res))
print(res.decode('gbk'))
|
9,154 | 1edb92a4905048f3961e3067c67ef892d7b8a034 | # Imports
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
from torch.utils import data
from torch.utils.data import DataLoader
import torchvision.datasets as datasets
import torchvision.transforms as transforms
# Create Fully Connected Network
class NN(nn.Module):
def... |
9,155 | fc6c220f8a3a0e9dd1d6e6e1ca131136db8f8a58 | # -*- coding: utf-8 -*-
"""
Created on Mon Nov 11 18:50:46 2019
@author: kanfar
"""
import numpy as np
import timeit
import matplotlib.pyplot as plt
from numpy import expand_dims, zeros, ones
from numpy.random import randn, randint
from keras.models import load_model
from keras.optimizers import Adam
from keras.model... |
9,156 | 4dae34b7c90f52314aac5e457addb3700ffcbd28 | import sys
sys.path.append("..\\Pole_IA_Systemes_Experts")
from tkinter import *
from Knowledge_base.Facts import Fact
from Knowledge_base.Rules import Rule
from Backward.Explanation_tree import *
def ask_about_fact(fact: Fact):
"""
Asks the user about whether a fact is true or false threw an interface provi... |
9,157 | 9515dcdfc0ece1a6740d6e7075bbcd1c20977590 | #! /usr/bin/env python2
############################################################
# Program is part of PySAR v1.2 #
# Copyright(c) 2015, Heresh Fattahi, Zhang Yunjun #
# Author: Heresh Fattahi, Zhang Yunjun #
####################################################... |
9,158 | 13b2e05f12c6d0cd91e89f01e7eef610b1e99856 | # from __future__ import annotations
from typing import List,Union,Tuple,Dict,Set
import sys
input = sys.stdin.readline
# from collections import defaultdict,deque
# from itertools import permutations,combinations
# from bisect import bisect_left,bisect_right
import heapq
# sys.setrecursionlimit(10**5)
# class UnionFi... |
9,159 | 6990b5f34af654b4e1a39c3d73b6822fa48e4835 | import requests
import re
import time
import os
import argparse
import json
url = "https://contactform7.com/captcha/"
headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1.1 Safari/605.1.15',
'Content-Type': "multipart/form-data; boun... |
9,160 | 387c48fcf00480a820fb407f5bad1d9f41b28e7a | #!/usr/bin/python
# coding=utf-8
import re
str1 = 'http://www.chinapesticide.org.cn/myquery/querydetail?pdno='
str2 = '&pdrgno='
f = open('aaa.txt', 'r')
source = f.read()
rr = re.compile(r'open[(\'](.*)[\']')
s=rr.findall(source)
for line in s:
temps = line.split(',')
a = temps[0]
b = temps[1]
print ... |
9,161 | 00ec56420831d8f4ab14259c7b07f1be0bcb7d78 | # -*- coding: utf-8 -*-
# @Time : 2018/12/13 21:32
# @Author : sundongjian
# @Email : xiaobomentu@163.com
# @File : __init__.py.py
# @Software: PyCharm |
9,162 | fef1cf75de8358807f29cd06d2338e087d6f2d23 | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""The GIFT module provides basic functions for interfacing with some of the GIFT tools.
In order to use the standalone MCR version of GIFT, you need to ensure that
the following commands are executed at ... |
9,163 | 88e4e6647d4720d1c99f3e3438100790903921b5 | import os
import click
import csv
import sqlite3
from sqlite3.dbapi2 import Connection
import requests
import mimetypes
from urllib.parse import urljoin, urlparse
from lxml.html.soupparser import fromstring
from lxml import etree
from lxml.etree import tostring
from analysis import lmdict, tone_count_with_negation_chec... |
9,164 | 79c6b7c3d23248f249b55af1d097a66a78a2c22f | x = int(input("Enter number:"))
y = x/2
print(y)
for i in
|
9,165 | 379c666f19537b513169c6b30e0c669dda6e372c | ii = [('CoolWHM2.py', 73), ('MarrFDI3.py', 2), ('IrviWVD.py', 2), ('CoolWHM3.py', 8), ('LewiMJW.py', 1), ('JacoWHI2.py', 4), ('EvarJSP.py', 1)] |
9,166 | a8bed0b5a6a95d67b5602b395f1d0ea12cd53fb0 | #!/usr/bin/env python
s = '''Вбс лче ,мтс ооепта т.сбзек о ып гоэятмв,те гоктеивеысокячел–аонкы оах ннлнисьрнксе ьрм отаб тёьдр ннласааосд це аЧиу нвыанзи еслкмиетл,леево ннлтпо еик:ыаырялньб пнм би на це азоватоша Вепьлаяокеолвоытрх еытодрпьтае,кллгфм ытитослРянозит нсонунс.р лунттаё ооиВяе зн етвйеетелттв еСлл... |
9,167 | 6ff300bbd7866466d1992445e46c5ee54f73d0d7 | # -*- encoding: utf-8 -*-
# @Version : 1.0
# @Time : 2018/8/29 9:59
# @Author : wanghuodong
# @note : 生成一个简单窗口
import sys
from PyQt5.QtWidgets import QApplication, QWidget
if __name__ == '__main__':
'''所有的PyQt5应用必须创建一个应用(Application)对象。sys.argv参数是一个来自命令行的参数列表。Python脚本可以在shell中运行'''
app = QApplic... |
9,168 | f840624ec11679d576fbb80f8e753c59663a7ee2 | #!/usr/bin/env python
# USAGE: day_22_01.py
# Michael Chambers, 2017
class Grid:
def __init__(self, startFile):
# Load initial infected sites
# Origin is top-left of input file
self.infected = set()
posx = 0
with open(startFile, 'r') as fo:
for i, line in enumerate(fo):
line = line.rstrip()
posx... |
9,169 | b717abaeecea2e97c6ec78d3e0e4c97a8de5eec3 | """Implementation of the Brainpool standard, see
https://tools.ietf.org/pdf/rfc5639.pdf#15
"""
from sage.all import ZZ, GF, EllipticCurve
from utils import increment_seed, embedding_degree, find_integer, SimulatedCurves, VerifiableCurve, \
class_number_check
CHECK_CLASS_NUMBER = False
def gen_brainpool_prime... |
9,170 | 9dc8449bcc0c6c6ffb5ced5724ca632b6578bf1b | from flask import Flask, render_template, request
import matplotlib.pyplot as plt
import numpy as np
import sympy
from DerivTest import diff, diff2, trapz
from sympy.parsing.sympy_parser import parse_expr
from sympy import Symbol
#from ParsingClass import Parser
#from scitools.StringFunction import StringFunction
#from... |
9,171 | feac1092d1aaf70eb4d4df919e434cdc1aa9c826 |
import numpy as np
from scipy import stats
from statarray import statdat
#a2a1 = np.loadtxt('a2a1_130707_2300.dat')
#a2a1 = np.concatenate( (a2a1, np.loadtxt('a2a1_130708_1223.dat')), axis=0 )
#a2a1 = np.loadtxt('a2a1_130708_1654.dat')
#a2a1 = np.loadtxt('a2a1_130709_0030.dat')
import matplotlib.pyplot as plt
impo... |
9,172 | 6efe3975f4d5d9f431391b3560c37a3e89e27f3d | # (c) 2019, Ansible by Red Hat, inc
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
#
from __future__ import absolute_import, division, print_function
__metaclass__ = type
from ansible_collections.arista.eos.tests.unit.compat.mock import patch
from ansible_collections.ari... |
9,173 | 0aa95b6a72472e8e260c07f4c42a327384ca0da4 | from Psql_Database_Setup import *
import requests, json
engine = create_engine('postgresql://myuser:mypass@localhost:5432/mydb')
Base.metadata.bind = engine
DBSession = sessionmaker(bind=engine)
session = DBSession()
response = requests.get("https://api.github.com/emojis")
response = json.loads(response.te... |
9,174 | f51a21ed71ede4e7462d9c77cb932a5f05b09e71 | # import core modules and community packages
import sys, math, random
import pygame
# import configuration settings
from src.config import *
from src.board.levels import LEVEL_1
# import game elements
from src.pucman import Pucman
from src.ghast import Ghast
from src.board.board import Board
class Session():
def... |
9,175 | 33b68246dd3da9561c1d4adb5a3403cba656dcee | from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^stats/$', views.get_stats, name='stats'),
url(r'^follow/me/$', views.follow_me, name='follow_me'),
url(r'^follower/confirm/$', views.confirm_follower, name='follower_confirm'),
url(r'^execute/', views.execute, name='executed')... |
9,176 | 5bfaadcd54aaf239d0d89158bfb723c0174c56b1 | import sys
from elftools.elf.elffile import ELFFile
from capstone import *
def process_file(filename):
with open(filename, 'rb') as f:
elffile = ELFFile(f)
code = elffile.get_section_by_name('.text')
rodata = elffile.get_section_by_name('.rodata')
plt = elffile.get_section_by_name('... |
9,177 | 2985360c1e2d03c619ea2994c609fdf8c033bebd | #!/usr/bin/env python
import rospy
import numpy as np
import time
import RPi.GPIO as GPIO
from ccn_raspicar_ros.msg import RaspiCarWheel
from ccn_raspicar_ros.msg import RaspiCarWheelControl
from ccn_raspicar_ros.srv import RaspiCarMotorControl
class MotorControl(object):
def __init__(self, control_pin=[16, 18,... |
9,178 | 2bc9c0711831d9ed9009d0f9600153709bbcd6da | '''
Created on Sep 4, 2014
@author: Jay <smile665@gmail.com>
'''
import socket
def ip_validation(ip):
'''
check if the ip address is in a valid format.
'''
try:
socket.inet_aton(ip)
return True
except socket.error:
return False
def connection_validation(ip, port):
'... |
9,179 | fc8b9029955de6b11cbfe8e24107c687f49685c1 | from rest_framework import serializers
from .models import Good, Favorite, Comment
class GoodSerializer(serializers.ModelSerializer):
class Meta:
model = Good
fields = ('user', 'article', 'created_at')
class FavoriteSerializer(serializers.ModelSerializer):
class Meta:
model = Favori... |
9,180 | e0fd9663a5635873f4ffc0f73aff5106c0933781 | from django import forms
from .models import Note
class NoteForm(forms.ModelForm):
class Meta:
model = Note
fields = ['title','text']
class NoteFullForm(NoteForm):
note_id = forms.IntegerField(required=False)
images = forms.FileField(widget=forms.ClearableFileInput(attrs={'multiple': True}... |
9,181 | a33ddb999f7bb50688b33946046ba460cbbbd172 | from backend.personal.models import User, UserState
from rest_framework import status
from rest_framework.decorators import api_view
from rest_framework.response import Response
from backend.personal.views import produceRetCode, authenticated
from backend.utils.fetch.fetch import fetch_curriculum
from backend.univinfo.... |
9,182 | 79e4e37fc17462508abf259e3a7861bd76797280 |
import unittest
import BasicVmLifecycleTestBase
class testVmIsAccessibleViaSsh(BasicVmLifecycleTestBase.VmIsAccessibleViaSshTestBase):
vmName = 'cernvm'
timeout = 20*60
sshTimeout = 5*60
def suite():
return unittest.TestLoader().loadTestsFromTestCase(testVmIsAccessibleViaSsh)
|
9,183 | 4b773fbf45d15dff27dc7bd51d6636c5f783477b |
from pyspark import SparkContext, SparkConf
import time
# Create a basic configuration
conf = SparkConf().setAppName("myTestCopyApp")
# Create a SparkContext using the configuration
sc = SparkContext(conf=conf)
print("START")
time.sleep(30)
print("END")
|
9,184 | a61bc654eecb4e44dce3e62df752f80559a2d055 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2014 Vincent Celis
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the righ... |
9,185 | 31e5b249516f4e9d57d8fd82713966a69e0516b4 | from django.urls import path
from .consumers import NotificationsConsumer
websocket_urlpatterns = [
path('ws/notifications', NotificationsConsumer),
]
|
9,186 | 5dc6b54357df87077d8159192cd52697b2616db8 | from django.test import TestCase, SimpleTestCase
from django.urls import reverse, resolve
from .views import profile, order_history
""" Url Testing """
class TestUrls(SimpleTestCase):
def test_profile_resolves(self):
url = reverse('profile')
self.assertEqual(resolve(url).func, profile)
def t... |
9,187 | ee10bca1126b20378c4e9cea4d2dc7ed6a2044ab | from flask import Blueprint, render_template
from bashtube import cache
singlevideos = Blueprint('singlevideos',__name__,template_folder='templates')
@singlevideos.route('/')
def index():
return render_template('singlevideos/single.html')
|
9,188 | 178570047458eb3eeda00f9153ef2159eb4cbef3 | from svjesus.ffz import genContent
from svjesus.elements.Base import Element
class Descriptive(Element):
def __init__(self):
self.allowedChildren = () # TODO: Check what's allowed
# Descriptive elements
class Desc(Descriptive):
name = "desc"
attrs = ()
class Metadata(Descriptive):
name = "metadata"
attrs = ()... |
9,189 | 8cbe78863de535a5b83eacebe67402569b4015fa | A,B=map(str,input().split())
if(A>B):
print(A)
elif(B>A):
print(B)
else:
print(AorB)
|
9,190 | 7c2897dcb732e75d7328e8c0484d5bd7f3b56e6f | """
Given a string s. Return all the words vertically in the same
order in which they appear in s.
Words are returned as a list of strings, complete with spaces
when is necessary. (Trailing spaces are not allowed).
Each word would be put on only one column and that in one column
there will... |
9,191 | e85d3660968410b83b14ba610150c0c8cc880119 | import datetime # to add timestamps on every block in blockchain
import hashlib # library that is ued to hash the block
import json # to communicate in json data
# Flask to implement webservices jsonify to see the jsop message/response
# request help us to connect all the nodes of the blockchain together froming the... |
9,192 | d9b405d5159a153fb8d2f1991ceb3dc47f98bcbc | from app.View.view import View
class GameController:
instance = None
@staticmethod
def get_instance():
if GameController.instance is None:
GameController()
return GameController.instance
def __init__(self):
if GameController.instance is not None:
raise... |
9,193 | 845d1251497df61dd2c23241016a049c695ad940 | #!/usr/bin/env python3
#coding=utf-8
import sys
import os
import tool
class BrandRegBasic(object):
def __init__(self, base_folder, log_instance):
if not os.path.exists(base_folder):
raise Exception("%s does not exists!" % base_folder)
self._real_brand_p = base_folder + "/real_brand.txt... |
9,194 | 32f10c3e73a3d792416f6b2841a80f8b3c390e8c | # Copyright 2023 Sony Group 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 ... |
9,195 | 2f0aa1f294f34a4f3ffb47c15ab74fc792765f10 | from MultisizerReader import MultiSizerReader
import os
import matplotlib.pyplot as plt
#Get all spread sheet files in fodler and create multisizer files for each
folder = "./Data_Organised/DilutionTestingLowOD"
allFiles = os.listdir(folder)
multiSizerFiles = [allFiles[i] for i in range(len(allFiles)) if allFiles[i].e... |
9,196 | 5c908697000247056bb63a443f837eef88b4c957 | positivo = float(1.0000001)
negativo = float(-1.000001)
print(negativo, positivo)
b_pos = bin(positivo)
b_neg = bin(negativo)
print(b_neg, b_pos)
|
9,197 | 3bb50b61c7a3e98ede0a31e574f39b4ea7f22de5 | """
corner cases like:
word[!?',;.]
word[!?',;.]word[!?',;.]word
so don't consider the punctuation will only exist after one word, and followed by a whitespace
use re for regular expression match,
replace or punctuations, and split words
"""
class Solution:
def mostCommonWord(self, paragraph, banned):
... |
9,198 | 63c0786d277c5576822d6e521f65850762ab5eb0 | """insta URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based v... |
9,199 | 3c31e3f2a6f320bc5ae33f0ba1d234a089371899 | import os, argparse,collections
defaults ={'color':'red','user':'guest'}
parser=argparse.ArgumentParser()
parser.add_argument('-u','--user')
parser.add_argument('-c','--color')
#a simple Namespace object will be built up from attributes parsed out of the command lin
namespace= parser.parse_args()
command_line_args= ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.