index
int64
0
1,000k
blob_id
stringlengths
40
40
code
stringlengths
7
10.4M
987,600
c820215de8b2c21c27f4ad742ac1c19d68b5a0c6
import re import regexs def infoget(str1,re_dict): substr=str1[24:31] if substr != 'LOG_EMS': return 'q' idx=findn(']',str1,2) if idx>=0: nextidx=idx+1 if nextidx<len(str1) and str1[nextidx] in mes_type: if str1[nextidx] == '=': if (nextidx+2)<len(str1) and str1[nextidx+2] == 'E': return get_ems(r...
987,601
c67b98c5ce4e6550b1d41a147020ac1cecbba7b4
from django.db import models from django.conf import settings from django.utils import timezone from django.db.models import Q User = settings.AUTH_USER_MODEL class BlogPostQuerySet(models.QuerySet): def published(self): now = timezone.now() # get query set means data object like BlogPost.objects.all() ...
987,602
d8308bd495f2ef21bdab9c435bcfcda428c6e4a3
import pickle import h5py import numpy as np from time import time T = int(1e7) S = 10 D = 25 #array = np.random.rand(T, S, D) class Solutions: @classmethod def from_h5(cls, f_name): soln = cls() soln.h5 =h5py.File(f_name, 'a') return soln def __init__(self, a=None): if a ...
987,603
357ac4153fb2e0638e85a3c851c9855d34ef3813
# importing the required module import matplotlib.pyplot as plt import numpy as np import math def f(x, n): y = math.pi; for k in range(1, n+1): y = y + math.sin(k*x)*(-2/k) return y #Array of the values of N i want to plot: N = [1,2,5,10,100] i = 1; for n in N: # x axis values ...
987,604
1ffc3dda86be6e9de28906b8aefa79277df69b92
from app.app import * from validate_email import validate_email def validate_user_registration(json): if not(json["first_name"].strip()): return jsonify({'Message': 'First name is required'}), 401 if not(json["last_name"].strip()): return jsonify({'Message': ...
987,605
a9b516c459e3e5be445e68b1c43f39d7911017cb
""" 首先,创建TensorFlow图, 然后,选择需要进行汇总(summary)操作的节点。 然后,在运行之前,合并所有的summary操作。 最后,运行汇总的节点,并将运行结果写入到事件文件中。 """ import os import numpy as np import tensorflow as tf from mlp import Net, Data, Tools class Summary(object): def __init__(self, data, model_path="model", summary_path="summary"): self.data = data ...
987,606
7a2aba899e6094ea142230d7cc282cbac7285dd9
import logging import os from collections import defaultdict from copy import deepcopy from dataclasses import dataclass, field from typing import Literal, Optional, List, Dict, Any, DefaultDict import torch from mila.factories import AbstractConfiguration from .helpers import SuperFactory from .observers import Abst...
987,607
1f6db4fedb05db30a0a4435a0137d4dd43f6a058
Temp_levels = ['VC', 'C', 'W', 'H', 'VH'] # very cold,cold,warm,hot,very hot Humidity_levels = ['VD', 'D', 'N', 'W', 'VW']# very dry,dry,normal,wet,very wet Power_Levels = ['VL', 'L', 'N', 'H', 'VH']#very low,low,normal,high,very high def fuzzify_temperature(value): if value < 8.0: return 'VC' elif va...
987,608
7230c394c9f8aba903e78a9436af6d229b1aa092
import cv2 as cv import numpy as np class ASF: """ This class implement the alternate sequential filtering. """ def __init__(self, img): self.img = img self.kernel = np.ones((5, 5), np.uint8) self.scroll = 10 # 10 pixel scrolling def opening(self, img): """ ...
987,609
23060450b5d92be0b23dd1a3977fbf04663bab0f
# -*- coding:utf-8 -*- import os import imghdr import cv2 from sys import argv #本脚本目的是为了将图片的类型分为训练集和验证集合 #将图片对应的种类写入到txt文件中以适应caffe #同时建立种类对照表 #本脚本接受两个个参数path和direction #path:为目标文件目录 #direction:为图片储存路径 path = argv[1] direction = argv[2] if os.path.isdir(path): list = os.listdir(path) #树叶的种类 num = 0 for...
987,610
c9b3894445d1053b722be96feb9a1be55f0fc306
''' Created on Jun 7, 2011 @author: rp2007 ''' #from Mother import * import pylab as P #@UnusedImport import numpy as N #@UnusedImport from matplotlib.colors import LinearSegmentedColormap import matplotlib.colors as cols import matplotlib.gridspec as gridspec import random as R from mpl_toolkits.mplot3d import Axes3D...
987,611
31761a239697c2b5bc743ef6b6006d40e69f2f08
""" server """ import socket import select class TcpServer(object): """Tcp Server""" def __init__(self, port=8000): self.port = port self.queue_size = 1000 def start(self, port=8000): """server start""" self.port = port try: self.server_run() ...
987,612
19acf12aab96f4868e71d37dd70f0d9c9b15e43d
adj = ["crispy", "delicious" , "beautiful", "fresh" , "tender"] food = ["salmon", "tuna" , "cod","macrkrel", "flounder" ] for x in adj: for y in food: print (x,y)
987,613
0c11d1af8d5546ed1cf3e9844c9b8641d08bc44e
Import libraries for simulation import tensorflow as tf import numpy as np import matplotlib.pyplot as plt #MANDELBROT SET Y, X = np.mgrid[-1.3:1.3:0.005, -2:1:0.005] #JULIA SET #Y, X = np.mgrid[-2:2:0.005, -2:2:0.005] #Definiamo il punto corrente Z = X+1j*Y c = tf.constant(Z.astype("complex64")) zs = tf....
987,614
a1ea85c2cfd1b2f10c56247db23ce971cac99667
# 1) Loading Bar # 2) Loading Screen import os import time def loading_bar(seconds): for loading in range(0, seconds+1): percent = (loading * 100) // seconds print("\n") print("Loading...") print("<" + ("-" * loading) + ("" * (seconds + loading)) + ">" + str(percent) ...
987,615
e57739be00d1809eb5dff1f34c78f0f689361fb8
import numpy as np import scipy from scipy import stats import math import copy import random import matplotlib.pyplot as plt def norm_ang(angle): return (angle + np.pi) % (2 * np.pi) - np.pi class Robot: def __init__(self,pos=None): if pos==None: self.x = 0 self.y = 0 ...
987,616
a44063e4ad50c184acf46aa63469fc3b5630f970
from django.apps import AppConfig class SwzcConfig(AppConfig): name = 'swzc'
987,617
7d8bd3fa78c0b998fcb9cf7abf4f797f1702d957
class NMEAMessageBadFormatError(Exception): """Exception raised for NMEA message pattern ignored parameters: nmea_message: nmea message which caused the error message: explanation of the error """ def __init__(self, nmea_message, message=''): self.message = message if message e...
987,618
00ba6de97a4681bf9a4d4a95a286d3f80954f1d5
#https://www.hackerrank.com/challenges/luck-balance/problem def luckBalance(k, contests): min_win = 0 res_imp = [] res_not_imp = [] for i in range(len(contests)): if contests[i][1] == 1: res_imp.append(contests[i][0]) else: res_not_imp.append(contests[i][0]) ...
987,619
e431ed81f60715fe4c36265f60fdc8aab4e03b5c
import os import os.path as osp import logging import cv2 import numpy as np from ..base import App from ..base import Keyboard as kb from ..gui.container import check_ready from ..gui.media import MediaType from ..utils.transform import convert_bbox_coordinate from ..utils.visualize import draw_bbox logger = loggi...
987,620
fcb6d941dea398e8e09ada883c8114dfb2e40eee
from aut.app import ExtractPopularImages, SaveBytes, WriteGEXF, WriteGraphML from aut.common import WebArchive from aut.udfs import ( compute_image_size, compute_md5, compute_sha1, detect_language, detect_mime_type_tika, extract_boilerplate, extract_date, extract_domain, extract_imag...
987,621
99ce36e89c7d1493602de45a7c8b532474a79c6e
#!/usr/bin/env python # -*- coding: utf-8 -*- import os def download_enron_dataset(): """ Downloads Enron dataset. """ script_path = os.path.join("spampy", "dataset_downloader.sh") os.system(script_path)
987,622
2429b5ef1b4061dab51ca119b0755757665db73b
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Dec 4 17:38:18 2017 @author: Muriel """ target=0 comput=0 small=6 medium=9 large=20 def nuggetnumber(target): for x in range(0,target): for y in range(0,target): for z in range(0,target): if target==(small* x+ m...
987,623
3c64b2506ac3d1fc3d00927aab8096a946550321
import argparse from selecting.selecting import select_config if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument('-t', '--time', action='store', dest='max_time', help='The maximum time expected to run the application, united by second') parser.add_argu...
987,624
1304024af8cef938feba05e9b398115ea4d95e1e
import numpy as np import matplotlib.pyplot as plt def wave_package_position(x, x0, p0, d, hbar_prim): prefactor = np.sqrt(np.sqrt(np.pi)*d) envelope = np.exp(-(x - x0)**2/(2*d**2)) plane_wave = np.exp(1j*p0*(x - x0)/hbar_prim) return (1/prefactor)*envelope*plane_wave def propagate(phi_x, p_prop,...
987,625
1a93e77f564b0ff5fd33f93570de940c0eb3440f
import logging logging.disable(logging.CRITICAL) from tabulate import tabulate from mjrl.utils.make_train_plots import make_train_plots from mjrl.utils.gym_env import GymEnv from mjrl.samplers.core import sample_paths import numpy as np import pickle import time as timer import os import copy def train_agent(job_name...
987,626
0dc5ae3d322d33f5c36ac8c919edbdb45503ecd1
""" 此脚本用来造数据,由于前端可视化部分需要大量数据,手动输入费时又费力,固然写此脚本。 """ import random import time from sign import mongo name=[] area_key=[] area_value=[] type_list_key=[] type_list_value=[] date=[] season=[] make=[] no=[] ##############################生成随机姓名############################################################# name_list="赵 钱 孙 李...
987,627
8084984d89e6fdc0119122cb2fc3ef14b46d64e2
class Product: def __init__(self, name, price, workload, expiration_date): self.name = name self.price = price self.workload = workload self.expiration_date = expiration_date def get_price(self): """ Returns the price of the product. PRE: None. PO...
987,628
3295cdabefb7a04cee511e8326a7d3d7f748eee2
#!/usr/bin/env python3 """ Version history: ================ ------------------------------------------------- 30.7.2014 | 0.1 | initial version 02.12.2014 | 0.2 | converted for python 3.x 16.04.2019 | 0.3 | OpenAPI v2 target urls ...
987,629
6df788eec02aa85a5cf4a2113c57aa863c8bd769
''' Welcome to the ALAF program. An awesome program for awesome friends. ''' import json friends_file = "alaf.json" def welcome(): print("Welcome to ALAF!") def load_friends(): try: with open(friends_file) as f: friends = json.load(f) # create an empty list if the file is not there ...
987,630
a76b3e7fb12d6081331bf29f1040d6ea6e9b8c54
str1=input("enter string") num=0 alph=0 for char in str1: if char in("0123456789"): num+=1 if char in("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"): alph+=1 print("number of alphabets: {} \n number of numbers: {}".format(alph,num))
987,631
617c026cd10698727c76fc5db4e3674c6924710f
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'ui/main.ui' # # Created by: PyQt5 UI code generator 5.6 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow....
987,632
6313175f119104f7ef7c3994ff802e9a590cca5e
from __future__ import annotations import importlib from typing import Union import math from config import PRIORITY_VALUES, DEFAULT_PATHS from data import DataRequirement from duration import Duration from failure import Failure from resource import ResourceRequirement DATA_MODULE = importlib.import_module(DEFAULT_PA...
987,633
37dfc77abec7de1942e6f3eb0144c4a6e44e5bd2
import sys file = open("list of teams.txt","w") MyTeams = ['76ers', 'Cleveland', 'Celtics', 'Spurs', 'Lakers'] for n in range(0, len(MyTeams)): team = MyTeams[n] + "\n" file.write(team) file.close()
987,634
1bb273c819ce17191e7abf9dfabc2e0e6fac3a70
import time from os import system,name class Validacion: @staticmethod def limpiar_pantalla(): if name == "nt": system("cls") else: system("clear") @staticmethod def entero (numero): try: numero = int(numero) if numero in...
987,635
39da9aedbf275c6ff9a7806a51d62167660c0e2d
from .base import * DEBUG = False ADMINS = ( ('Aman Srivastava', 'amanprodigy@gmail.com'), ) ALLOWED_HOSTS = ['.edureka.com'] DATABASES['default'] = { 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': 'edureka', 'USER': 'django', 'PASSWORD': 'django', 'HOST': 'localhost', 'PORT...
987,636
c2f740fa2c96b4d336e612a675a40deb698d9132
# 38. Write a Python program to check three given integers and return true if one of them is 20 or more less than one of the others.

987,637
ec74ec9c6ef932da8cea1680538125a158cfce6e
# Complete the checkMagazine function below. def checkMagazine(magazine, note): countM = Counter(magazine) countN = Counter(note) for key, value in countN.items(): c = countM.get(key, 0) if c < value: print("No") return print("Yes")
987,638
1589e2d4f004e1b257b52fd263649e6526fba97f
# def # 함수내에서 i, mylist 값 변경 def f(i, mylist): i = i + 1 mylist.append(0) k = 10 m = [1,2,3] f(k, m) print(k, m) # 출력: 10 [1, 2, 3, 0] # default Parameter def calc(i, j, factor = 1): return i * j * factor result = calc(10, 20) print(result) # Named Parameter def repo...
987,639
3123b3c16e794124335bd0746c70df2bae291a38
#-*-coding:utf-8-*- import random import requests import ssl from requests.auth import HTTPBasicAuth import configparser import time import traceback import re import json import codecs cp=configparser.ConfigParser() with codecs.open('F:/test/btex.ini', 'r', encoding='utf-8') as f: cp.readfp(f) #交易对 trade_pair = '...
987,640
3b251acd8414500013e6cf53f77dce18de140321
import os import json import flaskr import unittest import tempfile class FlaskrTestCase(unittest.TestCase): def setUp(self): self.db_fd, flaskr.app.config['DATABASE'] = tempfile.mkstemp() flaskr.app.config['TESTING'] = True self.app = flaskr.app.test_client() # with flaskr.app.app...
987,641
e1db117c6fa892f3be746ca30006e2ae9628ec33
import smtplib from email.mime.text import MIMEText class EmailManager: def __init__(self): return def send_email_to_single_address_localhost(self, to_addr, from_addr, subject, textfile): fp = open(textfile, 'rb') msg = MIMEText(fp.read()) fp.close() msg['Subject'] = ...
987,642
2bfdf5f05d657a916d3b89394a6bdd2003099665
# programa que jogue jokenpô import random opcao = int(input('''Escolha: --- 1. Pedra --- 2. Papel --- 3. Tesoura --->''')) sorteio = int(random.randrange(1, 3)) if opcao == 1: escolha = 'Pedra' elif opcao == 2: escolha = 'Papel' elif opcao == 3: escolha = 'Tesoura' if sorteio == 1: escolha2 = 'Ped...
987,643
e570bdc040b203fe014ae13eeb4dbaecc1880370
import sys import re import numpy as np import matplotlib.pyplot as plt from scipy.optimize import curve_fit # 0->pythonFile 1->folderPath 2->title 3->yLabel 4->labels 5->data 6->NameRegex numArgs = len(sys.argv) if numArgs != 7: print("numArgs Error!") sys.exit(10) # numArgs folderPath = sys.argv[1] titl = ...
987,644
a726d56f538a77940314106401517aa6d1397e0d
import string class Convert: def __init__(self): self.chars = string.digits + string.ascii_uppercase self.chars_len = len(self.chars) def print(self): print(self.chars) print(self.chars_len) def num2dec(self, num): num = str(num) num_len = len(num) ...
987,645
5a3921ada0a0db38178dbadfb4bc55aa09e84e53
# -*- coding: UTF-8 -*- # Copyright (c) 2019 The ungoogled-chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """ Archive extraction utilities """ import os import shutil import subprocess import tarfile from pathlib import Path...
987,646
c96039743074505be8315faaf5bc15c79b60c345
import numpy as np import tensorflow as tf from tensorflow.keras import layers import os import random from watermark import watermarking, gaussian_noise from evaluate import * SEED=1011 def set_seeds(seed=SEED): os.environ['PYTHONHASHSEED'] = str(seed) random.seed(seed) tf.random.set_seed(seed) np....
987,647
55d1e962356403a1361a2fd8fcea05cb7bfa38e7
#data generator using mask rcnn #it goes frame by frame and creates single picture for frame containing combined pisctures of the same category objects #works best with 15 fps mp4 videos import tensorflow as tf import numpy as np from cv2 import cv2 import os #paths MODEL_NAME = 'mask_rcnn_inception_v2_coco' PATH_TO...
987,648
e3d51a74bcc4000d9267476ca6ebf2975a9ff657
''' Select only the columns we want for the rest of the process. Incoming dataframe has Country, Program, Customer and Driver: - Drop the Country, Program, Customer and Driver columns - Reorder to: UUID, Month, Amount''' __author__ = "The Hackett Group" import pandas as pd cols = ["UUID", "Month", "Amount"] def p...
987,649
4618ea7fa3d9f60452093ec30eb9951d85a0b8fd
boodschappen = {"brood":2, "water":1, "sap":3} prijs = 0 while prijs < 100: product = input("welk product wil je kopen?") if (product == 'm'): print("Totaal:", prijs, "euro") main() #main() if product in boodschappen: prijs += boodschappen[product]
987,650
422594bd87fd33beddba78b7f98437325974a553
from urllib.request import urlopen from bs4 import BeautifulSoup url="https://movie.naver.com/movie/running/current.nhn" page=urlopen(url) soup=BeautifulSoup(page, 'lxml') print(soup.title) #%% ul_one = soup.find('ul', class_='lst_detail_t1') print(ul_one.text) #%% a_all=ul_one.find_all('a') print(a_all) #%% # dt, ...
987,651
6890ca88fe7ee7c33b3fd3064db245472f84c13d
import gpytorch import torch class ConstantKernel(gpytorch.kernels.Kernel): """ Gives a covariance of one for all inputs. Should be combined with a scale kernel. """ def __init__(self, **kwargs): super(ConstantKernel, self).__init__(has_lengthscale=False, **kwargs) def forward(self, x1, x...
987,652
3112c1b770d57e3a2e442521318289a08ffddb25
from app import create_app,db from flask_script import Manager,Server from app.models import User,Posts,Comments from flask_migrate import Migrate,MigrateCommand app=create_app('development') manager=Manager(app) manager.add_command('server',Server) migrate = Migrate(app,db) manager.add_command('db',MigrateCommand...
987,653
158347663ce3df0de6e873b255c19ec7c2d38ef3
import nltk from nltk.corpus import sentiwordnet as swn import gensim # word2vec import numpy import re from os import path, remove, chdir import subprocess import parameters import prepare_data import svm stopwords = nltk.corpus.stopwords.words('english') stopwords.extend(['#', ',', '+']) 'Use this class for featur...
987,654
64a3ccd0be2ab778959117e8aa300371db31303a
''' 假如如下数据对应数据库里面的目录结构记录 1. 假如添加的顺序是无序的,只根据id来进行索引 { "data": [ { "id": 1, "parent_id": null }, { "id": 2, "parent_id": 1 }, { "id": 3, "parent_id": null }, { "id": 4, ...
987,655
e8958a00cf693318a6024686e5e31519862e8687
import os import sys path = os.getcwd().rsplit('/', 1)[0] sys.path.append(path) os.environ['DJANGO_SETTINGS_MODULE'] = 'sismocaracas.settings' import django.core.handlers.wsgi application = django.core.handlers.wsgi.WSGIHandler()
987,656
3b0ea7382f19cf1978254d1b2eb5bb30c2f918d6
from .module import RL __all__ = ['RL']
987,657
fd960d2cb51da0a1466459400455fc73e97e3022
#!/usr/bin/env python # https://leetcode.com/problems/median-of-two-sorted-arrays/#/description # There are two sorted arrays nums1 and nums2 of size m and n respectively. # Find the median of the two sorted arrays. The overall run time # complexity should be O(log (m+n)). from __future__ import division import un...
987,658
48e647cf8b4dca94a8e676c80e1697c34d37b453
n = int(input()) while n > 0: n -= 1 size = int(input()) deck = [] for i in range(size, 0, -1): deck.insert(0, i) for j in range(0, i): deck.insert(0, deck.pop()) out = '' for i in deck: out += '{} '.format(i) print(out)
987,659
c8868aebf66d708319e618c5543ecbd3161a705d
import tensorflow as tf import numpy as np print(f'\nTensorFlow version: {tf.VERSION}') print(f'Keras version: {tf.keras.__version__}\n') # 28x28 images of hand written digits 0-9 digits = tf.keras.datasets.mnist # Unpack the data (x_train, y_train), (x_test, y_test) = digits.load_data() # Scale data: Normalization(...
987,660
592c84f59c9d1c06d9343e33ddc1a118be8dd0b4
import numpy as np import matplotlib.pyplot as plt import biotite.sequence as seq import biotite.sequence.io.fasta as fasta import biotite.sequence.io.genbank as gb import biotite.sequence.graphics as graphics import biotite.application.clustalo as clustalo import biotite.database.entrez as entrez # Search for protein ...
987,661
1c1431ddce848fa84a502598e189ef01490249a2
a= 10 out = isinstance(a,int) print("is a an integer",out) out = isinstance price = 1.5 print(isinstance(price,int)) print(isinstance(price,float)) print(isinstance(price,str))
987,662
7a474543f00f90262b23b932128e7fb7e6c0231e
'''this module contains the base functions that will be used by the GUI and CLI''' import csv from datetime import datetime csv_layout = ['card_num', 'name','under_13', 'under_18', 'under_60', 'over_59', 'zip', 'last_used_date', 'all_used_dates'] date_today = datetime.now() def check_date(date_str): ...
987,663
4cd2da38a6217cc747a98b26476b23bf1e09c242
from ad_api.base import Client, sp_endpoint, fill_query_params, ApiResponse class Keywords(Client): """ Use the Amazon Advertising API for Sponsored Brands for campaign, ad group, keyword, negative keyword, drafts, Stores, landing pages, and Brands management operations. For more information about Sponsored Br...
987,664
d35555ba857c4023a955c9c60f409e7f2b42b185
from app import db from .BaseModels import BaseModel # 分类表 class Category(BaseModel, db.Model): __tablename__ = 'category' id = db.Column(db.Integer, primary_key=True, unique=True) name = db.Column(db.String(50), nullable=False, default='') weight = db.Column(db.Integer, nullable=False, default=0) ...
987,665
2a437e388b004536059506387de4e707d4fdca49
t = int(input()) while(t): k,d0,d1=list(map(int,input().split())) s=d0+d1 c=(2*s)+(4*s)+(8*s)+(6*s) if (k==2): tot = s else: no_cycles = (k-3)//4 left_over = (k-3)-(no_cycles*4) tot = (2*s) + (no_cycles*c) p=2 for i in range(left_over): ...
987,666
f3ad37ef19f613b933a294271c25163994f1f143
from django.shortcuts import render from django.http import HttpResponse, HttpResponseRedirect from django.core.urlresolvers import reverse import numpy as np import calc from .forms import InputForm, OptionalForm def index(request): #return HttpResponse(reverse('health: index')) return render(request, 'health/inde...
987,667
1b314d80e14c70a8f606db2caeac92bdf843ed71
#!/usr/bin/env python3 from termcolor import colored import argparse parser = argparse.ArgumentParser() parser.add_argument('--verbose', '-v', help="Verbose mode", action = 'store_true') args = parser.parse_args() init_data = [3,225,1,225,6,6,1100,1,238,225,104,0,1101,90,60,224,1001,224,-150,224,4,224,1002,223,8,223...
987,668
2b76f0e500bdba765c121ab8b26aef640ee51753
## ## # File auto-generated by PythonFileGenerator __all__ = [ 'ClusterActivationNotification', 'SiteActivationNotification' ] from .ClusterActivationNotification import ClusterActivationNotification from .SiteActivationNotification import SiteActivationNotification
987,669
576ce3a8caf9b7acf67e6830fbfc5d607304517c
# unix_send.py from socket import * # 确保两边使用同一个套接字文件 sock_file = "./sock" # 创建本地套接字 sockfd = socket(AF_UNIX,SOCK_STREAM) sockfd.connect(sock_file) while 1: msg = input(">>") if not msg: break # 消息收发 data = sockfd.send(msg.encode()) sockfd.close()
987,670
32a7a9cc24474ce9ffaa4509850f6e807a814959
from django.db import models from django.forms import ModelForm class TestPlan(models.Model): name = models.CharField(max_length=30) product = models.CharField(max_length=30) product_version = models.CharField(max_length=10) created = models.DateTimeField(null=True, blank=True) author = models.Char...
987,671
2250d2828c3551fb126464521341788bdd010ce3
version https://git-lfs.github.com/spec/v1 oid sha256:4d6b1283403d967ea5eddd71a913da66cd2cfd1d0e6fa41ed765dd1ab56b8e44 size 10905
987,672
fdcd908c39fad645dc2a2b65b46e23cb23437c54
#POR FIN NOJODASSSSS!!!! import sys, re from PyQt5.QtWidgets import QApplication, QDialog, QMessageBox from PyQt5 import uic class Dialogo(QDialog): def __init__(self): QDialog.__init__(self) uic.loadUi("Practica4.ui", self) self.NombreA.textChanged.connect(self.Validar_nombre) self.ApellidoA....
987,673
0cb711ea7e1028116b9cf8cb764c286b16c15828
import os from sklearn.datasets.base import Bunch from yellowbrick.download import download_all ## The path to the test data sets FIXTURES = os.path.join(os.getcwd(), "data") ## Dataset loading mechanisms datasets = { "hobbies": os.path.join(FIXTURES, "hobbies") } def load_data(name, download=True): """ ...
987,674
33be30404b9cdc5f7c16e3c4d46f74d270f26401
#coding=utf-8 import json import requests from bs4 import BeautifulSoup #请求地址 targetUrl = "https://www.baidu.com/s?wd=13127965029&tn=json" #代理服务器 proxyHost = '121.46.234.76' proxyPort = "717" proxyMeta = "http://%(host)s:%(port)s" % { "host" : proxyHost, "port" : proxyPort, } proxies = { "http" : prox...
987,675
24ce2f79936d71f75b239d1d3657fe2bd310a707
class Person: def __init__(self,name,age): #constructor self.name=name self.age=age def talk(self): #self is very imp. print(f"Hello! My name is {name} and I am {age} years old :)") name=input("Enter name: ") age=input(f"Enter {name}'s age: ") obj_person=Per...
987,676
b35f64a1af9745dba3ca2cc7597430db936e9cbe
""" Usage: class MixinClass(register_on_init.Logged): @register.before('__init__') def method1(self) -> None: ... @register.before('__init__') def method2(self, init_arg) -> None: ... @register.after('__init__') def method3(self) -> None: ... class Example(MixinC...
987,677
1286995f9bf2cc5c9748a0289fdf379bf8d377ca
import math import random import numpy as np def generator(): num=random.uniform(0,1) return math.pow(21,-num+1)-1 def generateMultiple(trials):#avg of one sample total=0 for x in range(trials): total+=generator() return total/trials ##def multipleSampleOld(trials): ## s...
987,678
1247f8707ad40c63a8a4f9d5e0f02aa0f241313d
import base64 import hmac import hashlib import logging import bcrypt from django.conf import settings from django.contrib.auth.hashers import (BCryptPasswordHasher, BasePasswordHasher, mask_hash) from django.utils.crypto import constant_time_compare from django.utils.encoding...
987,679
cd34f004267c78abbe668f9a9a9aac8c61f34902
""" Needs Revision ============== """ from y10.fr import cython013_py25 __all__ = dir()
987,680
cce41b99723ae9504bc3738f5042725664890ef3
from flask import Flask, render_template, jsonify, request, flash from forms import ContactForm from flaskext.mail import Mail, Message import os app = Flask(__name__) app.secret_key = 'development key' mail = Mail() app.config["MAIL_SERVER"] = "smtp.gmail.com" #gmail smtp settings app.config["MAIL_PORT"] = 465 app....
987,681
44138976fef88b5dfc09868a60b602484e4db386
#from Gcode3D_executer import from threading import Thread, Semaphore class Tramas_V1: def LineaProcesa(lines): if lines==[]: 1; #blank lines elif lines[0:3]=='G90': Control_V1.motorOn(); print ('start'); elif lines[0:3]=='G92': print ('...
987,682
9671b45579723369cda720b66a0ef8e1af166447
import time import vtk #import datetime import math #import random #import os import csv #import sys import randompolygon as rpg def timeRPG(N): t_before = time.time() polygon= rpg.rpg(N) t_after = time.time() times=[] times.append(t_after-t_before) return times if __name__ == "__main__...
987,683
7c60f8ab9dbca447ae3050a76621f1a53e98c40b
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ This module downloads all the ROAs from ftp.ripe.net/rpki or all the ROAs that exist for a specific date. Processing the HTML from the server has been tested to be faster than using Python's built-in FTP library. Guidelines: 1. Maintain a table of files that have be...
987,684
32d737148a6c11376ebde0e039c5ec05e3e13024
import numpy as np import matplotlib.pyplot as plt import sys sys.path.append('../..') sys.path.append('../../../../QuantumCircuitOptimizer') from vqe import * from ucc import UnitaryCoupledCluster #from spsa import SPSA from quantum_circuit import QuantumCircuit,SecondQuantizedHamiltonian l = 3 n = 2 delta = 1 #...
987,685
575096c41d005ae6e506af5c4f51b5d7ea2da9b0
#!/usr/bin/env python import numpy as np from LegKinematics import LegIK from LieAlgebra import RpToTrans, TransToRp, TransInv, RPY, TransformVector from collections import OrderedDict class SpotModel: def __init__(self, hip_length=0.04, shoulder_length=0.1, leg...
987,686
a0e8eb214532013903f3f753d4e71a1d380d29f2
class Solution: def findPeakElement(self, nums): """ :type nums: List[int] :rtype: int """ len_n = len(nums) for i in range(len_n - 1): if nums[i] > nums[i + 1]: return i return len_n - 1
987,687
094931a8ded87106a5e2f68dae90d523dde607e3
# -*- coding: utf-8 -*- """ Éditeur de Spyder Ceci est un script temporaire. """ import turtle as tu Room = [ { "color": "Red", "pos" : (0,0), "height" : 75 , "width" : 250 }, { "color": "Blue", "pos" : (0,-75), "height" : 250 , "width" : 50 }, { "...
987,688
74ef99fb0cf752e0818ce576c2f5e3b21d2c2aa3
from django.db import models from django.contrib.auth.models import User # Create your models here. class rss_field(models.Model): feed_link=models.CharField(max_length=200) created_by=models.CharField(max_length=100) class news(models.Model): title=models.CharField(max_length=400) summary=models.Cha...
987,689
2e0c59c1f34c8b65823152c7f0605ebad6a14d49
from app import mythic, links, use_ssl, db_objects from app.routes.routes import env from sanic import response from sanic_jwt.decorators import scoped, inject_user import app.database_models.model as db_model import base64 from app.routes.routes import respect_pivot async def get_scripts(user): try: scri...
987,690
9cad6edc4489447eebb8d65133623c91126e9d60
import unittest import time from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.common.exceptions import NoSuchElementException class class_login(unittest.TestCase): @classmethod def setUp(self): self.driver = webdriver.Chrome() def test_cms(self): ...
987,691
7439da6b1039b6fe5e56a4fcb0dc96f823e6fcaa
import os import yaml import string import codecs def main(): # template を開く tmpf = open("template.html", "r") template = string.Template(tmpf.read()) # yaml から値を取得する f = open("config.yml", "r") data = yaml.load(f) # yaml の設定分ループ for i in data: # yaml の値で、template を書き換える ...
987,692
b70f3cc08abf559ad3f69ff2a5c405f8e146d4a0
import numpy as np import cv2 import os, sys import Image import ImageDraw import ImageFont import matplotlib.image as mpimg import skimage.io sys.path.insert(0, '../../python/') import caffe #caffe.set_device(0) #caffe.set_mode_gpu() caffe.set_mode_cpu() mean = np.require([104, 117, 123], dtype=np.float32)[:, np.newa...
987,693
56d28e9fd06cc4aefdbbf204a365b105b3c88979
from PIL import Image import os # im = Image.open("lenna.jpg") # im.show() # # # 指定逆时针旋转的角度 # im_rotate = im.rotate(45) # im_rotate.show() # data_dir = 'D:/sharedhome/models/data/GCtest/Cancer/' # im = Image.open(data_dir+images_list[0]) # imrot1 = im.rotate(90) # imrot2 = im.rotate(180) # imrot3 = im.rotate(270) # ...
987,694
509bbc7bf7c3d6f3961c5ce3fe176fb4f0557069
#! /usr/bin/python import sys import os from numpy import * import Scientific.IO.NetCDF from Numeric import * from Scientific.IO import NetCDF as Net import matplotlib as mpl import matplotlib.pyplot as plt from matplotlib.ticker import MultipleLocator ##name of NetCDF trajectory file filename='../ptraj/mergtraj_equi...
987,695
2492e7448fc8060244f10058b59add5708c39454
dungeon = "--" room = "--" player_name = 'PLAYER' player_hp = 8 player_ap = 1 player_dp = 1 player_gp = 0 player_found_gp_in_room_2 = False monster_name = "MONSTER" monster_hp = 16 monster_ap = 2 monster_dp = 2 monster_gp = 4
987,696
2089073ebead8dabbd2e0f382d03063b57a3df71
#!/usr/bin/python import itertools import argparse import os import database parser = argparse.ArgumentParser(description='Print database for energy shifts in EuO and substrate') parser.add_argument('-d', '--database', default='/users/stollenw/projects/euo/database/isolated.db', help='Database file name') parser.add_...
987,697
6c81f0ba9ca96563c8bcf5fb54cdb3b410dfe787
import codecs fileData = './src/raw/charData.txt' fileDataLs = './src/raw/chars.ls' with codecs.open(fileData,'r',encoding='utf8') as f: data = f.read() front = '''# ============================================================================ # Column settings # ====================================================...
987,698
bbb0860be0b232bd8dec420473fdf9d2681f81aa
from lab5.constant import prime_number, size def rabin_karp(text: str, pattern: str): found_patterns_idx = [] text_len = len(text) pattern_len = len(pattern) if text_len < pattern_len: return -1 pattern_hash = hash(pattern, pattern_len) text_hash = hash(text, pattern_len) if patter...
987,699
0226fa8b09149f7754e4b81f3e26c047fcbfe395
from django.conf import settings DB_LOGGER_URL = getattr(settings, 'DB_LOGGER_URL', 'pg.example.com')