text stringlengths 8 6.05M |
|---|
#!/usr/bin/env python3
#
# A very basic DREAM Python example. This script generates a basic
# DREAM input file which can be passed to 'dreami'.
#
# Run as
#
# $ ./basic.py
#
# ###################################################################
import numpy as np
import sys
sys.path.append('../../py/')
from DREAM.D... |
import requests
from bs4 import BeautifulSoup
import json
import smtplib
from smtplib import SMTPException
import datetime
import mariadb
import sys
def get_wod():
url = "https://www.merriam-webster.com/word-of-the-day"
response = requests.get(url)
soup = BeautifulSoup(response.text, 'html.pa... |
'''
author: Zitian(Daniel) Tong
date: 14:24 2019-05-05 2019
editor: PyCharm
email: danieltongubc@gmail.com
'''
from models.alert import Alert
alerts = Alert.all()
for alert in alerts:
alert.load_item_price()
print(alert.load_item_price())
print(alert.price_limit)
alert.notify_if_... |
'''dinero ganado despues de un mes, si el mes paga 15% de interes por año?'''
n=input('Ingrese el dinero invertido ')
n=float(n)
interespormes= 0.15/12
dineroganado = interespormes*n
print(f"el dinero ganado por mes es de: {round(dineroganado,2)}")
print(f"el dinero ganado por año es de: {n*0.15}")
|
import math
def main():
theSum = 0
numbers = eval(input("Enter numbers seperated by commas: "))
for i in numbers:
theSum = theSum + i
print("The sum is ", theSum)
main()
|
#!/usr/bin/python3.4
# -*-coding:Utf-8
class Tableau:
"""Classe définissant une surface sur laquelle on peut écrire,
que l'on peut lire et effacer, par jeu de méthodes. L'attribut modifié
est 'surface'"""
def __init__(self):
self.surface = ""
def ecrire(self, message_a_ecrire):
if self.surface == "" :
s... |
from os.path import join
from xml.sax import ContentHandler, parseString
from action import Action
import kodi_baselibrary as kodi
class Expression():
def __init__(self):
self.name = ""
self.unit = None
class ExpressionContentHandler(ContentHandler):
def __init__(self, unit):
self... |
import requests
import json
url = 'http://localhost:8888'
url += '/v1/user/registration'
headers = {
'Content-Type': 'application/x-www-form-urlencoded'
}
data = {
'email': 'm.petrob@list.ru',
# 'email': 'a.anisimov@lab15.ru',
'password': 'Password123',
'first_name': 'Михаил',
'last_name': 'П... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
# Utils
import os
import numpy as np
import matplotlib.pyplot as plt
import rasterio
from rasterio.plot import reshape_as_image
import rasterio.mask
from rasterio.windows import Window
def read_image(root,filename):
"""
read image with rasterio and return an a... |
#! /usr/bin/env python3
import sys
import subprocess
def print_error(*args, **kwargs):
print(*args, file=sys.stderr, **kwargs)
def run_command(command, input=None):
result = subprocess.run(command, check=True, capture_output=True, text=True, input=input)
return result.stdout.strip("\n").split("\n")
def list_windo... |
# Generated by Django 2.1.7 on 2019-08-28 04:24
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('level', '0004_auto_20190716_1028'),
]
operations = [
migrations.AddField(
model_name='level',
name='hint1farsi',
... |
#!/usr/bin/python2.7
#coding=utf8
r'''
Fuction:
Version: 1.0.0
Created: Tuyj
Created date:2015/4/1
'''
from _env import addPaths
addPaths(".")
import json,datetime,os,re,shutil,copy,threading,unittest
import pyLibs.t_com as t_com
import pyLibs.t_multitask as t_multitask
def geSmartNowTime(): #return yyyymmddHHMMSS... |
#Indexing
import numpy as np
#1-D Arrays
"array indexing is the same as acessing an array element"
arr = np.array([1,2,3])
print(arr[0])
#2-D Arrays
"To access elements from a 2-d array we can use comma seperated integers representing the dimension and the index of the elements"
arr2 = np.array([[1,2,3],[4,5,6]])
p... |
from __future__ import absolute_import
from . import backends
from . import forms
from . import managers
from . import models
from . import urls
from . import views
default_app_config = 'provider.oauth2.apps.Oauth2'
|
import ast
from django.contrib import admin
from user_input.models import DailyUserInputEncouraged,\
DailyUserInputStrong,\
DailyUserInputOptional,\
InputsChangesFromThirdSources,\
UserDailyInput,\
Goals,\
DailyActivity
class DailyUserInputStrongInline(admin.Stack... |
import os
import sys
import unittest
import mockings
path = os.path.abspath(os.path.join(os.path.dirname(__file__), '../core'))
sys.path.insert(1, path)
from now import Now
import chords
class TestRequiresVirtualEnv(unittest.TestCase):
def testModuleWithRequirements(self):
now = Now(tweak = "2015-01-01 12:00:00... |
from urllib.error import HTTPError
import requests
import lxml.html as lh
import pandas as pd
import wget
import os
url = 'https://www.slickcharts.com/sp500'
page = requests.get(url)
doc = lh.fromstring(page.content)
tr_elements = doc.xpath('//tr')
tr_elements = doc.xpath('//tr')
# Create empty list
col = []
# For ea... |
from django.conf.urls.defaults import *
from blog.views import *
urlpatterns = patterns('blog.views',
url(r'^$', IndexView.as_view(), name="blog"),
url(r'^post/(?P<post_id>\d+)/$', obsolete_post),
url(r'^(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})/(?P<slug>[-\w]+)/$', PostView.as_view(), name="post"),
... |
# -*- coding: utf-8 -*-
from datetime import date
from unittest import TestCase
from mock import patch
import six
from .helpers import example_file
from popolo_data.importer import Popolo
EXAMPLE_EVENT_JSON = b'''
{
"events": [
{
"classification": "legislative period",
"end_dat... |
#!/usr/bin/env python3
# Copyright (c) 2011 The 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.
"""Usage: change_mach_o_flags.py [--executable-heap] [--no-pie] <executablepath>
Arranges for the executable at |executable_path| ... |
import sys
import traceback
from six.moves import _thread, queue as Queue
import time
import cx_Oracle
from tc_lib import sub, send
from copy import deepcopy
import wx
from pprint import pprint
e=sys.exit
import itertools
import threading
#----------------------------------------------------------------------
def f... |
import csv, os
data = []
with open('multi_school.csv', 'r') as file:
reader = csv.reader(file)
for row in reader:
data.append(row)
for datum in data:
print datum
|
#!/bin/python
from solution import solution
# Regular input
def test_solution_5_3446144():
assert solution(5, [3, 4, 4, 6, 1, 4, 4]) == [3, 2, 2, 4, 2]
|
#!/usr/bin/python
sample_dict={'a':"apple",'b':"ball"}
sample_dict.update({'b':"boy",'c':'cat'})
print(sample_dict['a'],sample_dict.get('b'),sample_dict.get('c'))
|
from operator import itemgetter
from collections import UserDict
from datetime import datetime
from pathlib import Path
from typing import Dict, Iterable, List, Optional, Tuple, Union, cast
import pandas as pd
import pyModeS as pms
from tqdm.autonotebook import tqdm
from traffic.core import Flight, Traffic
from traffi... |
import cv2
import numpy as np
import os.path
path = 'C:\\SDA\\SDA_Crop';
num_files = len([f for f in os.listdir(path)if os.path.isfile(os.path.join(path, f))])
for file in range(num_files):
#import image
image = cv2.imread('C:\\SDA\\SDA_Crop\\crop'+str(file+1)+'.png')
#cv2.imshow('orig',image)
#cv2.wai... |
#!/usr/bin/env python3
# After running SNP_Utils (https://github.com/mojaveazure/SNP_Utils), some
# SNPs will fail and not have any BLAST hits (sometimes because our identity
# threshold is very high). So, we use IPK BLAST server (with the latest morex
# reference genome) to identify the best possible hit and the asso... |
import sys
import math
print(type(1))
print(isinstance(1, int))
print(1+1)
print(1+1.)
print(float(2))
print(int(2.5))
print(int(-2.5))
print(11/2)
print(11//2)
print(-11//2)
print(11.//2)
print(11**2)
print(11%2)
print(math.pi)
print(math.sin(5))
print(math.tan(math.pi/4))
def is_it_true(anything... |
userAgent = ''
cID = ''
cSC = ''
userN = ''
userP = '' |
from __future__ import division
import serial
import time
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import cPickle as pickle
from os.path import join
import os
import csv
import time
from hercubit import settings
from hercubit.device import sensor_stream
from ast import... |
#!/usr/bin/env python
"""
An example client / server of xmlrpc transport with python.
You could have the server using one version of python and the client using another version of python (within reason : maybe not with Python 1.0 and Python3000...).
To use in it's current simple form:
1) start server by having "if 1:... |
# 1
#
# a = float(input('Digite a medida do lado A: '))
# b = float(input('Digite a medida do lado B: '))
# c = float(input('Digite a medida do lado C: '))
#
# if a < b + c and b < a + c and c < a + b:
# print('Os valores A, B e C podem formar um triângulo.')
#
# if a != b != c != a:
# print('Estes valo... |
# coding: utf-8
"""
Copyright 2016 SmartBear Software
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 applica... |
import tensorflow as tf
import numpy as np
def choose_best(neural_networks, fitnesses):
with tf.name_scope('Choose_best') as scope:
print("fitness totais")
print(fitnesses)
top_2_idx = np.argsort(fitnesses)[-2:]
print(top_2_idx)
top_2_values = [neural_networks[i] for i in... |
from __future__ import division
import theano.tensor as T
import theano
import numpy
class LRTuner:
def __init__(self, low, high, inc):
self.low = low
self.high = high
self.inc = inc
self.prev_error = numpy.inf
def adapt_lr(self, curr_error, curr_lr):
if curr_error >= self.prev_error:
lr = max(curr_lr... |
a=int(input())
b=int(input())
power=1
if b>0:
for i in range(0,b,1):
power*=a
else:
for i in range(0,b,-1):
power/=a
print(power)
|
# Copyright 2021-2022 NVIDIA 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 ... |
from django.conf import settings
from django.conf.urls.defaults import *
from basket import admin
urlpatterns = patterns('',
('^subscriptions/', include('subscriptions.urls')),
(r'^admin/doc/', include('django.contrib.admindocs.urls')),
(r'^admin/', include(admin.site.urls)),
('^nagios/', include('na... |
# -*- coding: utf-8 -*-
"""
Created on Sat Jun 13 08:12:15 2020
@author: TOP Artes
"""
# Importa as bibliotecas de estruturação e visualização dos dados
import pandas as pd
import numpy as np
# Importa as classes de controle de cada objeto
from control.control_estado import ControlEstado
from control.con... |
import os
import glob
import sqlite3
import pandas as pd
import matplotlib.pyplot as plt
from tqdm import tqdm
import numpy as np
params = {
'font.size': 14,
'figure.constrained_layout.use': True,
'savefig.dpi': 200.0,
}
plt.rcParams.update(params)
def mkdir_if_not_exists(dirn... |
#!/usr/bin/env python3
import os, sys
import argparse
import csv
import wave
def LoadKaldiArk(path):
d = {}
with open(path, 'r', encoding = 'utf-8') as f:
for line in [ l.strip() for l in f if l.strip() ]:
key, content = line.split(maxsplit=1)
if d.get(key) == None:
... |
# AUTO GENERATED FILE - DO NOT EDIT
from dash.development.base_component import Component, _explicitize_args
class Progress(Component):
"""A Progress component.
Keyword arguments:
- children (a list of or a singular dash component, string or number; optional): The children of this component
- id (string; optio... |
from rubicon_ml.client import Base, TagMixin
from rubicon_ml.client.utils.exception_handling import failsafe
from rubicon_ml.exceptions import RubiconException
class Dataframe(Base, TagMixin):
"""A client dataframe.
A `dataframe` is a two-dimensional, tabular dataset with
labeled axes (rows and columns) ... |
###################################################################
#
# CSSE1001 - Assignment 2
#
# Student Number: 43034002
#
# Student Name: Jiefeng Hou(Nick)
#
###################################################################
####################################################################
#
# Do not ch... |
# Generated by Django 2.2 on 2020-05-18 22:02
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('hotel', '0005_auto_20200518_2202'),
]
operations = [
migrations.RemoveField(
model_name='room',
name='... |
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from PyQt5.QtCore import *
import cv2
from flask import Flask, Response
import time
import threading
import multiprocessing
import urllib
import json
camMult = 2
flaskServer = Flask(__name__)
camera = cv2.VideoCapture(0)
img = None
def video_thread(camera):
... |
import torch
import torch.nn as nn
from torch import hub
# PCA_PARAMS = "https://github.com/harritaylor/torchvggish/" \
# "releases/download/v0.1/vggish_pca_params-970ea276.pth"
class VGG(nn.Module):
def __init__(self, features, postprocess):
super(VGG, self).__init__()
self.postproc... |
# -*- encoding:utf-8 -*-
# __author__=='Gan'
# Given a 2d grid map of '1's (land) and '0's (water), count the number of islands.
# An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically.
# You may assume all four edges of the grid are all surrounded by water.
#
# Example... |
from django.shortcuts import render
from django.http import HttpResponseRedirect
from django.contrib.auth import authenticate, login
from django.contrib import messages
# Create your views here.
def user_login(request):
if request.user.is_authenticated():
messages.info('Ya has iniciado sesion')
return HttpRespon... |
from django.http import HttpResponse, Http404, HttpResponseRedirect
from ChitChat.models import Message
from django.shortcuts import render
from ChitChat.forms import CreateForm, SearchForm
from django.db.models.base import ObjectDoesNotExist
#Routes Views based on GET, POST, PUT, or DELETE
#Views Specified must be se... |
from django.contrib import admin
from .models import Post #whenever you are making models, need to register here
# adds posts section into admin page
admin.site.register(Post)
|
# 15-112, Summer 1, Homework 1.2
######################################
# Full name: Joyce Moon
# Andrew ID: seojinm
# Section: B
######################################
######### IMPORTANT NOTE #############
# You are not allowed to import any modules, or use loops, strings, lists, or recursion.
# Given an integer n... |
import define
import requests
def rsi(pricedata , index):
up = 0
down = 0
for i in range (define.rsinumber-1):
if (pricedata[(index+2+i)%define.rsinumber] - pricedata[(index + i +1) % define.rsinumber]) > 0 :
up = up + (pricedata[(index+2+i)%define.rsinumber] - pricedata[(index + i +1) % define.rsinumber])
e... |
#from numpy.linalg import matrix_rank as mrank
from nuclear_alignment import nuclear_alignment
import transmission
import Message
import numpy as np
import sys
## Parameters
num_nodes = 16
min_eps = .1
num_msgs = 2
#
eps_vec = np.random.uniform(low=min_eps,size=num_nodes)
print 'Number of receivers(nodes): ', num_... |
import asyncio
import logging
import re
import threading
import time
from concurrent.futures import ProcessPoolExecutor, ThreadPoolExecutor
from multiprocessing import current_process
import pyppeteer
import requests
from pyppeteer import errors, launch
logging.basicConfig(level=logging.DEBUG)
logging.getLogger("pypp... |
from django.shortcuts import render, redirect
from django.contrib.auth import logout, login, authenticate
from django.views import View
from authentication.forms import SignUpForm, LoginForm
from subreddit.models import Subreddit
from django.contrib import messages
from subreddit.helper import random_subreddits, subred... |
from exceptions.resource_not_found import ResourceNotFound
from entities.erequest import Erequest
from daos.erequest_dao import ErequestDAO
from services.erequest_service import ErequestService
from entities.manager import Manager
from entities.employee import Employee
from daos.employee_dao import EmployeeDAO
fro... |
import numpy as np
score_title=np.dtype({'names':['name','chinese','math','english'],'formats':['S32','i', 'i', 'i']})
score=np.array([('zhangfei', 68,65,30),('guanyu',95,76,98),('liubei',98,86,88),('dianwei',90,88,77),
('xuchu',80,90,90)], dtype=score_title)
chineses=score[:]['chinese']
maths=sc... |
import copy
import pytest
import torch
from common_utils import assert_equal
from torchvision.models.detection import _utils, backbone_utils
from torchvision.models.detection.transform import GeneralizedRCNNTransform
class TestModelsDetectionUtils:
def test_balanced_positive_negative_sampler(self):
sampl... |
from sys import stdin
line = stdin.readline ().strip ()
|
import scrape
import share
def main():
scrape.download_posts('dankmemes')
share.messenger()
if __name__ == '__main__':
main()
|
"""Unit test for treadmill.appcfg.configure.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import os
import shutil
import sys
import tempfile
import unittest
import mock
import treadmill
from treadmill.appcfg... |
def is_posititve(number):
if number > 0:
return True
def sum_divisors(number):
divisors = 0
for divisor in range(1, number):
if number % divisor == 0:
divisors += divisor
return divisors
def perfect_number(number):
if is_posititve(number) and sum_divisors(number) == n... |
import torch.nn as nn
import torch
class MyModel(nn.Module):
def __init__(self):
super(MyModel, self).__init__()
self.nn_layers = nn.Sequential(
# ========================================================== #
# fully connected layer
# Can stack number of layers yo... |
# -*- coding: utf-8 -*-
"""These settings overrides what's in settings/general.py
"""
from . import general
# 扩展中间件,主要加载系统配置和账户信息
MIDDLEWARE_CLASSES = (
# Use GAE ndb
'google.appengine.ext.ndb.django_middleware.NdbDjangoMiddleware',
) + general.MIDDLEWARE_CLASSES + (
'custom.middleware.sysconf.AppOptionsM... |
# https://www.geeksforgeeks.org/convert-csv-to-json-using-python/
import csv
import json
def make_json(csvFilePath, jsonFilePath):
jsonArray = []
# open a cv reader called DictReaer
with open(csvFilePath, encoding='utf-8') as csvf:
csvReader = csv.DictReader(csvf)
#convert each csv row i... |
from django.conf.urls import url
from pruebas import views
urlpatterns = [
url(
r'^models/(?P<datatxt_id>[A-Za-z0-9\-]+)/test/$',
views.model_test,
name='test'
),
url(
r'^models/(?P<datatxt_id>[A-Za-z0-9\-]+)/results/$',
views.ClassifierModelList.as_view(),
... |
import re
import unittest
import validator.utils
class EntryTest(unittest.TestCase):
def __init__(self, test_name, entry, test_class):
unittest.TestCase.__init__(self, test_name)
self.entry = entry
if 'dn' in entry:
self.dn = entry['dn'][0]
else:
self.dn = N... |
# 'count', 'index
a = ('math', 'history', 'bahasa indonesia', 'math')
# manampilkan total jumlah value di dalam tuple yang kita spesifikasikan
print(a.count('math'))
# mencari lokasi index dari sebuah value di tupple, parameter start dan stop adalah optional, tugasnya hampir sama
# dengan slicing, jika tidak ada valu... |
from time import sleep
import config
import logging
import csv
from gevent import timeout
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver import Firefox, ActionChains
from selenium.webdriver.firefox.options import Options
import sys
from selenium.webdriver.common.... |
import pandas as pd
import requests
import json
import os
import xml.etree.ElementTree as ET
import time
import glob
import math
stage = ""
# stage = "_dev"
genji_dir = "/Users/nakamurasatoru/git/d_genji"
hostPrefix = "https://genji.dl.itc.u-tokyo.ac.jp"
# hostPrefix = "https://utda.github.io/genji"
dir = genji_dir ... |
#1.获取用户要复制的文件名
old_file_name = input('请输入所要复制的文件名:')
#2.打开要复制的文件
old_file=open(old_file_name,'r')
#3.新建一个文件
new_file_name = '副件'+old_file_name
new_file = open(new_file_name,'w')
#4.从旧文件中读取数据,并写入到新文件中
content = old_file.read()
new_file.write(content)
#5.关闭两个文件
old_file.close()
new_file.close()
|
class vehicles :
def __init__(self,ID,brand,model,year,color,vehicle_type,base_cost):
self.ID = ID
self.brand = brand
self.model = model
self.year = year
self.color = color
self.vehicle_type = vehicle_type
self.base_cost = base_cost
class Sedan(... |
#!/usr/bin/env python3
# Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
"""This module provides shared functionality to provide Dart metadata for
DOM APIs.
... |
#-*- encoding:utf-8 -*-
from hello import db,User
f=open('danwei.txt','rt',encoding="utf-8")
for x in f:
db.session.add(User(username=x.split(',')[1][:-1],collage=x.split(',')[0],password='123456',usermode=4))
db.session.commit() |
from distutils.core import setup
from distutils.extension import Extension
import glob
setup(
name = "RoundClient",
version = "1.0",
description = 'Round Audio Client',
author = 'Mike MacHenry',
author_email = 'dskippy@ccs.neu.edu',
url = 'http://roundware.sourceforge.net',
lice... |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^$', views.index, name="index"),
url(r'^/$', views.most_popular, name="most_popular"),
url(r'^add_secret$', views.add_secret, name="add_secret"),
url(r'^delete_secret/(?P<id>\d+)$', views.delete_secret, name="delete_secret"),
... |
#四个数字:1、2、3、4,能组成多少个互不相同且无重复数字的三位数?各是多少?
count=0
for i in range(1,5):
for j in range(1,5):
for k in range(1,5):
if i != j and i != k and j !=k:
count+=1
print(i,j,k)
print("共有",count,"个") |
from flask import Flask
from .blueprints import blueprint
app = Flask(__name__)
app.register_blueprint(blueprint)
from .views import hanzi, utils, vocab, item
from threading import Thread
from pathlib import Path
import sys
class ChineseViewer:
def __init__(self, port=42045, debug=True):
self.port = p... |
import argparse
import sys
from wineQualityPred.paper import predictQuality
from wineQualityPred.paper import reproduceResults
def parse_arguments(args):
'''
Parse the arguments of the command line
'''
parser = argparse.ArgumentParser(description="Predict wine quality from its physicochemical propert... |
from .admin import AdminUser
from .order import Order
from .product import Product
from .texts import Texts
from .user import User
|
#!/usr/bin/env python
# Created by Joe Ellis
# Columbia University DVMM lab
### Libraries ###
import os,sys, getopt
from gensim import corpora, models, similarities
from gensim.models import ldamodel
sys.path.append("/ptvn/src/ellis_dev/speaker_diarization/dev/utility")
import FileReader as reader
### Global Variable... |
# Copyright 2021 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import pytest
from pants.backend.shell.goals import tailor
from pants.backend.shell.goals.tailor import PutativeShellTargetsRequest, classify_source_files
from pants.backend.shell.target_... |
# -*- coding: utf-8 -*-
from odoo import fields, models, api, _
import logging
_logger = logging.getLogger(__name__)
class register(models.Model):
_name = 'lat.siswa.register'
name = fields.Char(
string='Number',
required=True,
copy=False
)
lat_siswa = fields.Char(string="Nam... |
"""App related constants."""
import re
DNS_RECORD_TYPES = [
("spf", "SPF"),
("dkim", "DKIM"),
("dmarc", "DMARC"),
("autoconfig", "Autoconfig"),
("autodiscover", "Autodiscover"),
]
SPF_MECHANISMS = ["ip4", "ip6", "a", "mx", "ptr", "exists", "include"]
DMARC_URI_REGEX = re.compile(r"^mailto:(.+)(... |
# coding=utf-8
# Copyright 2021 The Google Research Authors.
#
# 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 applicab... |
from google.appengine.ext import db
class newchat(db.Model):
u1=db.StringProperty()
u2=db.StringProperty()
class bhaat(db.Model):
name=db.StringProperty()
thistime=db.StringProperty()
detail=db.StringProperty()
link=db.ReferenceProperty(newchat)
class auths(db.Model):
user=db.UserProperty()
token=db.StringP... |
#!/usr/bin/env python3
import os
import argparse
import put.ui.file_functions
def parse_arguments():
parser = argparse.ArgumentParser()
parser.add_argument('dir', nargs='?', default=os.getcwd())
args = parser.parse_args()
return args
def main():
args = parse_arguments()
put.ui.file_functio... |
items = ('45','67','56','78')
a = ('điểm cao nhất:')
print(a,*items,sep=',')
for i,j in enumerate(items):
print(i+1,j)
b = int(input('new high scores:'))
print(b)
|
import keras
from keras.layers import Input
from keras.datasets import imdb
from keras.models import Sequential
from keras.layers import Dense
from keras.layers import TimeDistributed
from keras.layers import LSTM
from keras.layers.embeddings import Embedding
from keras.preprocessing import sequence
import numpy as np
... |
from dataclasses import dataclass
from sqlite3 import Connection
from typing import List, Optional
from uuid import uuid4
@dataclass
class User:
id: str
name: str
is_system: bool
discord_id: Optional[int]
telegram_id: Optional[int]
vk_id: Optional[int]
bill_from: int
token_credit: int
... |
import random
from kivy.app import App
from kivy.uix.widget import Widget
from kivy.properties import NumericProperty, ReferenceListProperty, ObjectProperty
from kivy.vector import Vector
from kivy.clock import Clock
_code_git_version="79ec8fe5fe8ec95d3ac6026eb1e502bbada7c7ba"
_code_repository="https://github.com/plops... |
"""
*********************************************************************
This file is part of:
The Acorn Project
https://wwww.twistedfields.com/research
*********************************************************************
Copyright (c) 2019-2021 Taylor Alexande... |
# -*- coding: utf-8 -*-
import numpy as np
import re
import labsql
from sklearn.cluster import KMeans
import collections
reBODY = r'<body.*?>([\s\S]*?)<\/body>'
reCOMM = r'<!--.*?-->'
reTRIM = r'<{0}.*?>([\s\S]*?)<\/{0}>'
reTAG = r'<[\s\S]*?>|[ \t\r\f\v]'
reIMG = re.compile(r'<img[\s\S]*?src=[\'|"]([\s\S]*?)[\'|"][\s... |
import os
import unittest
import json
from flask_sqlalchemy import SQLAlchemy
from flask import session
import auth.constants as constants
from app import create_app
from database.models import setup_db, db, Month, User, UserHistory, Secret
# Travel Cockpit endpoints test class
class TravelCockpitTestCase(unittest.... |
import djcelery
import datetime
djcelery.setup_loader()
CELERY_TIMEZONE = 'Asia/Shanghai'
BROKER_URL = 'redis://localhost:6379' #clery4 版本用来代替CELERY_BROKER_URL
CELERY_BROKER_URL = 'redis://localhost:6379/1'
#CELERY_RESULT_BACKEND = 'redis://localhost:6379/0'
CELERY_RESULT_BACKEND = 'django-db'
CELERY_CACHE_BACKEND =... |
__author__ = 'luca'
from PIL import Image
from images.image_converter import ImageConverter
class Frame(object):
def __init__(self, path):
self._path = path
self._image = None
self._grayscaled_image = None
def path(self):
return self._path
def image(self):
if not ... |
from spack import *
import distutils.dir_util as du
import sys,os
sys.path.append(os.path.join(os.path.dirname(__file__), '../../common'))
from scrampackage import write_scram_toolfile
class Pythia6(Package):
"""PYTHIA is a program for the generation of high-energy physics events,
i.e. for the description of ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Aug 20 21:22:51 2018
@author: brandinho
"""
import math
import numpy as np
### Combinations Calculator ###
def nCr(n, r):
return (math.factorial(n) / (math.factorial(r) * math.factorial(n - r)))
### Extract unique elements from a list ###
def... |
#!/usr/bin/python
from xsocket import *
from xia_address import *
set_conf("xsockconf_python.ini","stock_test_client.py")
print_conf()
sock=Xsocket()
if (sock<0):
print "error opening socket"
exit(-1)
# Make the sDAG (the one the server listens on)
dag = "RE %s %s %s" % (AD1, HID1, SID_STOCK)
Xconnect(sock, dag)
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.