index int64 0 1,000k | blob_id stringlengths 40 40 | code stringlengths 7 10.4M |
|---|---|---|
996,300 | a8852ee788103b611fb33644da004dc3cbc97b6d | # basic_view = {
# "influencer": {
# "gender": True, "name": True, "mail":
# }
# }
#
# pro_view = {
#
# }
#
# prime_view = {
#
# }
from Core.Option_values import get_profile_pictures_sources
from Core.dbconn import get_database_connection
def get_topic_name(index: int) -> str:
"""
:param inde... |
996,301 | 2e5dddc9a9ea8ab8b4e0e788146b95140afd0004 | # Generated by Django 3.0.7 on 2020-09-27 19:28
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('manag_app', '0012_payment_ids'),
]
operations = [
migrations.DeleteModel(
name='Payment_ids',
),
]
|
996,302 | 75e5bf22ce8e059ed11785c600bfca4eae61a4cc | # https://github.com/keras-team/keras/blob/master/examples/mnist_mlp.py
# https://nextjournal.com/schmudde/ml4a-mnist
# https://github.com/keras-team/keras/blob/master/examples/mnist_cnn.py (CONVOLUTIONAL)
# https://github.com/Hvass-Labs/TensorFlow-Tutorials/blob/master/01_Simple_Linear_Model.ipynb (TF)
import ke... |
996,303 | 148cebc47169053d5cd0d2196bbb1ddf84d5b50b | # Generated by Django 3.0.5 on 2020-10-02 06:57
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('tsdemo', '0013_auto_20201002_1428'),
]
operations = [
migrations.AlterField(
model_name='apitest',
name='tspara',
... |
996,304 | 4d62ab12dcc0689dab41aa8c9ba95f9659e0c205 | class stars:
def __init__(self, owner, star_data):
self.__owner = owner
self.__star_data = star_data
self.__stars = self.__parse()
self.__set = set(self.__stars)
def __parse(self):
colon_index = self.__star_data.index(':')
before_colon = self.__star_data[:colon_... |
996,305 | 13d50f4473796c8403383fa91b0a9c2e0bbed2f5 | from .interface import Interface
from settings import tooltip_width, tooltip_height, tooltip_x ,tooltip_icon, tooltip_margin
import environment
import pygame
pygame.font.init()
myfont = pygame.font.SysFont('Comic Sans MS', 15)
class ToolTip(Interface):
def __init__(self, map_, y, text):
Interface.__ini... |
996,306 | 5e0cef11f0e77f9a694cfc104ea4dc481eaa6ddd | import sys
sys.path.append('/home/aistudio/external-libraries')
#图像增强
import os
import paddlex as pdx
from paddlex.det import transforms
train_transforms = transforms.Compose([
transforms.Normalize()
])
eval_transforms = transforms.Compose([
transforms.Normalize()
])
os.chdir('/home/aistudio/work')
train_dat... |
996,307 | daf5f0d049d0852eda58dd10b1fa66d0fee38fb4 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Jan 3 01:34:54 2019
@author: edwin
"""
# It is very impractical to find all Pythagorean triples in the required range by brute force, but there is another way.
# We generate all primitive Pythagorean triples as follows:
# Pick m>n s.t. m+n odd, gcd(m... |
996,308 | 285cdbc2695f3806ece1dd6169b292cc7a2b47a4 | from .staff_factory import AbstractStaffFactory
from .manager_factory import ManagerFactory
from .salesperson_factory import SalespersonFactory
from .receptionist_factory import ReceptionistFactory
from src.user.employee import Staff
import random as rd
class RandStaffFactory(AbstractStaffFactory):
def make(self,... |
996,309 | a0eb1e91c2ee24e22ed90a9178c392bacd0a560c | import enum
from typing import Optional
import numpy as np
import scipy.linalg
import scipy.odr
import scipy.optimize
import logging
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
_gaussian_fwhm_factor = 2 * (2 * np.log(2)) ** 0.5 # FWHM = _gaussian_fwhm_factor * sigma
def LorentzPeak(x, A, x0... |
996,310 | 509141aa05d28e038ed75be9896b749846581fc8 | from random import randint
from time import sleep
print('-=-' * 20)
print('Vou pensar em um número entre 0 e 5. Tente adivinhar...')
print('-=-' * 20)
n = randint(0, 5)
resposta = int(input('Em que número eu pensei? '))
print('PROCESSANDO...')
sleep(0.9)
if n == resposta:
print('PERDI! Foi no número {} que pens... |
996,311 | 826bae511f0b0977bbcd37af13770db4e7c762b3 | # -*- coding: utf-8 -*-
"""
Created on Thu Aug 29 15:34:05 2019
@author: NUS
"""
import numpy as np
#####################################################K-means clustering###########################################
# randomly select the centroids
import random
import math
def randCent(data,k):
"""random gengerate... |
996,312 | 0e1818fa38ea961ac4ebcaabc7043da830d13af2 | # Authors:
# Trevor Perrin
# Google - added reqCAs parameter
# Google (adapted by Sam Rushing and Marcelo Fernandez) - NPN support
# Google - FALLBACK_SCSV
# Dimitris Moraitis - Anon ciphersuites
# Martin von Loewis - python 3 port
# Yngve Pettersen (ported by Paul Sokolovsky) - TLS 1.2
# Hubert Kario -... |
996,313 | 8137ddca1c8aaa5bb2653af4251cd06ac6f3c5b4 | from itertools import count
from statistics import mode
from tkinter import N
from django.http.response import HttpResponseBadRequest
from django.shortcuts import render, redirect
from django.http import HttpResponse, JsonResponse
from django.utils import timezone
from django.views.decorators.csrf import ensure_csrf_co... |
996,314 | bef43a16de318aa6a52d4134c9e4872a91198045 | import os
import sys
from sqlalchemy import engine_from_config
from pyramid.paster import get_appsettings, setup_logging
from pyramid.scripts.common import parse_vars
from bash.models import dbs, Base, StaffModel
import transaction
def usage(argv):
cmd = os.path.basename(argv[0])
print('usage: %s <config_uri... |
996,315 | 041e08ac8f5664520f1957ee8bf889017e71be25 | import string
from datetime import timedelta
from core.BaseScraper import BaseScraper
from core.QueueItem import QueueItem
from core.data.SymbolRepository import SymbolRepository
from request.MWSearchRequest import MWSearchRequest
alphabet = string.ascii_lowercase
class RandomMarketWatchSymbols(BaseScraper):
... |
996,316 | e64a65ba3c080ac2806d52e2484181cceacf4903 | N = int(input())
if N == 1:
print(9)
else:
arr = [1] * 10
arr[0] = 0
for i in range(N-1):
n_arr = [0] * 10
n_arr[0] = arr[1]
n_arr[9] = arr[8]
for j in range(1,9):
n_arr[j] = (arr[j-1] + arr[j+1]) % 1000000000
arr = n_arr[:]
print(sum(arr) % 10000... |
996,317 | 19650c7a4b2468a75634f362582822c214554c4f | import nltk
from sklearn.naive_bayes import MultinomialNB
from Classifiers import classifier_abc
# from .classifier_abc import Classifier
from Classifiers import classifier_abc
class MultinomailNBAlgorithm(classifier_abc.Classifier):
def __init__(self, training_required = False,
raw_data_path =... |
996,318 | 78175b6f1f3421b4a54dac5e49160e8a2287027a | import re
from nbconvert import MarkdownExporter
import os
from pathlib import Path
from headers import headers
def atoi(text):
return int(text) if text.isdigit() else text
def natural_keys(text):
test = [ atoi(c) for c in re.split('(\d+)',text) ]
return test
dir = Path("../../../../tutorials")
note... |
996,319 | 8c74a4aef697136eec9a2cd9a34bcaa6006dd2a0 | Calendar in Python
Python has a built-in function, calendar to work with date related tasks. You
will learn to display the calendar of a given date in this example.
Examples:
Input 1 :
yy = 2017
mm = 11
Output : November 2017
Mo Tu We Th Fr Sa Su
... |
996,320 | 729a3135f7e562cf21a95eb5e746aede54864f73 | # TODO rough estimation. Make better code later.
from scipy.spatial import distance
import pickle
import numpy as np
import os
import generate_data
import settings
import matplotlib.pyplot as plt
from scipy import stats
import kernelized_tsne
import logging
import datetime
def generate_cluster_results_filename(param... |
996,321 | 6eeaed5c9cdaa4c4b0fe19a6675bbfdbb29d0af5 | import requests
import xml.etree.ElementTree as ET
from requests.auth import HTTPDigestAuth
from .soap import SoapRequest
def get_myfritz(username:str, password:str) -> str:
r = SoapRequest(
url='http://fritz.box:49000/upnp/control/x_myfritz',
urn='dslforum-org:service:X_AVM-DE_MyFritz:1',
... |
996,322 | 0be7640ae32af2c3f0153627d6dad90283762af2 | import json
import os
def json_to_python_object(file):
"""
Get all data from json file.
:param file: file from jsons folder
"""
with open(f"objects/{file}") as f:
json_file = json.load(f) # Load json file
json_objects = json_file['objects'] # Parse all data into python file
... |
996,323 | 273804c119046d2e94445d3f3bf7d8595feeb6f3 | import curses
class ScreenSources():
def __init__(self):
# 0 = regular, 1 = monitors, 2 = both
self.active_type = 0
self.typechars = "wer"
self.typenames = [ "Regular", "Monitors", "Both" ]
self.show_data = True
self.wsourcelist = None
self.drawable = F... |
996,324 | c2e637ac3d6c1e372eaee75e90745610a26c0732 | #Este codigo e uma versao do programa de processamento de imagens que utiliza
#como base os algoritmos de Canny, HoughLines e HoughCircles.
#A forma de captura da imagem e atraves da imagem capturada
import cv2
import serial
import time
import numpy as np
import sys
# 3 argumentos sao passados neste codigo
# O primeir... |
996,325 | ac864ac72fed239b902a99b7e11a284dcd4d6738 |
class Account:
def __init__(self, account_id: int, owner_id: int, account_type: str, amount: int):
self.account_id = account_id
self.owner_id = owner_id
self.account_type = account_type
self.amount = amount
def __str__(self):
return f"id: {self.account_id}, owner: {se... |
996,326 | 6e6f6a3101d182684e0a705c24cd24f8b96d0d43 | # coding=utf-8
import sys
import matplotlib.pyplot as plt
from matplotlib.backends.backend_pdf import PdfPages
import utils.analisis as analisis
import utils.file as futils
# Existe relación entre unos determinados fenotipos y la poblacion (o superpoblacion).
# Es decir, hay una proporción
# significativa... |
996,327 | 66c77ee36aec0050cec1747d05bf95bb1f14dc47 | #!encoding:utf-8
__author__ = 'wangfei'
__date__ = '2017/12/23 0023 21:32'
import xadmin
from xadmin import views
from .models import EmailVerifyRecord,Banner
class BaseSetting(object):
enable_themes = True
use_bootswatch = True
class GlobalSetting(object):
site_title = "幕学后台管理系统"
sit... |
996,328 | d19a116346e95c0b7c0c03cac3cc89e73156e7a2 | '''
Created on Oct 23, 2012
'''
import wx
from com.payleap.serviceproviders.transaction.TransactionProcessCreditCard import TransactionProcessCreditCard
from com.payleap.serviceproviders.merchant.MerchantProcessCreditCard import MerchantProcessCreditCard
class TestApplication:
if __name__ == '__main__':
... |
996,329 | 63f115673ab162274300cc72e2aa0afa9fd0bcd0 | import os
import time
import requests
import shortuuid
import urllib.parse
import xml.etree.ElementTree as ET
from .cluster import AugerClusterApi
from .utils.exception import AugerException
from .project_file import AugerProjectFileApi
SUPPORTED_FORMATS = ['.csv', '.arff']
class AugerDataSetApi(AugerProjectFileApi... |
996,330 | f1d2be01a35ea77355603e18b1c7f0dc8b422c6d | import traceback
import logging
logger = logging.getLogger("vaex.events")
class Signal(object):
def __init__(self, name=None):
"""
:type name: str
:return:
"""
self.name = name or repr(self)
self.callbacks = []
self.extra_args = {}
def connect(self, ca... |
996,331 | 7bff5198c76a1c6f0f7c79065881cc2c05d9b326 | # -*- coding:utf-8 -*-
from django.contrib import admin
from models import *
# Register your models here.
class book_infoAdmin(admin.ModelAdmin):
list_display = ('book_category', 'book_name', 'book_auth', 'book_desc', 'book_is_recommend','book_display',)
list_display_links = ('book_category', 'book_name', 'book... |
996,332 | 5178a068b49776e3eb90717844a3863766c90346 | from __future__ import print_function
from math import radians, sin, cos, sqrt, asin
from operator import add
import json
import sys
import datetime
import boto3
from pyspark.sql import SparkSession
import pyspark.sql.functions as PY
from pyspark.sql.types import DoubleType
from config import sql_username
from conf... |
996,333 | 0ac74c8b583b942f0ba299b44c9e47e28b710da7 | # -*- coding: utf-8 -*-
"""
Created on Thu Jul 9 13:16:31 2020
@author: jakem
"""
from monodisperse_box_xform import Monodisperse2
import numpy as np
import matplotlib.pyplot as plt
transform_list = np.arange(1,0,-.05)
transformsize = 1-transform_list
transform_size = []
transform_size.append(transformsize)
# af_... |
996,334 | 27c85ee9f6dfd42c5c3b41f4e9b851bd8c682863 | from setuptools import setup, find_packages
setup(
name='ODEmethods',
version='0.1',
packages=find_packages(exclude=['tests*']),
license='MIT',
description='Python package that includes numerical methods for solving ordinary differential equations (initial value problems).',
long_description=op... |
996,335 | 80edb9365920241ea9748f93077f4ef4ddc66086 | import numpy as np
W = np.random.rand(2, 1) #2X1 행렬
b = np.random.rand(1)
print("W = ", W, ",W.shape = ", W.shape, ", b =", b, ",b.shape", b.shape)
x_data = np.array([[2,4],[4,11],[6,6],[8,5],[10,7],[12,16],[14,8],[16,3],[18,7]]) #9X2
t_data = np.array([0,0,0,0,1,1,1,1,1]).reshape(9,1) #9X1
def sigmoid(x):
retur... |
996,336 | 5c7ac24eff3071fd271147cc68dd5f240eb1607f | #!/usr/bin/env python
#-*- coding: utf-8 -*-
def search(low, high, arr, target):
print(low, high)
mid = (low + high)//2
if (arr[mid]==target):
return mid
if low == high:
return None
if(arr[mid] > target):
return search(low, mid-1, arr, target)
if(arr[mid]< target):
... |
996,337 | 4419dc9ae8db9d97c95724fbe1af0cbdb345356e | import unittest
from unittest import mock
from user import login_user, register_user
from . import mocks
class TestTodoListCreate(unittest.TestCase):
@mock.patch("requests.post", return_value=mocks.MockNoContentResponse)
def test_register_user(self, mock_res):
response = register_user("sample@email.... |
996,338 | f1b737c0642ff3451d5ff41b81ab673e18aebce2 | from django.urls import path
from .views import *
urlpatterns=[
path('create_axes/',create_axes),
path('create_tache/',create_tache),
path('mon_stage/',my_stage),
path('my_progress/',getprogress),
path('my_progress/<int:id>',validate_tache),
path('update_tache/<int:id>',update_tache),
p... |
996,339 | c04062a81d68d87199a965c6070733e57a23c294 | import re
from stringfuzz.scanner import scan
from stringfuzz.ast import *
from stringfuzz.util import join_terms_with
__all__ = [
'parse',
'parse_file',
'parse_tokens',
'ParsingError',
]
# constants
MAX_ERROR_SIZE = 200
UNDERLINE = '-'
MESSAGE_FORMAT = '''Parsing error on line {number}:
{cont... |
996,340 | dd103a2e12054503123045706663314d08d0b956 | #!/usr/bin/python
T=input()
I=0
while T>0:
T-=1
I+=1
n=input()
candy = map(long,raw_input().split())
candy.sort()
sum = 0
s=0
for i in candy:
sum^=i
s+=i
if sum!=0:
print 'Case #%d: NO' % I
else:
print 'Case #%d: %d' % (I,s-candy[0])
|
996,341 | 01dc8f0e5c123cd9018adbb5e43cfb313e3f2f9d | input_first = int(input())
inputs_after_first = []
for i in range(0, input_first):
inputs_after_first.append(int(input()))
total = 0
for number in inputs_after_first:
total += number
print(total)
|
996,342 | cdf4f982d62ee63e3e061eff790b16b55984f08c | a = 5.5
b = 5.5
print(a == b)
print(a is b)
# both the values stored in same address
s1 = "JENI"
s2 = "JENI"
print(s1 == s2)
print(s1 is s2)
#both are pointed in same address
|
996,343 | 442961d2070df1a32b8de898fd5b3caa0166d9c4 | # Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def pathSum(self, root: TreeNode, sum: int) -> List[List[int]]:
def dfs(root, sum, path, ret):
if not root:
... |
996,344 | 0b4d181a82bdfbad71670290444900070c003af8 |
import argparse
parser = argparse.ArgumentParser(description='Train CatDog Model.')
parser.add_argument('modelpath', metavar='PATH', type=str,
help='path to saved h5 model.')
parser.add_argument('imagepath', metavar='PATH', type=str,
help='path to saved image to test.')
from ke... |
996,345 | c9094676d71491d916b51175c368a27754374bc2 | preco = input ( "Informe um preço:" )
posicao = 0
posicao_da_virgula = - 1
enquanto posicao < len ( preco ):
if preco [ posicao ] == ',' :
posicao_da_virgula = posicao
posicao = posicao + 1
se posicao_da_virgula == - 1 :
imprimir ( "O valor redes" , preco , "reais" )
mais :
print ( "O ... |
996,346 | 73f3fde5eefd90c6effb90847be747a0382e47e9 | import unittest
import arff
ARFF = '''%
% DESCRIPTION HERE
%
@RELATION weather
@ATTRIBUTE outlook {sunny, overcast, rainy}
@ATTRIBUTE temperature REAL
@ATTRIBUTE humidity REAL
@ATTRIBUTE windy {TRUE, FALSE}
@ATTRIBUTE play {yes, no}
@DATA
sunny,85.0,85.0,FALSE,no
sunny,80.0,90.0,TRUE,no
overcast,83.0,86.0,FALSE,yes
... |
996,347 | 4d2b8851ff8537fe3d9f8f2002230ce4ba508a7a |
class Input_controller():
def __init__(self, player_conf):
# lee el archivo y setea las configuraciones en el diccionario
dicc = {}
self._set_keys(dicc)
def _set_keys(self, dicc):
pass |
996,348 | d7feb0e978069e70c0a2af34a736a7053b630cae | # Copyright 2017 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 or agreed to in writing, ... |
996,349 | ea76693ca7db37e3052003f3c9b2f11099f81beb | from CoSource import *
from CoGameM import *
# Render Work here, for local player only
class CoRender:
def __init__(self, screen):
# tolerate range for objects displayed in sight
self.tolerateWH = TOLERANCE_RANGE
self.screen = screen
self.screenWH = (screen.get_width(),
... |
996,350 | d45dbcb7e1b1f5d22acf825615e9f9af77e821e7 | import random
import time
from collections import namedtuple
from threading import Thread, Event
from typing import List
import numpy as np
from pyspark import SparkContext
try:
import CoresetKSeg
import ksegment
from stack import Stack
import utils_seg
except ImportError:
from k_segment_coreset i... |
996,351 | ab1ebc1253a1710f3bcbcd9d27caf269f313b48d | KEYWORDS = ['class', 'constructor', 'function', 'method', 'field', 'static', 'var', 'int', 'char', 'boolean', 'void',
'true', 'false', 'null', 'this', 'let', 'do', 'if', 'else', 'while', 'return']
SYMBOLS = ['{', '}', '(', ')', '[', ']', '.', ',', ';', '+', '-', '*', '/', '&', '|', '<', '>', '=', '~']
STRI... |
996,352 | 33547c7589ab8ea929f367015a53fabde4293890 | from collections import Container
from os import sep, access, R_OK
from os.path import join, isfile
from uuid import UUID
from tornado.ioloop import IOLoop
from urpc.ast import Protocol
from urpc.storage.json import JsonStorage
try:
from settings import temp_dir
except ImportError:
temp_dir = join(sep, "tmp"... |
996,353 | 68c9fc9c5944868e5fd0175584f42f41738325db | """
Compute the difference between the 12 UTC 850 hPa temp and afternoon high
"""
import datetime
from calendar import month_abbr
from pyiem.datatypes import temperature
from pyiem.plot.use_agg import plt
from pyiem.util import get_dbconn
def main():
"""Go Main Go."""
ASOS = get_dbconn("asos")
acursor =... |
996,354 | 7f1264e9f40cb9ce3b7f0ffbf7f9478d285db9e0 | import turtle
t = turtle.Pen()
t.reset()
for x in range(1,6):
t.forward(100)
t.left(108)
|
996,355 | 0adc08a3272ee72077aab646dca6169c4b033a05 | from django.shortcuts import render, redirect
from django.contrib.auth import login
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.decorators import login_required
def register(request):
"""view for registration"""
if request.method != 'POST':
# make a new form
... |
996,356 | 09512621dc27741b31dc74ef038021dd92ab6cc5 | import matplotlib as plt
import seaborn as sns
import pandas as pd
import numpy as np
#models=['eucli','cos','manhat']
xyz=[]
models=["manhat"]
for model in models:
#model="manhat"
if(model=="eucli"):
threshold=[0.05,0.11,0.16,0.21,0.27,0.33,0.38,0.44,0.49,0.55]
elif(model=="cos"):
... |
996,357 | 0920a1c1b655e4b526f6c2c7d898bef25b39094e | #coding=utf-8
"""
Ugly number is a number that only have factors 3, 5 and 7.
Design an algorithm to find the Kth ugly number. The first 5 ugly numbers are 3, 5, 7, 9, 15 ...
Example
If K=4, return 9
Challenge
O(K log K) or O(K) time
"""
class Solution:
"""
@param k: The number k.
@return: The kth prime ... |
996,358 | 28f62de57caf13af18b7003865686b5a51e5d760 | """
"""
import json
from time import clock
import bisect
businesses = 'JSON/businesses_many_reviews.json'
reviews = 'JSON/yelp_academic_dataset_review.json'
offset_b, offset_r = 0, 0
business_list = []
t1 = clock()
b_count, r_count = 0, 0
def index(a, x, yes, no):
# Locate the leftmost value exactly equal to... |
996,359 | e20a231e593b77ba63d689d7e88ce8cc3534ec2e | from NodoLS import nodeSimple
from graphviz import Digraph
class Simple_list:
def __init__(self):
self.root = None
self.tam = 0
def addSimple(self, x, y, value, n):
first = nodeSimple(x, y, value)
self.tam = n
if self.root is None:
self.root = first
... |
996,360 | 15a4aa7863d9049b9eb75ae5ceec2b2e3045457e | #R python
import os
#os.chdir("Desktop/python test/")
#os.getcwd()
import scrublet as scr
#import solo as sl
#import doubletdetection
import numpy as np
import tarfile
import matplotlib.pyplot as plt
import pandas as pd
def load_csv(path):
data_read = pd.read_csv(path)
list = data_read.values.tolist()
data... |
996,361 | 5be3916248af2d9bc770a5f2fc00e1632949a3a1 | # -*- coding: utf-8 -*-
# @Time : 2020/12/21 14:35
# @Author : Baron!
import json
import logging
import requests
log = logging.getLogger(name='4399-cdn')
default_push_url = 'https://fapi.gz4399.com/api/portal/v1/push'
default_preheat_url = 'https://fapi.gz4399.com/api/portal/v1/preheat'
def _domain... |
996,362 | ddc30af951b83b317353325631cfdb71c86e0b13 | import matplotlib.pyplot as plt
import numpy as np
fig, ax_f = plt.subplots()
#ax_c = ax_f.twinx()
x = np.linspace(10, 30, 100)
k = 1
ax_f.plot(x, np.cos(k * x))
k2 = 0.5
ax_f.plot(x, np.cos(k2 * x))
ax_f.set_xlim(10, 30)
ax_f.set_title('Задание 4.')
#ax_f.set_ylabel('Fahrenheit')
#ax_c.set_ylabel('Celsius')
plt.s... |
996,363 | 04db6dfa56d09939a6531f8e453619a02b848b82 | from typing import List
import pandas as pd
from solutions.baseline.raifhack_ds.metrics import metrics_stat
from pipeline.transforms import BaseTransform
from pipeline.evaluators import BaseEvaluator
from .base_pipeline import BasePipeline
class FitPreidctPipeline(BasePipeline):
def __init__(self, transforms: Lis... |
996,364 | 865a1d641589d58888ea547fed942c1dec929f6f | import pickle
from enum import Enum
class UVARGPacket(object):
def __init__(self, destination_id: int, source_id: int, next_intersection: int, raw_data: bytes, uav_send_me_to_car_in_section: tuple):
self.raw_data = raw_data
self.source_id = source_id
self.destination_id = destination_id
... |
996,365 | 35d2cc4313f9821a6b820469440149d6c173bb9b | # -*- coding: utf-8 -*-
"""
Created on Fri Jun 4 23:44:10 2021
@author: yrc2
"""
from biorefineries import oilcane as oc
import biosteam as bst
import numpy as np
from biosteam.utils import colors, GG_colors
import matplotlib.pyplot as plt
from biosteam.plots import (
plot_contour_2d,
MetricBar,
plot_vert... |
996,366 | 928865f8f02e10a9945c7343a819fff6d98a817b | BASE_API_URL = 'https://cloud.veriserve.co.jp/api/v2/' #APIのパス
API_KEY = 'XXXX' #APIのキー
FOLDER_PATH = 'XXXX' #対象ファイルを格納するフォルダーのパス
TSV_NAME = '1.0' ... |
996,367 | 55c955403b3b640616d140b3b2b02aa8d856765c | '''https://leetcode.com/problems/minimum-add-to-make-parentheses-valid'''
class Solution:
def minAddToMakeValid(self, S: str) -> int:
cnt = 0
stk = []
for letter in S:
if letter == "(":
stk.append(letter)
else:
if stk:... |
996,368 | 4daed0bbd367fa47b8c37a8a69d369cf3cef6669 | #! /usr/bin/env python3
import rtmidi
import os
import yaml
import argparse
import sys
def get_args():
p = argparse.ArgumentParser(description="Map MIDI input to commands")
p.add_argument("-l", "--list",
action="store_true",
help="prints a list of available MIDI input de... |
996,369 | dc58eeadb793cda5d254f0bf69f0301b0597741f | import time
import pickle
def save_message(file_name, msg, suffix=".prototxt", verbose=True):
start = time.time()
f = open(file_name + suffix, "wb")
f.write(msg.SerializeToString())
f.close()
if verbose:
print("File {} saved.".format(file_name + suffix))
print("Time to save:", time... |
996,370 | 269d5b18f7cf8bd85ce81772b8e5102edf548e1d | #coding:utf-8
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains #引入ActionChains鼠标操作类
from selenium.webdriver.common.keys import Keys #引入keys类操作
import time
import random
import json
chrome_driver_path = './chromedriver'
home_page = 'http://drugs.dxy.cn'
save_file = 'sub_c... |
996,371 | 60ea265a34924407cfe9e988381d0dbbd665b616 | >>> #this is a comment
>>> print("hi")
hi
>>> ##This is a simple comment in Python!
>>> print("With this I will print out some simple text")
|
996,372 | c97c1472b4247aa00da997aa81e38de78701a94c | from django.conf.urls import url
from django.contrib.auth import views as auth_views
from . import views
from django.contrib.auth import views as auth_views
"""
URL patterns used by django to load views.
"""
urlpatterns = [
url(r'^$', views.index, name='home'),
url(r'^shelld/$', views.shelld, name='shelld'),... |
996,373 | 0ee2693b5129061a4ce39ee3f9bff567e92d91f9 |
import zipfile
import re
import os
from os import listdir
from os.path import isfile, join
def __unzip(year, month):
dr = ('/home/ubuntu/sec/' + year + '/' + month + '/')
onlyfiles = [f for f in listdir(dr) if isfile(join(dr, f))]
for f in onlyfiles:
try:
fh = open(dr + f, 'rb')
... |
996,374 | 752c2a3295e4051b3d01ffdc9d7e37a18ded3a90 | #!/usr/bin/env python
import numpy as np
from structures import Data
def main():
measured_data = Data()
print measured_data
a = 1.0
b = 2.0
c = 3.0
measured_data.append_data(a, b, c)
print measured_data
if __name__ == '__main__':
main()
|
996,375 | 819ebdeae8c47ca1569a8b04367e201bd9b28a90 | import os
import re
root = "/home/yuguess/ProcessFile/15min"
pattern =r"(.*)\.(DCE|CZC|SHF)"
def doFunc(path, fileName):
fullFile = path + "/" + fileName
print "remove ", fullFile
os.remove(fullFile)
#######################################
regex = re.compile(pattern)
for (path, dirs, files) in os.walk(root):... |
996,376 | 5774ebe788a0ed0b6d521fa13ada3fa660ed77be | #! /usr/bin/env python3
import numpy as np
import json
import os
import pathlib
import sys
# check that the PLAID dataset already exists
if not (os.path.exists("PLAID/") and os.path.isdir("PLAID/")):
print("PLAID not downloaded yet. Run `plaid_serializer.py`")
sys.exit()
if not (os.path.exists("numpy_arrays/")... |
996,377 | 9dadc553bcd52ef888e7eed4e6289f30671bebbd | # encoding: utf-8
import logging
import textwrap
import threading
from datetime import datetime
import npyscreen
from DictObject import DictObject
from npyscreen import Textfield
from npyscreen import wgwidget as widget
from pytg import Telegram
from pytg.exceptions import NoResponse
from pytg.utils import coroutine
... |
996,378 | cfad506281de54a2a7123ad66d75171d53d925ac | #!/usr/local/bin/python
import math
from os import listdir
from os.path import isfile, join, realpath
import mmap
import sys
class WriteMapOfNames():
def __init__(self, imagepath):
self.imagepath = imagepath
self.images_aside_dir = []
self.images_cside_dir = []
self.images_aside = []
self.images_cside = []
... |
996,379 | b53857a665f9a14f6d46c32312b7f8dfbdd0cd51 | # Generated by Django 2.1.2 on 2018-12-10 10:39
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("aids", "0049_auto_20181115_1606"),
]
operations = [
migrations.AddField(
model_name="aid",
name="is_imported",
... |
996,380 | 736b674c67b2620845910652d085ad1290a41560 | '''i
Plot fss_ensemble scores for RRA domain for different forecast initializations.
'''
import os
import sys
sys.path.insert(0, '..')
from common import util as utcom
import util as ut
import util_plot as utplot
import time
import numpy as np
import matplotlib.pyplot as plt
from cycler import cycler
def plt_env(fig, ... |
996,381 | cba61a3c7331342ee69cce11d34d76afb76bab94 | #! /usr/bin/env python
# -*- coding:utf-8 -*-
import rospy
import numpy as np
import tf
from matplotlib import pyplot as plt
import math
import cv2
import time
from geometry_msgs.msg import Twist, Vector3, Pose
from nav_msgs.msg import Odometry
from sensor_msgs.msg import Image, CompressedImage
from cv_bridge import C... |
996,382 | bfd11a7cdb4579e43f980e4e08f2df84a1d4e850 | import base64
import hmac
from functools import wraps
from hashlib import sha256
from os import getenv
from urllib.parse import urljoin
import httpx
from sanic import Sanic
from sanic.response import json
from sanic_prometheus import monitor
from sentry_sdk import init as sentry_init
from sentry_sdk.integrations.sanic... |
996,383 | f09bbff2db06b3bfcbda8b8052f6f0995f1b7c2e | # _*_coding:utf-8 _*_
# @Time :2018/12/31 16:39
# @Author :sunny
# @Email :602992114@qq.com
# function :数据库操作封装类
"""
1:连接数据库
2:辨析额一个SQL
3:建立游标
4:执行
"""
import pymysql
from api_test_sunny.common.config import ConfigLoader
class MySqlUtil:
def __init__(self):
config=ConfigLoader()
host=c... |
996,384 | e5fbaeb3a0bf256800ee52f127d01415762df9f8 | """
Signal-Noise_GTC_comparisons.py
Author: Benjamin Floyd
Creates corner plots comparing chains, mostly within a trial but some between.
"""
import re
import emcee
import h5py
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.ticker import AutoMinorLocator
import pygtc
def keyfunct(n):
return... |
996,385 | b8415fda041c842d0f5cd0eed8095abec7c91d7f | #Lab_4 Task 3
#AMM-2 Bilan Halyna
from math import*
print('Вивчаємо механізм використання циклу while')
print('Обчислюємо квадратний корінь за ітераційною формулою Герона')
print("Задаємо число, чий корінь квадратний маємо відшукати ")
a=float(input('a='))
print("Задаємо початкове значення ")
x=float(input('x='... |
996,386 | 7da6cbc32b24b023e51452e0cf131e888fec33cb | #coding: utf-8
import re
from collections import Counter
def readlinesFile(filename):
f = open(filename)
lines = f.readlines()
f.close()
return lines
def getSentenseMorphMapList(filename, get_morph_keys):
lines = readlinesFile(filename)
sentense_morph_map_list = list()
morph_map_list =... |
996,387 | 44e6975c078a4a4f4926a01912d5a521ba82f076 | """Samplers manage the client-side trace sampling
Any `sampled = False` trace won't be written, and can be ignored by the instrumentation.
"""
import abc
import json
from typing import Any
from typing import Dict
from typing import List
from typing import Optional
from typing import TYPE_CHECKING
from typing import Tu... |
996,388 | 24ea9e87ab26e28c0fdf89bc1702a27f941a3c42 | from rest_framework import serializers
from . import models
class Category(serializers.HyperlinkedModelSerializer):
class Meta:
model = models.Category
fields = ('pk', 'name', 'parent', 'children', 'hidden', 'foo', 'adverts')
class Advert(serializers.HyperlinkedModelSerializer):
class Meta:
model = ... |
996,389 | 028fcb53228d89d5efe7d19689a831f5739dc267 | # Script to build mysql table
import config
import MySQLdb
from sql_table import mysql_table
'''
Create_table.py looks for MySQL Config in config.py
Creates a connection to the database using the supplied config
Creates a TABLE named WEB_URL with the specified rows.
Needs to RUN once when setting up the application... |
996,390 | 01485caf0f2e14904f14d937e3111dd4f89179a7 | from django.shortcuts import render
from django.contrib.auth.decorators import login_required
from django.utils.decorators import method_decorator
from django.conf import settings
from django.views import View
from django.http import JsonResponse
from general.models import ExecuteModel
from .models import Visi... |
996,391 | e442193b8cba96bcef010e8aaa9d6fa212b149bd | import random
def magic_slow(array):
'''
Get magic index (slow)
Args: list<int> array: target sorted array
Returns: int: magic index, -1 if not exists
'''
for i in range(len(array)):
if array[i] == i:
return i
return -1
def magic_fast(array, start, end):
if end < st... |
996,392 | 68efdfccc722109a932768b70a06837dad56d4a6 | #
# PySNMP MIB module NETFINITYMANAGER-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/NETFINITYMANAGER-MIB
# Produced by pysmi-0.3.4 at Wed May 1 14:18:46 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (defau... |
996,393 | 96bce50c991ea80034c34254af4790fa4e8dfcb7 | # -*- encoding: utf-8 -*-
from datetime import date
from datetime import datetime
from datetime import time
from django.db import models
from django.contrib.auth.models import User
from django.utils.translation import ugettext as _
from django.conf import settings
from django.db.models import Q
from math import floor
... |
996,394 | dfda624c4e1f2fa5b38d06e635cc9947103d097e | from fst import EPSILON
simulation_number = 1
configurations_dict = \
{
"MUTATE_RULE_SET": 1,
"MUTATE_HMM": 1,
"EVOLVE_RULES": True,
"EVOLVE_HMM": True,
"COMBINE_EMISSIONS": 0,
"MERGE_EMISSIONS": 0,
"ADVANCE_EMISSION": 1,
"CLONE_STATE": 0,
"... |
996,395 | b1edd144800da58447071b43433c80ada6003384 | # Code to transform simulation results into a format that can be read by gnuplot
# As well as to do calculations for average f-score
# Run for instance as:
# python read_simulation_results.py --project=data.example_project --category=B-speculation --xspace=0.05 --xaxisstep=200 --maxy=0.8
import argparse
import os
impo... |
996,396 | fb9e734f06818bb69b4c00ef35f49d0d0779f794 | from django.views.generic import ListView, DetailView
from django.shortcuts import render, get_object_or_404
from django.views.generic.edit import CreateView, UpdateView
from django.urls import reverse, reverse_lazy
from .models import Product
from django.contrib.auth.decorators import login_required
from django.utils.... |
996,397 | ad7d8a9fe5a76e161917aa439b0a11a4e3252497 | # -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# 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... |
996,398 | 0c42bc1778e541e18bbce319ebc90dbdcf7e2004 |
from .._core import Automaton, NoTransition
from unittest import TestCase
class CoreTests(TestCase):
"""
Tests for Automat's (currently private, implementation detail) core.
"""
def test_NoTransition(self):
"""
A L{NoTransition} exception describes the state and input symbol
... |
996,399 | 93b0b2713f04b1d4904960ef7b372208a593609f | import pygame
import sys
# 初始化Pygame
pygame.init()
size = width, height = 600, 400
# 创建指定大小的窗口 Surface
screen = pygame.display.set_mode(size)
# 设置窗口标题
pygame.display.set_caption("冯小雨")
bg = (0,0,0)
font = pygame.font.Font(None,20)#设置字体
line_height = font.get_linesize() #设置高度
position = 0#让 位置为0
screen.fill(bg)
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.