text stringlengths 8 6.05M |
|---|
from string import split
from urllib import urlopen, quote
from BeautifulSoup import BeautifulSoup, NavigableString
from datetime import datetime, date
import scraperwiki
data = scraperwiki.sqlite.select('datetime()')
startedAt = data [ 0 ] [ 'datetime()' ]
scraperwiki.sqlite.execute("drop table if exists swdata")
sc... |
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
class SpinnerBox(BoxLayout):
def __init__(self, **kwargs):
super().__init__(**kwargs)
class SpinnerApp(App):
def build(self):
return SpinnerBox()
if __name__ == '__main__':
SpinnerApp().run()
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2018 Phonexia
# Author: Jan Profant <jan.profant@phonexia.com>
# All Rights Reserved
import argparse
import pickle
import random
import logging
import os
import cv2
import openface
logger = logging.getLogger()
logger.setLevel(logging.INFO)
def show_... |
n = int(input("Digite um número inteiro para saber seu correspondente na seqüencia de Fibonacci: "))
a = 1
b = 1
count = 1
while n <= 0:
print('Não é possível utilizar um valor negativo.')
n = int(input('Digite um número inteiro para saber seu correspondente na sequüencia de Fibonacci: '))
while count <= (n - ... |
num = int(input('Digite um número para ver sua tabuada: '))
print("""{} X 1 = {}
{} X 2 = {}
{} X 3 = {}
{} X 4 = {}
{} X 5 = {}
{} X 6 = {}
{} X 7 = {}
{} X 8 = {}
{} X 1 = {}
{} X 1 = {}""".format(num, num * 1, num, num * 2, num, num * 3, num, num * 4, num, num * 5, num, num * 6, num, num * 7, num, num * 8, num, num ... |
#!/usr/bin/python3
def uniq_add(my_list=[]):
s = 0
new = list(dict.fromkeys(my_list))
for i in new:
s += i
return s
|
## gfal 2.0 tools core parameters
## @author Adrien Devresse <adevress@cern.ch> CERN
## @license GPLv3
##
import sys
import gfal2
parameter_type_error="not a valid parameter type"
parameter_type_error="impossible to set parameter properly..."
def get_parameter_from_str_list(str_value_list):
str_value_tab = str_va... |
import math
import random
def line(X, a, b):
return [a*x + b for x in X]
def sse(Y, Y_pred):
return sum([(y - y_pred) ** 2 for y, y_pred in zip(Y, Y_pred)])
def loss(Y, a, b, X):
return sse(Y, line(X, a, b))
def avg_loss(Y, a, b, X):
return math.sqrt(loss(Y, a, b, X) / len(X))
def average(X):
r... |
from django.shortcuts import render,redirect
from django.contrib.auth.models import User, auth
from django.contrib import messages
from .forms import UserRegistrationForm,UserUpdateForm,ProfileUpdateForm
from .models import Book
# Create your views here.
def register(request):
if request.method == 'P... |
from nltk import tokenize
import json
import itertools
from tensorflow.python.platform import gfile
import re
config = Choose_config.current_config['class']
# Special vocabulary symbols
_PAD = config._PAD
_GO = config._GO
_EOS = config._EOS
_UNK = config._UNK
_START_VOCAB = [_PAD, _GO, _EOS, _UNK]
PAD_ID = config.PA... |
import os
# Base directory location
BASE_DIR = os.getcwd()
# File locations
MEAL_LOC = os.path.join("data", "meals.csv")
ITEM_LOC = os.path.join("data", "cupboard.csv")
PRICE_LOC = os.path.join("data", "prices.csv")
DATA_LOC = os.path.join("data", "data.txt") |
import random
list=["stone","paper","scissor"]
chances=5
no_of_chances=0
computer_score=0
player_score=0
print(" WELCOME TO STONE : PAPER : SCISSOR")
print(" CHOOSE ANY \tStone \tPaper \tscissor")
# STARTING OF WHILE LOOP
while no_of_chances<chances:
player_inp=input(" Stone : Paper : Scissor")
comp_inp=r... |
# -*- coding: utf-8 -*-
__version__ = '0.1.1.dev'
__description__ = 'A Semantic UI theme for devpi'
|
# from zutils.utils import *
#
# if __name__ == '__main__':
# import numpy as np
# c1 = TaskRedis()
# c2 = TaskRedis('task2')
# s1 = TaskRedis()
# s2 = TaskRedis('task2')
#
# c1.set_task({'a': 1, 'b': np.zeros([1,1])})
# c2.set_task({'a': 1, 'b': np.zeros([2,2])})
#
#
# task = s2.get_tas... |
# coding=utf-8
"""
题目一:和为s的两个数字
输入一个递增排序的数组和一个数字s,在数组中查找两个数,使得它们的和正好是s。如果有多对数字的数组的和等于s,输出任意一对
"""
class Solution(object):
def find_numbers_with_sum(self, nums, target):
left = 0
right = len(nums) - 1
while left < right:
two_sum = nums[left] + nums[right]
if two_sum ... |
# -*- coding: utf-8 -*-
from django.conf.urls import url, include, patterns
from rest_framework import routers
from app.api.v1.fleet.views import FleetView
from app.api.v1.customer.views import CustomerView
from app.api.v1.rentacar.views import RentACarView
from app.api.v1.rentacar.views import RentACarGiveBack
from a... |
# -*- coding: utf-8 -*-
"""
Created on Fri Mar 5 17:38:13 2021
@author: anand
"""
# Importing necessary libraries
import numpy as np
import pandas as pd
from sklearn import svm
import matplotlib.pyplot as plt
import seaborn as sns; sns.set(font_scale = 1.2)
import quantstats as qs
# Importing the dat... |
import json
import os
import sys
import warnings
import deepsecurity as api
from deepsecurity.rest import ApiException
from datetime import datetime
from pprint import pprint
def format_for_csv(line_item):
"""Converts a list into a string of comma-separated values, ending with a newline character.
:param line... |
from User import User
import random
class Users:
database = ""
def __init__(self, database):
self.database = database
def users(self):
self.database.cursor.execute('''SELECT first_name, last_name, code FROM users''')
allrows = self.database.cursor.fetchall()
list_of_users... |
#! /usr/bin/python
print "I want to buy a new better keyboard,but my wife won't agree with it."
|
import os
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
from PIL import Image
from torch.utils.data import DataLoader, Dataset
from torchvision.datasets import MNIST
from torchvision.transforms import ToTensor
from squib.updaters.updater import S... |
import time,datetime
class InsuranceTime:
def nowtime(self):
nowtime=datetime.date.today()
return nowtime
def policyBeginDate(self,day):
return str(self.nowtime()+datetime.timedelta(days=day))+" 00:00:00"
def policyEndDate(self,day):
return str(self.nowtime()+datetime.timed... |
#!/usr/bin/env python
from useless.decorators import extends
__author__ = 'Ronie Martinez'
class Base1(object):
def __init__(self, value):
self.value = value
def double(self):
return self.value * 2
class Base2(object):
def __init__(self, value):
self.value = value
def doub... |
"""
This part generates the results, it launches an small interfase where the user has to write 1 to display results or q to quit.
Once all is launched, it returns to the menu.
Exception handling and input validation is done for each part.
IMPORTANT : The input MUST be in the same directory as this .py file
"""
__auth... |
#############################################################################
# Copyright (c) Members of the EGEE Collaboration. 2006-2010.
# See http://www.eu-egee.org/partners/ for details on the copyright holders.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except... |
class EnglishLength:
def __init__(self, yards=0, feet=0, inches=0):
self.__yards = yards + feet//3
self.__feets = feet + inches//12
self.__inches = inches%12
self.__feets%=3
def __add__ (self,other):
return (self.__inches + other.__inches, self.__yards + other.__... |
import doctest
import unittest
from zeam.form.ztk.testing import FunctionalLayer
def test_suite():
optionflags = doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS
globs= {}
suite = unittest.TestSuite()
for filename in ['bool.txt', 'choice.txt', 'collection_set.txt',
'collection_lis... |
import sys
import itertools
from tree import binary_tree
from collections import deque
#input params
input_list = [-3, -2, 1, 9, 5, -1, 11];
#input_list = [2, 1, 3];
tree = binary_tree(input_list);
print("LEVELS OF OUR TREE:");
tree.print_tree();
print("");
'''
SOLUTION: note that -
*everything on the same level can... |
# Add a Secret Key, and info from Facebook, Google, and GitHub.
# Social Logins won't work without your IDs and Secrets added.
SECRET_KEY = 'development key'
FB_APP_ID = 'Facebook App ID'
FB_APP_SECRET = 'Facebook App Secret'
GOOGLE_CLIENT_ID = 'Google Client Id'
GOOGLE_CLIENT_SECRET = 'Google Client Secret'
GITHUB_CLI... |
#!/usr/bin/env
# -*- coding: utf-8 -*-
__author__ = 'Vmture'
from com.common import CommonFunction
from com.re_rules import xiaomi_rules, message_kinds_xiaomi
import time
import re
com = CommonFunction()
name = '小米'
def get_update_messages():
update_datas = ''
update_messages = [str(time.ctime())]
datas ... |
"""ICMPv4 Objects Class."""
from fmcapi.api_objects.apiclasstemplate import APIClassTemplate
import logging
import warnings
class ICMPv4Objects(APIClassTemplate):
"""The ICMPv4Objects Object in the FMC."""
VALID_JSON_DATA = [
"id",
"name",
"type",
"overrideTargetId",
... |
import logging
import logging.handlers
log = logging.getLogger('myLogger')
log.setLevel(logging.INFO)
formatter = logging.Formatter('[%(levelname)s] (%(filename)s:%(lineno)d) > %(message)s')
fileHandler = logging.FileHandler('./log.txt')
fileHandler.setFormatter(formatter)
log.addHandler(fileHandler)
if __name__ == ... |
#!/usr/bin/env python
"""
Truncates the first and last a,b tokens from each line,
where a,b are arguments from sys.argv.
(The truncate_char.py on the other hand, truncates individual characters)
Strings are split into "tokens" use white-space as a delimiter.
"""
import sys
def main():
if (len(sys.argv) <= 1):
... |
# -*- coding: utf-8 -*-
import sys
sys.path.append('../../python')
import inject
import logging
from model.config import Config
''' configuro el injector con las variables apropiadas '''
def config_injector(binder):
binder.bind(Config, Config('firmware-config.cfg'))
inject.configure(config_injector)
import ca... |
from django.contrib import admin
# Register your models here.
from .models import Bid, Category, Comment, Listing, User, Watchlist
admin.site.register(Category)
admin.site.register(Listing)
admin.site.register(Bid)
admin.site.register(User)
admin.site.register(Watchlist)
admin.site.register(Comment)
|
"""
dictionary.py
NFL Head Coaches
"""
import sys
coaches = {
"Arizona Cardinals": "Bruce Arians",
"Atlanta Falcons": "Dan Quinn",
"Baltimore Ravens": "John Harbaugh",
"Buffalo Bills": "Sean McDermot",
"Carolina Pathers": "Ron Rivera",
"Chicago Bears": "John Fox",
"Ci... |
import time
import pyglet
import os
import webbrowser
def disp_start():
""" Display Information when program start
"""
ct = time.ctime()
print("Program Start at %s" % ct)
def disp_end():
""" Display Information when program end
"""
ct = time.ctime()
print("Program End at %s" % ct)
def run_app(path):
player ... |
import requests
import re, ast
import os, sys, shutil
from subprocess import call
import json, time
from zipfile import ZipFile, is_zipfile
# Files
folders = [r'results', r'results/temp']
for f in folders:
if not os.path.exists(f):
os.makedirs(f)
# find the data file, assign to 'dataIn' variable
allFiles ... |
"""
Game Version Info:
[Major build number].[Minor build number].[Revision].[Package]
i.e. Version: 1.0.15.2
Major build number: This indicates a major milestone in the game, increment this when going from beta to release, from
release to major updates.
Minor build number: Used for feature updates, large bug fixes ... |
import ipcalc
import netifaces
import netaddr
import socket
# import dpkt
from scapy.all import *
import scapy
from pprint import pformat
ipfile=open("errorIPsIn50K.txt", "r");
errorips1=ipfile.readlines();
# icmp3=open("icmp3.txt", "wb")
# icmp11=open("icmp11.txt", "wb")
# rst=open("rstips.txt", "wb")
ips=open('erri... |
def count_positives_sum_negatives(arr):
if not arr:
return []
count_num = 0
sum_of_num = 0
for element in arr:
if element > 0:
count_num += 1
elif element < 0:
sum_of_num += element
return [count_num, sum_of_num]
|
while True:
name= input("Nhap vao ten: ")
if name.isalpha() == True:
break
|
import unittest
from check_email import check_email
class Test(unittest.TestCase):
def test_basic_email_true(self):
#check "@"
self.assertTrue(check_email("username@domain.com"))
def test_basic_email_true(self):
#check "."
self.assertTrue(check_email("username@do.main.com"))
... |
# coding=utf-8
__author__ = 'Hanzhiyun'
def fibonacci(n):
terms = [0, 1]
i = 2
while i <= n:
terms.append(terms[i - 1] + terms[i - 2])
i += 1
return terms[n]
|
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import annotations
import json
import shlex
import unittest.mock
from contextlib import contextmanager
from enum import Enum
from functools import partial
from pathlib imp... |
#!/usr/bin/env python
"""
Typical usage:
amino_acid_energy.py [candidate.txt] < all_sequences.txt
In this example, "all_sequences.txt" contains a large list of sequences
from which the probability of each character appearing is determined.
The natural logarithm of the probability of each type of character
is ret... |
import re, numpy, os,operator,time,math
import matplotlib.pyplot as plt
from multiprocessing import Pool
from mpl_toolkits.mplot3d import Axes3D
def takeSecond(elem):
return (-elem.X,-elem.Y)
class Pop(object):
def __init__(self,X=[],Y=[],Z=[],Pressure=[],v=[],u=[],w=[] ) :
self.X=X
self.Y=Y
self.... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
from selenium_auto.test_windows_and_frame_locate.Base import Base
class TestWindows(Base):
def test_window(self):
self.driver.get("http://www.baidu.com")
self.driver.find_element_by_link_text("登录").click()
print(self.driver.current... |
import numpy as np
import math
import matplotlib as mpl
import matplotlib.pyplot as plt
"""
mpl.rcParams['font.sans-serif'] = [u'SimHei']
mpl.rcParams['axes.unicode_minus'] = False
mu = 0
sigma = 1
x = np.linspace(mu - 3*sigma, mu + 3*sigma, 51)
y = np.exp(-(x - mu) ** 2 / (2 * sigma **2)) / (math.sqrt(2 *... |
from django import forms
from django.contrib.auth.forms import AuthenticationForm
from .models import Profile, Neighborhood, Business ,Post
class ProfileForm(forms.ModelForm):
'''
Class to create a form for an authenticated user to update profile
'''
class Meta:
model = Profile
fields ... |
class Solution:
def maxProfit(self, prices: List[int]) -> int:
profits, lowest, highest, maxProfit = [], float('inf'), -float('inf'), 0
for p in prices:
if p < lowest:
lowest = p
maxProfit = max(maxProfit, p-lowest)
profits.append(maxProfit)
... |
import math
def main():
n, w, h = [int(s) for s in raw_input().split()]
d = math.sqrt(w**2 + h**2)
for _ in range(n):
l = input()
print 'NE' if l > d else 'DA'
if '__main__' == __name__:
main()
|
import test_path_setting
import torch
from models import lrcn
def lrcn_test(num_classes, parameter):
model = lrcn(num_classes, 60)
print(model)
if parameter:
for name, param in model.named_parameters():
print(name, end="")
print(":", param.numel())
total_params = sum(pa... |
# -*- coding: utf-8 -*-
"""GZip files."""
# Note: do not rename file to gzip.py this can cause the exception:
# AttributeError: 'module' object has no attribute 'GzipFile'
# when using pip.
import os
import zlib
from dtformats import data_format
from dtformats import errors
class GZipFile(data_format.BinaryDataFil... |
from django.urls import path, include
from . import views
urlpatterns = [
path('', views.home),
path('notify/', views.notify),
path('login/', views.login),
path('<int:id>/', views.post),
path('create/', views.create)
] |
from django.conf.urls import patterns, include, url
from rest_framework import routers
from .views import (
EquipoViewSet, ComentarioViewSet
)
router = routers.DefaultRouter()
router.register(r'equipos', EquipoViewSet)
router.register(r'comentarios', ComentarioViewSet)
urlpatterns = patterns('uthhconf.api.views',
... |
from django.http import HttpResponse
from django.shortcuts import render # this is used for getting attached html file
import operator
def Homepage(request):
return render(request,'home.html')# this is return html page and we can also pass python code here which is written on html file or as variable
def abo... |
"""
Unit test to make sure the test_grades function calculates score changes properly.
Author: kk3175
Date: 12/8/2015
Class: DSGA1007, Assignment 10
"""
import pandas as pd
from RestaurantInspectionData import RestaurantInspectionData
from unittest import TestCase
from datetime import datetime
class GradeScoresTest... |
# $Id: __init__.py,v 1.14 2012/11/27 00:49:40 phil Exp $
#
# @Copyright@
#
# Rocks(r)
# www.rocksclusters.org
# version 5.6 (Emerald Boa)
# version 6.1 (Emerald Boa)
#
# Copyright (c) 2000 - 2013 The Regents of the University of California.
# All rights reserved.
#
# Redistribut... |
import random
minNumber = 1
maxNumber = 6
rollAgain = "yes"
while rollAgain == "yes" or rollAgain == "y":
print("Rolling the dice...")
print("The values are {} and {}".format(random.randint(minNumber, maxNumber), random.randint(minNumber, maxNumber)))
rollAgain = input("Roll the dice again?")
else:
pr... |
'''
15. 3Sum
Given an integer array nums, return all the triplets [nums[i], nums[j], nums[k]] such that i != j, i != k, and j != k, and nums[i] + nums[j] + nums[k] == 0.
Notice that the solution set must not contain duplicate triplets.
Example 1:
Input: nums = [-1,0,1,2,-1,-4]
Output: [[-1,-1,2],[-1,0,1]]
Example... |
from flask import jsonify
from psycopg2 import IntegrityError
from datetime import datetime
from app.DAOs.EventDAO import EventDAO
from app.handlers.RoomHandler import RoomHandler
from app.handlers.TagHandler import TagHandler
from app.handlers.UserHandler import UserHandler
from app.handlers.WebsiteHandler import Webs... |
from email import encoders
from email.mime.base import MIMEBase
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from smtplib import SMTPException
from ldap3 import Server, Connection, core, SUBTREE
import configparser
import json
import os
import requests
import smtplib
import time
... |
from django.urls import path
from snippets import views
urlpatterns = [
path('snippets/', views.snippet_list),
path('snippets/<int:pk>/', views.snippet_detail),
path('snippetz/', views.SnippetList.as_view()),
path('snippetz/<int:pk>/', views.SnippetDetail.as_view()),
path('snippetzz/', views.Snip... |
from dataclasses import dataclass
from pathlib import Path
from typing import Any, Dict
from utils.files import PickleFile, TarFile
from utils.logger import logger
@dataclass
class ExperimentArtifacts:
run_tag: str
model_name: str
base_path: Path
def _create_if_not_exist(self):
Path(self.out... |
from settings import *
DEBUG = False
SITE_ROOT = ''
LOGIN_URL = SITE_ROOT + "/accounts/login/"
# Theme info
# LOCAL_STATICFILE_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__),
# '../../ODC-overlay/static'))
# LOCAL_TEMPLATE_DIR = os.path.abspath(os.path.join(os.path.dirna... |
from decouple import config
from django.contrib.sites.models import Site
from django.core.management import BaseCommand
from accounts.models.system_user import SystemUser
class Command(BaseCommand):
def handle(self, *args, **options):
self.generate_site_info()
self.stdout.write(self.style.SUCCES... |
from .system_user import *
|
# test 1
# 导入自己编写的文件
import pizza
pizza.make_pizza(16, 'pepperoni')
pizza.make_pizza(12, 'mushrooms', 'green peppers', 'extra cheese')
# test 2
# 导入特定函数
from pizza import make_pizza
make_pizza(17,'hello')
# test 3
# 导入函数并设置别名
import pizza as p
p.make_pizza(18,"as")
# test 4
# 导入模块中所有函数
from pizza import *
''... |
first_number = int(input('Enter first number: '))
second_number = int(input('Enter second number: '))
if first_number > second_number:
print('larger')
elif first_number < second_number:
print('smaller')
else:
print('equal')
|
import logging
import copy
import time
from spockbot.mcdata import blocks
from spockbot.plugins.base import PluginBase, pl_announce
from spockbot.plugins.tools.event import EVENT_UNREGISTER
from spockbot.vector import Vector3
from utils.constants import *
import utils.movement_utils as mov
import utils.camera_utils a... |
class CommentDemo:
"""
注释Demo,演示在类、方法、变量定义时,注释书写的位置
"""
list1 = ['test', 12, 45]
"""
定义变量
"""
def test(self, x, y):
"""
定义方法
"""
pass
|
# Generated by Django 2.1.3 on 2018-11-06 12:41
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0028_auto_20181107_0141'),
]
operations = [
migrations.AlterField(
model_name='receiver',
name='receiver_dev... |
from sqlalchemy.types import TypeDecorator, CHAR
from sqlalchemy.dialects.postgresql import UUID
import uuid
class GUID(TypeDecorator):
"""Platform-independent GUID type.
Uses PostgreSQL's UUID type, otherwise uses
CHAR(32), storing as stringified hex values.
"""
impl = CHAR
def load_dialect_impl(self,... |
# Generated by Django 2.1.3 on 2018-11-07 08:09
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0039_auto_20181107_2107'),
]
operations = [
migrations.AlterField(
model_name='location',
name='comment',
... |
coord_to_dir = {
(0,0): "C",
(0,1): "S",
(1,1): "SE",
(1,0): "E",
(1,-1): "NE",
(0,-1): "N",
(-1, -1): "NW",
(-1, 0): "W",
(-1, 1): "SW",
}
dir_to_coord = {
"C": (0,0),
"S": (0,1),
"SE": (1,1),
"E": (1,0),
"NE": (1,-1),
"N": (0,-1),
"NW": (-1, -1),
"... |
#!/usr/bin/python3
# coding=utf8
import sys
sys.path.append('/home/pi/ArmPi/')
import cv2
import time
import Camera
import threading
from LABConfig import *
from ArmIK.Transform import *
from ArmIK.ArmMoveIK import *
import HiwonderSDK.Board as Board
from CameraCalibration.CalibrationConfig import *
if sys.version_inf... |
from datetime import datetime
import pytest
from dates import _get_dates, convert_to_datetime, get_month_most_posts
@pytest.fixture(scope="module")
def dates():
return _get_dates()
@pytest.mark.parametrize("date_str, expected", [
('Thu, 04 May 2017 20:46:00 +0200', datetime(2017, 5, 4, 20, 46... |
import json
import requests
r = requests.get('https://api.github.com/events')
print(r.status_code)
print(r.__str__)
print(r.apparent_encoding)
print(r.headers)
v = 0
content = r.content
print(type(content))
for line in content:
if(v > 5):
break
print(str(line))
v += 1
r = requests.post('https://htt... |
print (50*101)**2 - sum([x**2 for x in xrange(1,101)])
|
from myhdl import *
from random import randrange
_code_git_version = "f114546e1715d9e5847695c64e486e6793ebb9ea"
_code_repository = "https://github.com/plops/cl-py-generator/tree/master/example/56_myhdl/source/run_00_flop.py"
_code_generation_time = "08:39:04 of Thursday, 2021-06-10 (GMT+1)"
def dff(q, d, clk):
@... |
from .forms import ElectionRemindersSignupForm, MailingListSignupForm
from .constants import MAILING_LIST_FORM_PREFIX, ELECTION_REMINDERS_FORM_PREFIX
def signup_form(request):
initial = {"source_url": request.path}
if MAILING_LIST_FORM_PREFIX in request.POST:
mailing_list_form = MailingListSignupForm... |
class Node:
left = None
right = None
value = 0
def __init__(self, data):
self.value = data
def Print(self, before):
if self.left != None and self.right != None:
print(before + "├── " + str(self.left.value))
self.left.Print()
print(before + "└──... |
# Generated by Django 2.1.2 on 2018-11-28 08:11
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('orders', '0007_auto_20181127_2315'),
]
operations = [
migrations.AddField(
model_name='order',
name='status_of_order... |
"""
This file contains the golden model for the quantized EEGNet in integer representation.
"""
__author__ = "Tibor Schneider"
__email__ = "sctibor@student.ethz.ch"
__version__ = "0.0.1"
__date__ = "2020/01/20"
__license__ = "Apache 2.0"
__copyright__ = """
Copyright (C) 2020 ETH Zurich. All rights reserved.
... |
DEFAULT_CONFIG_FILENAME = "art.yaml"
|
from django.contrib import admin
from app1.models import OtherUser, Category, Item, ItemImageAndVideos, Offers, Searches, Message, Notifications, ShipmentDetails, ContactUs
# Register your models here.
admin.site.register(OtherUser)
admin.site.register(Category)
admin.site.register(Item)
admin.site.register(ItemImageA... |
#!/usr/bin/python3
'''
Author : Sonal Rashmi
Date : 16/07/2020
Description : IPD Command Line Interface with two subparser long and short read.
'''
import argparse
import os
import sys
from commandlineparser import *
from ipdshortread import *
from ipdlongread import *
import pathlib
#Directory a... |
import requests
from urllib.parse import urljoin
class Buyer:
def __init__(self, url_prefix):
self.url_prefix = urljoin(url_prefix, "buyer/")
def getMemberInfo(self,username : str,token: str)->(str,str,str):
json = {"username": username}
headers = {"token": token}
url = urljoi... |
import json
from datetime import date
from decimal import *
from functools import cmp_to_key
from django.shortcuts import render
from django.contrib.auth.decorators import login_required
from django.views.decorators.http import require_http_methods
from .models import Wallet, Card
from django.http import Js... |
import turtle
def draw_triangle(some_turtle):
for i in range(1,4):
some_turtle.backward(100)
some_turtle.right(60)
some_turtle.right(60)
def draw_square(some_turtle):
for i in range(1,5):
some_turtle.backward(100)
some_turtle.left(90)
def draw_art(): ... |
#!/usr/bin/python
# -*- coding: cp936 -*-
""" clientTradeEventUtility.py
对db中clientTradeEvent表格进行数据处理
"""
import sqlite3
class clientTradeEventUtility:
'''
拿到有效交易的用户以及其有效交易的时间(进行最早交易的那一天)
@return: dictionary: {effectivekhcode: effectivetradedate}
'''
def geteffectiveTradeUsersAndDates(self):
... |
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
import time
from pwn import *
#context.log_level = 'debug'
elf = ELF('./3x17')
# Memory locations
fini_array = 0x4b40f0
__libc_csu_fini = 0x402960
elf_main = 0x401b6d
bin_sh = elf.bss()
# Gadgets
leave_ret = 0x401c4b
ret = 0x401016
pop_... |
# Setup
from __future__ import division, print_function, unicode_literals
import pickle
import numpy as np
import os
from sklearn.linear_model import SGDClassifier
from sklearn.model_selection import cross_val_score
from sklearn.model_selection import cross_val_predict
from sklearn.metrics import confusion_matrix
f... |
import threading
import time
import datetime
from django.conf import settings
from pack_llama import models
from request_service import Request
class PromiseService(object):
def __init__(self):
try:
self.__interval = settings.DB_CHECK_INTERVAL
except:
self.__interval = 30... |
def simple_assembler(program):
program = [x.split() for x in program]
output = {}
cmd = 0
while cmd < len(program):
if program[cmd][0] == 'mov':
try:
output[program[cmd][1]] = int(program[cmd][2])
except ValueError:
output[program[cmd]... |
from flask import Flask, render_template, jsonify, request,session,redirect,url_for
from models import *
import os
PEOPLE_FOLDER = os.path.join('static', 'img')
app = Flask(__name__)
# app.config["SQLALCHEMY_DATABASE_URI"] = r"postgres://qgorardefomjqz:ebcb07859a907fe7ab36b6738c6e8f4d475e6a5457a4d9c8be656c9350b45e29@... |
A=int(input("A= "))
#print(A%2!=0)
print((A%2)>0) |
import relative_imports.lcls2_pgp_pcie_app.axipcie as axipcie
axipcie.func()
|
import board
import neopixel
import time
pixels = neopixel.NeoPixel(board.D18, 20)
for i in range(10):
pixels[i*2] = (128,0,128)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.