text stringlengths 38 1.54M |
|---|
# -*- coding: utf-8 -*-
"""
-------------------------------------------------
File Name:广东省税务局登记信息抓取
Description :
Author : ianchen
date:
-------------------------------------------------
Change Activity:
2017/11/22:
-------------------------------------------------
"""
import js... |
#!/usr/bin/env python
# vim:set fileencoding=utf8: #
import sys
diagnostic_report = sys.stdin.readlines()
diagnostic_report = [x.strip() for x in diagnostic_report]
columns = [[] for i in diagnostic_report[0]]
print(len(columns))
for r in diagnostic_report:
for i,b in enumerate(r):
columns[i].append(b)
... |
'''
Created on 2012-12-23
@author: Administrator
'''
class Test1:
def __init__(self):
self.a = "";
# def __init__(self, name):
# self.a = name;
# def method1(self):
# print 'method1'
def method1(self,name="123"):
print name;
test1 = Test1(... |
import json
with open('city.list.json') as data_file:
data = json.load(data_file)
city_list = []
for city in range(209579):
city_list.append(data[city]['name'])
|
class Solution:
def rob(self, nums: List[int]) -> int:
n = len(nums)
if n == 0:
return 0
# 第i个位置的信息
res = [0] * (n + 1)
res[1] = nums[0]
for i in range(2, n + 1):
res[i] = max(res[i - 1], res[i - 2] + nums[i - 1])
return res[-1]
# i... |
from app.car import Car
class Parking(object):
size = 0
lot = []
def __init__(self, size):
if isinstance(size, int):
self.size = size
self.lot = [None] * size
else:
raise ValueError
def currentCarCount(self):
count = 0
for i in sel... |
# coding:utf-8
# 1000元实盘练习程序
# 用程序识别技术形态
"""
参考文献:ANDREW W. LO, HARRY MAMAYSKY, AND JIANG WANG.Foundations of Technical Analysis:Computational Algorithms, Statistical Inference, and Empirical Implementation.TEIE JOURNAL OF FINANCE VOL. LV. NO. 4 AUGUST 2000.
"""
import pandas as pd
import numpy as np
import run
impor... |
#encoding: utf-8
#使用单引号,双引号,三个单引号或三个双引号引起来的一些字符
name = 'yueyong'
desc = "ma name is kk"
print('i\'m yueyong')
print("i\'m yueyong")
print('''i\'m yueyong''')
#特殊字符:“\(转义字符)、\r(回车)、\n(换行)、\t(tab键缩进)、\f(换页)”
print("i'm yueyong")
print('i\'m yueyong')
print('a\nb\tc')
print('a\\nb\\tc\\') #转义自身\字符
#字符串类型运算,只有加(+)和乘(*)... |
"""Write report about a GNSS site velocity analysis run
Description:
------------
"""
# Standard library imports
from enum import Enum
from collections import namedtuple
from typing import Union
# External library imports
import numpy as np
import pandas as pd
# Midgard imports
from midgard.collections import enu... |
"""
nlcmap - a nonlinear cmap from specified levels
Copyright (c) 2006-2007, Robert Hetland <hetland@tamu.edu>
Release under MIT license.
Some hacks added 2012 noted in code (@MRR)
"""
from pylab import *
from numpy import *
from matplotlib.colors import LinearSegmentedColormap
class nlcmap(LinearSegmentedColormap)... |
# -*- coding: utf-8 -*-
from multiprocessing import Pool # Pool import하기
from requests import get # to make GET request
import socket
import shutil
import os
import time
import zipfile
start_time = time.time()
# url 다운로드 함수
def download(url, file_name):
with open(file_name, "wb") as file: # open in binary mod... |
# Copyright (c) 2017-2022 The Molecular Sciences Software Institute, Virginia Tech
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this l... |
import numpy as np
import scipy.io as sio
import pandas as pd
from datetime import datetime
import os
import csv
from matplotlib.ticker import ScalarFormatter, MultipleLocator
import matplotlib.mlab as mlab
import scipy as sp
from scipy.interpolate import UnivariateSpline
import scipy.interpolate as si
from scipy.inter... |
# Start of Algorithm:
# 1. Convert from RGB colors to HSV
# 2. Apply Gaussian Blur to remove noice and removing unnecessary details and pixels
# 3. Turn every pixel that is neither white or yellow black.
# 4. Apply Canny Edge detection to detect quick changes in color in neighbouring pixels
# 5. Define region of int... |
import sys
import time
import random
fileTest = "validation.txt"
fileIn = "testing.txt"
#with open(fileIn) as f:
# content = f.readlines()
# A = content.split()
# for line in f:
# for word in line.split():
# A.append(int(word))
#f.close
def MaxSubarr(A):
res = A[0]
mem = start = fin =0
sum = ... |
#RUBEN CUADRA
#DAVID GAONA
#code to run a server that manages game boards of the Onitama game
import pygame
from onitampy.board import OnitamaBoard
from onitampy.movements import OnitamaCards
from codes import *
import os
#DO NOT TOUCH
BOARD_SIZE = 5 # 5x5
SCREEN = None
CLOCK = None
BLACK = ( 0, 0, 0)
G... |
from ast import literal_eval
import json
from os import path
class Config():
def __init__(self, filename='config.json'):
self.conf_file = filename
if not path.isfile(self.conf_file):
raise FileNotFoundError
def load(self):
with open(self.conf_file) as conf:
r... |
import warnings
import numpy as np
from bayesiancoresets.base import SingleGreedyCoreset
warnings.filterwarnings('ignore',
category=UserWarning) # tests will generate warnings (due to pathological data design for testing), just ignore them
np.seterr(all='raise')
np.set_printoptions(linewidth=... |
sql = "select %d as pattern, A.[DocEntry], A.[CardCode], A.[DocDate], A.[DocDueDate], A.[TaxDate], B.[ItemCode] " \
"from [YFY_TW].[dbo].[%s] A inner join [YFY_TW].[dbo].[%s] B " \
"on A.[DocEntry] = B.[DocEntry]"
|
# -*- coding: utf-8 -*-
"""
Created on Sat Oct 24 03:27:16 2020
@author: amk170930
"""
import numpy as np
import airsim
import time
client = airsim.MultirotorClient()
client.confirmConnection()
drones = np.array(['Drone1','Drone2','Drone3','Drone4','Drone5'])
for drone in drones:
# Enable control
client.e... |
from flask import Flask, render_template, request, make_response, redirect
import giphypop, re, socket
g = giphypop.Giphy()
version ='2.0'
hostname = socket.gethostname()
print "Starting web container %s" % hostname
app = Flask(__name__)
@app.route('/')
def index():
host_header = request.headers['Host']
# ... |
import allure
query_com = 'Аутсорсинговый контакт-центр БИС-Новосибирск'
query_goods = 'Услуги Call-центра'
numeral = 1
name_suite = allure.feature('Проверка карточки компании')
@name_suite
@allure.title('WS-d-015-1 Открытие карточки компании и наличие товаров в разделе "Предложения компании:"')
def test_check_comp... |
'''
@Author: Sankar
@Date: 2021-04-14 08:19:25
@Last Modified by: Sankar
@Last Modified time: 2021-04-14 08:35:09
@Title : Numpy_Python-11
'''
'''
Write a Python program to find the number of elements of an array, length of one
array element in bytes and total bytes consumed by the elements.
Expected Output:
Size of th... |
class BookModel:
def __init__(self, connection):
self.connection = connection
def init_table(self):
cursor = self.connection.cursor()
cursor.execute('''CREATE TABLE IF NOT EXISTS books
(id INTEGER PRIMARY KEY AUTOINCREMENT,
... |
#!/usr/bin/env python3
# coding: utf-8
import path_helper
import numpy as np
from utils import render
from utils.cython import mesh_core_cython
__all__ = ['path_helper']
def _norm(arr):
return arr / np.sqrt(np.sum(arr ** 2, axis=1))[:, None]
def norm_vertices(vertices):
vertices -= vertices.min(0)[None, :... |
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**7)
import math
n = int(input())
x = [0]*n
y = [0]*n
for i in range(n):
x[i], y[i] = map(int, input().split())
ans = 0
for i in range(n):
for j in range(n):
l = (x[j]-x[i])**2 + (y[j]-y[i])**2
if ans < l:
ans = l
print(mat... |
import socket
class client:
def __init__(self, IP = "", PORT = ""):
self.ip = IP
self.port = PORT
self.socket = socket.socket()
def bind(self,IP, PORT):
self.ip = IP
self.port = IP
def sendmessage(self,message):
conn = self.connect()
wit... |
from django.conf.urls import url, include
from core.views import views
from core.views import sample
urlpatterns = [
url(
r'^$',
sample.samples,
name='samples-list'
),
url(
r'^json$',
sample.list_samples_as_json,
name='samples-json'
),
url(
... |
#acc_smooth_HP.py
from sklearn import linear_model
import numpy as np
import os
import math
from pylab import *
from matplotlib.pyplot import figure, show
from matplotlib.patches import Ellipse
import matplotlib.transforms as mtransforms
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1.parasite_axes import... |
class Solution(object):
def subsets(self, nums):
"""
:type nums: List[int]
:rtype: List[List[int]]
"""
res = []
self.dfs([], nums, 0, res)
return res
def dfs(self, path, nums,index, res):
res.append(path)
for i in range(index, len(nums)): ... |
import numpy as np
from twisted.internet.protocol import DatagramProtocol
from twisted.internet import reactor
class ArtNet(DatagramProtocol):
def __init__(self):
self.buffer = np.zeros(12288)
self.last_sequence = [-1, -1]
def datagramReceived(self, data, addr):
#print "received... |
from django.contrib import admin
from products.models import Product, ProductFile
admin.site.register(Product)
admin.site.register(ProductFile)
|
import collections
from scrapy.exceptions import DropItem
from scrapy.exceptions import DropItem
import pymongo
class TutoPipeline(object):
vat=2.55
def process_item(self, item, spider):
if item["price"]:
if item['exclues_vat']:
item['price']= item['price']*self.vat
... |
import logging
SLACK_BOT_USER_NAME = '<<ADD YOUR SLACK BOT USERNAME HERE>>'
SLACK_BOT_API_TOKEN = '<<ADD YOUR SLACK BOT API TOKEN HERE>>'
CRYPT_TOKEN = 'YourCryptToken12' # Must be exactly 16 characters in length
CRYPT_PASSPHRASE_PATH = '/etc/neb.conf'
DEFAULT_CHANNEL = '#pi' # default channel where messages su... |
from django.contrib.auth.models import AbstractUser
from django.db import models
class User(AbstractUser):
has_premium = models.BooleanField(default=False)
is_moderator = models.BooleanField(default=False)
last_login = models.DateTimeField(null=True, blank=True)
class Member(models.Model):
user = mo... |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# 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... |
################################################################################
# Servo Motor Basics
#
# Created by Zerynth Team 2015 CC
# Authors: D. Mazzei, G. Baldi,
###############################################################################
from servo import servo
import streams
s=streams.serial()
# creat... |
import fresh_tomatoes
import movie
toy_story = movie.Movie("Toy Story",
"A story of a boy and his toys that come to life",
"http://www.impawards.com/1995/posters/toy_story_ver1.jpg",
"https://www.youtube.com/watch?v=tN1A2mVnrOM")
# print(toy_story... |
# scoutingGUI.py
# uses Tkinter...
from tkinter import *
from PIL import ImageTk, Image
path = "/Users/gwc/Desktop/Python/Scouting/StrongholdField.png"
root = Tk() # main loop
root.title("Scouting")
frame = Frame(root, width = 1250, height = 580)
frame.pack()
img = ImageTk.PhotoImage(Image.open(path))
# img = img.... |
# coding: utf-8
from the_tale.common.utils.testcase import TestCase
from the_tale.common.postponed_tasks.prototypes import POSTPONED_TASK_LOGIC_RESULT
from the_tale.common.postponed_tasks.tests.helpers import FakePostpondTaskPrototype
from the_tale.game.logic import create_test_map
from the_tale.game.logic_storage imp... |
import pygame as pg
import numpy as np
import os
def drawText(screen,text,textColorTuple,textPositionTuple):
font = pg.font.Font(None,50)
textObj=font.render(text, 1, textColorTuple)
screen.blit(textObj,textPositionTuple)
return
class GiveExperimentFeedback():
def __init__(self,screen,textColorTuple,screenWidth,... |
from common.errors import *
from common.types import *
from common.text_block import TextBlock
ContainerComponent = namedtuple('ContainerComponent', ['c','row','col','rel_to','rel_how'])
class Container(TextBlock):
def __init__(self,nrows=1,ncols=1,fixrows=False,fixcols=False,maxrows=1000,maxcols=1000,wrap=False)... |
#!/usr/bin/python
## @package onion_routing.registry.pollables.http_socket
# Implementation of HTTP server which supports certain
# @ref onion_routing.registry.services.
## @file http_socket.py
# Implementation of @ref onion_routing.registry.pollables.http_socket
#
import logging
import importlib
from common import c... |
def ip_checksum(data):
pos = len(data)
if (pos & 1):
pos -= 1
sum = ord(data[pos])
else:
sum = 0
while pos > 0:
pos -= 2
sum += (ord(data[pos+1]) << 8) + ord(data[pos])
sum = (sum >> 16) + (sum & 0xffff)
sum += (sum >> 16)
result = (~sum) & 0xffff
result = result >> 8 | ((result & 0xff) << 8)
re... |
import this
#! Stupid
numbers =[1, 2,3,4,5,6,7,8,9,10]
#! Idiot
value = range(1,11)
print("normal range", value)
numberList = [value for value in range(1,11)]
print('Number added using comprehension', numberList)
#? add 1 to 10 to existing without manually writing or for loop
someList = [55]
someList.extend( ra... |
#!/usr/bin/env python
'''
By David French (frenchd@astro.wisc.edu)
$Id: plotFancyCosIncDifHist_full.py, v 4.0 05/18/2015
This is the plotFancyCosIncDifHist_full bit from histograms3.py. Now is separated, and loads in a pickle
file of the relevant data, as created by "buildDataLists.py"
Previous (from histograms3.... |
# Part one: Write code that prints all the odd numbers from 1 to 1000. Use the for loop and don't use a list to do this exercise.
for count in range(1, 1001,2): # this line indicates what the variable count should loop up to, starting from 1, 1001 times, it will count only odd numbers
print count # ... |
import numpy as np
class FingerData:
def __init__(self, colour):
self.tipPoint = None
self.knucklePoint = None
self.colour = colour
def setTipPoint(self, cord):
self.tipPoint = cord
def setknucklePoint(self, cord):
self.knucklePoint = cord
class PalmData:
d... |
# coding = utf-8
from common.read_data import data
import os,re
# 设置系统字典,存放临时变量
dict_mongo={}
# 获取yaml数据
BASE_PATH = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
class yamlData():
@staticmethod
def getYamlData(file_path:str,key_name:str):
data_file_path = os.path.join(BASE_PATH,'data... |
from django.conf import settings
from django.contrib.auth.mixins import LoginRequiredMixin, UserPassesTestMixin
from django.shortcuts import redirect
from django.urls import reverse_lazy
from django.views.generic import (ListView, DetailView,
CreateView, UpdateView, DeleteView)
from .... |
from torch2trt.torch2trt import *
from torch2trt.module_test import add_module_test
@tensorrt_converter('torch.reshape')
def convert_reshape(ctx):
input_a = ctx.method_args[0]
input_b = ctx.method_args[1]
#print(input_a)
#print(ctx.method_return)
input_a_trt = trt_(ctx.network, input_a)
output ... |
import numpy as np
import matplotlib.pyplot as plt
plt.rc('font',family='Times New Roman')
acc_training = np.load('./result/train_acc.npy')
acc_valid = np.load('./result/valid_acc.npy')
loss_training = np.load('./result/cross_entropy.npy')
loss_valid = np.load('./result/valid_loss.npy')
plt.plot(np.arange(... |
# -*- coding: UTF-8 -*-
#*************************************
#author:zhengqs
#create:201707
#desc:
#**********************************
import json
class OutputStdOutPlugin(object):
def __init__(self, paramter):
self.paramter = paramter
def run(self, message):
if typ... |
from django.apps import AppConfig
class StaticyoungmodulusConfig(AppConfig):
name = 'StaticYoungModulus'
verbose_name = "杨氏静态模量实验" |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from ast import literal_eval
from odoo import api, fields, models, _
from odoo.exceptions import ValidationError
class Project(models.Model):
_inherit = 'project.project'
sale_line_id = fields.Many2one(
... |
# Copyright 2015 Google Inc. All Rights Reserved.
#
# 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 ag... |
from difflib import SequenceMatcher
# longest common substring
str1 = "zxabcdezy"
str2 = "yzabcdezx"
seqMatch = SequenceMatcher(None, str1, str2)
match = seqMatch.find_longest_match(0, len(str1), 0, len(str2))
if match.size != 0:
print(str1[match.a: match.a + match.size])
else:
print('No longest common su... |
from typing import Tuple
from hypothesis import given
from tests.integration_tests.utils import (
BoundPortedBoundsListsPair,
BoundPortedPointsPair,
BoundPortedRingManagersPair,
are_bound_ported_bounds_equal,
are_bound_ported_bounds_lists_equal,
are_bound_ported_ring_managers_equal)
from . imp... |
#!/usr/bin/env python
# coding: UTF-8
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
from datetime import date
today = date.today().strftime('%d/%m')
ir2019 = 2328
ir_today = 2298
p2019 = 3287
p_today = 3502
font = {
'family': 'Liberation Sans',
'serif': 'FreeSerif',
# 'weight': ... |
from django.urls import path
from . import views
urlpatterns = [
path('select', views.select),
# # path('shopping_mall/', mall_views.mall_views.as_view()),
# path('shopping_mall/', include('mall_views.urls')),
] |
from django.http import HttpResponseGone
apiv1_gone_msg = """APIv1 was removed on April 2, 2015.
Please switch to APIv3:
<ul>
<li><a href="https://www.djangopackages.com/api/v3/">APIv3 Endpoint</a></li>
<li><a href="https://djangopackages.readthedocs.io/en/latest/apiv3_docs.html">APIv3 Documentation</a></li>
... |
import pygame
from pygame import event
from pygame import display
from pygame import surface
from player import Player
from enemy import Enemy
from cloud import Cloud
from boss import Boss
from forcefield import Forcefield
import random
running = True
Game_Clock = pygame.time.Clock()
# Define constants fo... |
valores = input()
splitados = valores.split()
a = float(splitados[0])
b = float(splitados[1])
c = float(splitados[2])
#TRIANGULO
triangulo = (a * c) / 2
#CIRCULO
pi = 3.14159
circulo = pi * c**2
#TRAPEZIO
trapezio = ((a + b)*c)/2
#QUADRADO
quadrado = b**2
#RETANGULO
retangulo = a * b
print('TRIANGULO: %.3f' %triangul... |
import numpy as np
import matplotlib.pyplot as plt
import os
import math
os.chdir(os.path.dirname(os.path.abspath(__file__)))
# N = 2500 #antall pebbles
# x = np.random.rand(N)
# y = np.random.rand(N)
# s = 1+np.random.rand(N)*6
x = np.empty(shape=(100*100, 1))
y = np.empty(shape=(100*100, 1))
s = np.empty(shape=... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
import cv2
import math
from decimal import Decimal, ROUND_HALF_UP
def gradient(k):
image = cv2.imread("S.JPG")
image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
image = cv2.blur(image,(2*k+1, 2*k+1))
height, width = image.shape[:2]
g =... |
# Generated by Django 3.2 on 2021-04-11 19:02
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('food', '0002_food_deleted_description'),
]
operations = [
migrations.RenameField(
model_name='food',
old_name='deleted_descrip... |
# -*- coding: utf-8 -*-
"""
Created on Fri Jul 24 22:34:02 2020
@author: Soham Shah
"""
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution:
def removeElements(self, head: ListNode, val: int) -> ListN... |
#3rd solution
num = int(eval(input("Please enter a positive integer: ")))
import time
t0 = time.clock()
cnt = str.count(str(num), "0")
t1 = time.clock()
print("it haz", cnt, "zerz")
print ("it tooks", t1-t0 ,"secs")
|
# -*- coding: utf-8 -*-
"""
Created on Tue Sep 4 23:34:57 2018
@author: stanley
"""
import os
import scipy.io
import numpy as np
import pandas as pd
from sklearn.metrics import confusion_matrix
from plot_confusion_matrix import plot_confusion_matrix
import matplotlib.pyplot as plt
from collections import Counter
pi... |
#!/usr/bin/python
# -*- encoding=utf-8 -*- s
# 文件名:leetcode0009.py
import time
def performance(f):
def fn(*args, **kw):
t1 = time.time()
r = f(*args, **kw)
t2 = time.time()
print 'call %s() in %fs' % (f.__name__, (t2-t1))
return r
return fn
class Solution(object):
... |
import numpy as np
import os
from tqdm import tqdm
import shutil
from PIL import Image, ImageDraw
def mkdir(folder):
if os.path.exists(folder):
shutil.rmtree(folder)
os.makedirs(folder)
# background and object properties
img_size = (128, 128)
bg_color = 'gray'
obj_size = 8
obj_shape = 'ball'
obj_colo... |
# APIs for Windows 32-bit MSVC runtime library (msvcrt).
# Format: rettype, retname, callconv, exactname, arglist(type, name)
# arglist type is one of ['int', 'void *']
# arglist name is one of [None, 'funcptr', 'obj', 'ptr']
api_defs = {
'msvcrt.main_entry':( 'int', None, 'stdcall', 'msvcrt.mai... |
# Create your first MLP in Keras
from keras.models import Sequential
from keras.layers import Dense
from keras import optimizers
import numpy
#import matplotlib.pyplot as plt
# fix random seed for reproducibility
numpy.random.seed(7)
# load pima indians dataset
dataset = numpy.loadtxt("mul2_add3.csv", delimiter=",")
#... |
"""
Functions for color customizing of all PyAero items.
"""
from PySide6 import QtCore
def torgb(color):
"""Convert HTML string to (r, g, b, a) tuple"""
# pylint: disable=E1103
red, green, blue, alpha = QtCore.QColor.getRgb(color)
# pylint: enable=E1103
return (red, green, blue, ... |
"""
akamai.edgegrid
~~~~~~~~~~~~~~~
This library provides an authentication handler for Requests that implements the
Akamai {OPEN} EdgeGrid client authentication protocol as
specified by https://developer.akamai.com/introduction/Client_Auth.html.
For more information visit https://developer.akamai.com.
usa... |
# -*- coding: utf-8 -*-
#
import logging
import os
import traceback
import concurrent.futures
from concurrent.futures import ThreadPoolExecutor
from module.MOptions import MParentOptions, MOptionsDataSet
from mmd.PmxData import PmxModel # noqa
from mmd.VmdData import VmdMotion, VmdBoneFrame, VmdCameraFrame, VmdInfoIk,... |
'''Sample program showing List Comprehension. It creates a new list based on another list, in a single, readable line.
Makes use of generator expression sytax but using List (Square brackets instead of regular brackets)
1) We will generate the length of list of words from another list, except for the word "the"
2) We w... |
#! /usr/bin/env python
import rospy
import math
from std_msgs.msg import Int32 , String
from sensor_msgs.msg import LaserScan
def callback(msg):
global pub
laserScan = msg
minAng = laserScan.angle_min
maxAng = laserScan.angle_max
incAng = laserScan.angle_increment
rangos = laserScan.ranges
... |
import unittest
from conans.client.generators.boostbuild import BoostBuildGenerator
from conans.model.settings import Settings
from conans.model.conan_file import ConanFile
from conans.model.build_info import CppInfo
from conans.model.ref import ConanFileReference
class BoostJamGeneratorTest(unittest.TestCase):
... |
import sys
sys.path.insert(0, r'/local/scratch/sam5g13/Sam_5th-yr_Project')
import matplotlib.pyplot as plt
import subprocess, os, sys
from subprocess import Popen, PIPE
import numpy as np
from numpy import linalg as LA
from tempfile import TemporaryFile
import csv
from pylab import *
#from scipy import stats
import r... |
# encoding: utf-8
import argparse
import numpy as np
from torch.autograd import Variable
import torch.nn as nn
import torch.nn.functional as F
import torch
from tensorboardX import SummaryWriter
from mydb.dataset4FuzCav import ProMolDataset4FuzCav
# from mydb.dataset4FuzCav_adj import ProMolDataset4FuzCav
from layer... |
# Generated by Django 3.0.6 on 2020-06-06 04:59
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('bookings', '0004_auto_20200606_0437'),
]
operations = [
migrations.RemoveField... |
from common import convert_state_to_prefix
indent_string = ' '
# return {
# "name": self.name,
# "_id": self.id_string,
# "children": [c.to_dict() for c in self.children],
# "status": self.status,
# "deferred_to": self.deferred_t... |
#from test_api import say_hi, version, test
import test_api
test_api.say_hi()
test_api.test_json()
print('Version', test_api.version) |
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
# Created by Mingfei Chen (lasiafly@gmail.com)
# Created On: 2020-1-20
# ------------------------------------------------------------------------------
import logging
from tqdm import tqdm
import torch.nn.functiona... |
#coding:utf-8
'''
Created on 2015-06-15 19:10:54
@author: suo
'''
import os,shutil
try:
import xml.etree.cElementTree as ET
except ImportError:
import xml.etree.ElementTree as ET
from optionsParser.OptionsParser import OptionsParser
class CepcRecParser(OptionsParser):
def __init__(self, opts):
... |
# Takes in degrees celsius and returns degrees Fahrenheit
def CtoF(degC):
return ((9.0/5.0) * degC) +32.0
# Takes in degrees Fahrenheigt and returns degrees Celsius
def FtoC(degF):
return (5.0/9.0) * (degF - 32.0)
print(CtoF(0) == 32)
print(CtoF(-1) == 30.2)
print(CtoF(1) == 33.8)
print(CtoF(100) == 212)
prin... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = "Christian Heider Nielsen"
__doc__ = r"""
Created on 25-03-2021
"""
from abc import ABC
from neodroid.environments.ipc_environment import IpcEnvironment
__all__ = ["BulletEnvironment"]
class BulletEnvironment(IpcEnvironment, ABC):
... |
# Created by MechAviv
# Kinesis Introduction
# Map ID :: 101020400
# East Forest :: Magician Association
KINESIS = 1531000
NERO = 1531003
THREE_MOON = 1531004
sm.setIntroBoxChat(THREE_MOON)
sm.sendNext("Our meal has come to be.")
sm.setIntroBoxChat(KINESIS)
sm.sendSay("Please tell me that means we can eat it.")
sm... |
from django.conf.urls import url
from .import views
urlpatterns = [
url(r'^dl_air_trnspt_provn', views.dl_air_trnspt_provn, name='dl_air_trnspt_provn'),
url(r'^dl_air_trnspt_natnal', views.dl_air_trnspt_natnal, name='dl_air_trnspt_natnal'),
url(r'^dl_air_trnspt_dstrct', views.dl_air_trnspt_dstrct, name='d... |
from django.contrib import messages
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render, get_object_or_404, redirect
from .forms import PostForm
from .models import Post
# Create your views here.
def p... |
import rospy
from kill_handling.msg import KillsStamped
from kill_handling.msg import Kill
class KillListener(object):
def _killmsg_callback(self, msg):
self._kills = msg.kills
self._check_killed()
# Standard method to check if killed and call callbacks if appropriate
def _check_killed(s... |
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
# Load the data
test = pd.read_csv("../test.csv").values.reshape(-1,28,28,1)
results = np.ones([test.shape[0]],dtype=np.int64)
results = pd.Series(results,name="Label")
submission = pd.concat([pd.Series(range(1,28001),name = "ImageId"),result... |
from django.contrib import admin
from .models import Email_schedule, Schedule, WeekDays
# Register your models here.
admin.site.register(Schedule)
admin.site.register(WeekDays)
# admin.site.register(Email_schedule)
@admin.register(Email_schedule)
class EmailScheduleAdmin(admin.ModelAdmin):
list_display = ('time... |
import pandas as pd
def _calculate_buy_sell_pnls(df_buy, df_sell, buy_notional_per_instrument, sell_notional_per_instrumment):
buy_num = len(df_buy)
sell_num = len(df_sell)
if buy_num > 0:
buy_pnl = df_buy[("prices", "next_day_price_change")].sum() * buy_notional_per_instrument
else:
... |
from Practices.CalculateThePerimeterOfACircle import calculatePerimeter
from Practices.PracticesCalculatesDictonariesAndOthers.CalculateTheAreaOfACircle import calculateArea
#call to calculateRadio and CalculatePerimeters.
def printAreAndPerimeter(radio, perimeter):
calculateArea(radio)
calculatePerimeter(p... |
import socket
import struct
import cPickle as pickle
import params
#----
from util import TcpHelper as helper
class Protocal:
def __init__(self):
pass
def send_command(self, command, data=' '):
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect((params.TASK_SERVE... |
#!/usr/bin/env python
# coding=utf-8
"""
Site: http://www.beebeeto.com/
Framework: https://github.com/n0tr00t/Beebeeto-framework
"""
import re
import requests
from baseframe import BaseFrame
class MyPoc(BaseFrame):
poc_info = {
# poc相关信息
'poc': {
'id': 'poc-2015-00... |
class Nonterminal:
def __init__(self):
self.id = ""
self.place = "EMPTY"
self.type = ""
self.dic = {}
self.value = ""
self.code = ""
self.label = ""
self.true_list = []
self.false_list = []
self.m = None
self.quad = 10000000000... |
import unittest
from packages.classes.pieces.Rook import Rook
from packages.classes.Board import Board
class TestRookPossibleMoves(unittest.TestCase):
def test_think_possible_moves(self):
eating_moves = [[-1, 0], [2, 0]]
possible_moves = [[1, 0],
[0, -1], [0, -2], [0, -3... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.