text stringlengths 8 6.05M |
|---|
from .API import ManInTheMiddle
from .utils import RSA, color
from .client import EmulatedClient
from .server import HTTP, HTTPS, Interceptor
|
"""
Description:
Count the number of prime numbers less than a non-negative number, n.
"""
class Solution(object):
def countPrimes(self, n):
"""
:type n: int
:rtype: int
"""
if n <= 1: return 0
digits = [1]*n
digits[0] = digits[1] = 0
for ... |
import os
import sys
import datetime
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
import utils.anchors as l_anchors
import datasets as l_datasets
import losses as l_losses
import metrics as l_metrics
import models as l_models
import config as l_config
gpus = tf.config.experimental.list_... |
import unittest
import tempfile
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from autorank import *
pd.set_option('display.max_columns', 20)
class TestAutorank(unittest.TestCase):
def setUp(self):
print("In method", self._testMethodName)
print('------------------------... |
from flask import request
from schemas import CategoryTypeListSchema
from models import CategoryType, GenderEnum, Retailer, Category, db
from config import create_app
app = create_app()
@app.route('/')
def hello_world():
return 'Hello World!'
@app.route('/get_categories_type_list/')
def get_categories_type_lis... |
#!/usr/bin/env python
while True:
score=input('Enter the score for test: ')
if score == 100:
print 'The score is Super A.'
break
elif 100 > score >= 90:
print 'The score is A.'
break
elif 90 > score >= 80:
print 'The score is B.'
break
elif 80 > score >= 70:
print 'The score is C.'
break
elif 70 ... |
def unique_in_order(iterable):
answer = []
for item in iterable:
if(len(answer) == 0 or answer[len(answer)-1] is not item):
answer.append(item)
return answer
print(unique_in_order('AAAABBBCCDAABBB'))
print(unique_in_order('ABBCcAD'))
print(unique_in_order([1,2,2,3,3]))
print(unique_in_o... |
from myhdl import *
DATA_WIDTH = 32768
def Jpeg(
#ToSPieceOut,
#ToSMaskOut,
#PieceIn,
#MaskIn,
MaskReset,
#Enable,
PushPop,
Reset,
#Clk,
clk_fast,
DEPTH = 16
):
"""Stack module in MyHDL
This the MyHDL RTL code for the Stack module. It
can be converted to V... |
#!/usr/bin/env python3
'''
Uses selenium to grab how long it takes to complete a game(named game is grabed from command line)
from the website "https://www.howlongtobeat.com/"
'''
import sys
import selenium
from selenium.webdriver.common.keys import Keys
from selenium import webdriver
from selenium.webdriver.commo... |
class LRU_Cache(object):
def __init__(self, capacity):
# Initialize class variables
self.capacity = capacity
self.cache = dict()
self.lru_key_cache = dict()
self.use_rate = 0
def get(self, key):
# Retrieve item from provided key. Return -1 if nonexistent.
... |
from flask import Flask
from flask_cors import CORS
import psutil
import collections
import json
import atexit
import subprocess
from flask import jsonify
from apscheduler.schedulers.background import BackgroundScheduler
LENGTH = 20
INTERVAL = 5
cpuhist = collections.deque(maxlen=LENGTH)
ramhist = collections.deque(m... |
from Pages.MediaPages.Media import Media
from selenium.webdriver.common.by import By
from magic_box.find_elements import find_element
from selenium.webdriver.support.ui import Select
from Pages.MediaBrowser import MediaBrowser
from selenium.webdriver import ActionChains
import pytest
class ShowcaseCardMedia(Media):
... |
# -*- coding: utf-8 -*-
"""
Created on Fri Jan 29 19:19:45 2021
Author: Josef Perktold
License: BSD-3
"""
import numpy as np
from . import transforms
class ArchimedeanCopula(object):
def __init__(self, transform):
self.transform = transform
def cdf(self, u, args=()):
'''evaluate cdf of mu... |
def no_dups(string):
storage = dict()
# Loop over the input string, assign each word in the string to a dictionary key
for word in string.split():
if word not in storage: # [ cats, dogs, fish, ]
storage[word] = 1
elif word in storage:
storage[word] += 1
result ... |
#import sys
#input = sys.stdin.readline
def main():
N, K = map( int ,input().split())
A = list( map(int, input().split()))
dp = [False]*(K+1)
for i in range(A[0],K+1):
for a in A:
if a > i:
break
dp[i] |= not dp[i-a]
if dp[K]:
print("First")
... |
import pygame
from Settings import *
from Object import Button, Textbox
from Algorithm import faceDetection, findSimilarFaces, match, getInfo
import urllib
import io
import numpy as np
#The general template is by Lukas Pereza, from Pygame Manual
#https://qwewy.gitbooks.io/pygame-module-manual/chapter1/framework... |
s = 'Created by Varun'
print('Initializing the module')
def sum2(x,y):
return pow(x,2) + pow(y,2)
def sum3(x,y):
return pow(x,3) + pow(y,3)
if __name__ == '__main__':
assert sum2(2,2) == 8
print('Testing is fine')
|
x=int(input())
a=[]
count=0
if(6<x<32767):
p=[True]*x
p[0]=p[1]=False
for i in range(2,x):
if (p[i]):
for j in range(2,int(x/i)):
p[i*j]=False
for i in range(0,x):
if (p[i]):
a.append(i)
for i in a:
if (i<x and x-i<=i and p[x-i] ):
... |
a=int(input())
b=input().split()
c=0
i=0
while i<len(b):
j=i+1
while j<len(b):
if int(b[i])<int(b[j]):
c+=1
j+=1
i+=1
print(c)
|
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data as Data
from torch.nn import init
import torch.optim as optim
from collections import OrderedDict
import torchvision as tv
import torchvision.transforms as transforms
import numpy as np
import matplotlib.pyplot as plt
import time... |
# encoding: utf-8
'''
Created on 2018年3月23日
@author: wangs0622
question: 剑指 offer 17 题,打印从 1 到最大的 n 位数
输入的数字为 n,按顺序打印从 1 到最大的 n 位十进制数。
'''
from collections import deque
def printAllNumber(N):
'''
: 我自己写的程序,用列表来表示每一个元素
'''
if N <= 0: return
number_list = deque([0])
while len(number_list) <= N... |
import itertools
# https://en.wikipedia.org/wiki/Polygonal_number
def P(s, n): # Return the nth polygonal number with s sides
return n*(n-1)*(s-2)//2+n
def invP(s, x): # Find if x is a polygonal number with s sides
return ((8*(s-2)*x+(s-4)**2)**.5+(s-4))//(2*s-4) % 1 == 0
def getValidPoly(s):
x, n = 1, 1
... |
'''
Problem: Denoising of position-specific scoring matrices (PSSMs)
A protein consists of a linear sequence of amino acid residues.
Briefly, a PSSM of a protein contains the statistics of mutations of amino acid residues of the protein encountered in nature.
These statistics may be "corrupted" (noisy), The task was... |
from django.shortcuts import render_to_response
from django.template import RequestContext
def index(request):
return render_to_response("core/index.html", {}, context_instance=RequestContext(request))
def help(request):
return render_to_response("core/help.html", {}, context_instance=RequestContext(request))
def ... |
#talnabil
def talnabil(start,stop):
for tala in range(start,stop+1):
print(tala)
fyrri = int(input("hvar byrjar bilið? "))
seinni = int(input("Hvar endar bilið? "))
talnabil(fyrri, seinni)
|
#!/usr/bin/python
import sys
oldKey = None
totalSize = 0
qSize = 0
totalCount = 0
# Loop around the datas.
for line in sys.stdin:
data = line.split("\t")
if len(data) < 3:
continue
recordType = data[1].strip()
thisKey = data[0].strip()
# Set oldKey when first record is encountere... |
import requests
from tqdm import tqdm
to_download = list()
with open("need_open_issues.txt") as input_file:
for line in input_file:
to_download.append(line.rstrip().replace("_", "/", 1))
output = open("project_to_times_second_round.txt", "w+")
for i in tqdm(range(len(to_download))):
element = to_downl... |
'''
#=============================
#1---cookies
import requests
response = requests.get("https://www.baidu.com")
print(response.cookies)
print(response.cookies.items())
for key, value in response.cookies.items():
print(key + '='+value)
#=============================
#2---回话维持
#cookies的主要作用就是登陆网址用的
import reques... |
from onegov.recipient.collection import GenericRecipientCollection
from onegov.recipient.model import GenericRecipient
def test_recipient_model_order(session):
session.add(GenericRecipient(
name="Peter's Url",
medium="http",
address="http://example.org/push",
extra="POST"
))
... |
from django.shortcuts import render
def index(request):
return render(request, 'chat/index.html')
def room(request, room_name, username):
context = {
'room_name':room_name,
'username':username,
}
return render(request, 'chat/room.html', context)
|
# Generated by Django 2.2.3 on 2019-08-26 17:41
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('productlist', '0015_addcart'),
]
operations = [
migrations.DeleteModel(
name='addcart',
),
]
|
class Solution(object):
def findMin(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
if nums[0]<=nums[len(nums)-1]:
return nums[0]
def searchBin(vals, start, end):
if end<=start:
return None
... |
from spotify.objects.base import Descriptor, PropertyProxy
import logging
log = logging.getLogger(__name__)
class Subgenre(Descriptor):
name = PropertyProxy
key = PropertyProxy
type = PropertyProxy
@staticmethod
def __parsers__():
return [Tunigo]
class Tunigo(Subgenre):
__tag__ = ... |
from django.conf import settings
from django.conf.urls.static import static
from django.urls import path
from . import views
app_name = 'product'
urlpatterns = [
path('add-product/', views.add_product, name='add_product'),
] |
class Kettle:
power_source = "electricity"
def __init__(self, make, price):
self.make = make
self.price = price
self.on = False
def switch_on(self):
self.on = True
class Haha:
def echo(self):
print("hahahhaha")
kenwood = Kettle("Kenwood", 8.99)
p... |
#
class TreeState:
EXPANDED = 1
COLLAPSED = 2
NOTEXPANDABLE = 3
class TreeViewNode:
def __init__(self, data=''):
self.data = data
#self.state = TreeState.COLLAPSED
self.state = TreeState.EXPANDED
self.children = []
self.address = []
|
#!/usr/bin/python
import argparse
import pandas as pd
import numpy as np
from Bio import SeqIO
from itertools import permutations
codon_tuples = [('Phe', 'TTT'), ('Phe', 'TTC'), ('Leu', 'TTA'), ('Leu', 'TTG'),
('Tyr', 'TAT'), ('Tyr', 'TAC'), ('ter', 'TAA'), ('ter', 'TAG'),
('Leu', 'CTT'), ('Leu', 'CTC')... |
#!/usr/bin/env python
import re
import sys
indent = re.compile("\n\t")
single_newline = re.compile('\n(?!\n)')
chat_log_line = re.compile('\n(?=<.*>)')
qa_line = re.compile('\n(?=A:|Q:)')
text = ''.join(sys.stdin.readlines())
text = qa_line.sub('\n\n', text)
text = chat_log_line.sub('\n\n', text)
text = indent.sub("... |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
from vasp.parser.band_structure import BandStructure
import click
import matplotlib.pyplot as plt
@click.command()
@click.help_option('-h', '--help')
@click.argument('outcar')
@click.option(
'-t', '--title',
help='Plot title',
default=''
)
@click.option(
... |
"""
Listen to CloudTrail Glue events, and create a Kinesis Firehose for each new Glue table created
"""
import os
import json
import logging
from datetime import datetime
import backoff
import boto3
import botocore
from aws_xray_sdk.core import patch_all, xray_recorder
from lib.decorators import kinesis_handler
from ... |
def next_number(s):
result = []
i = 0
while i < len(s):
count = 1
while i + 1 < len(s) and s[i] == s[i + 1]:
i += 1
count += 1
result.append(str(count) + s[i])
i += 1
return ''.join(result)
# print(next_number("1211"))
# s = "1"
# n = 4
# for i i... |
class Plant1:
def __init__(self):
self.id_num = 1
self.kingdom = 'Plant'
self.age = 0
self.size = 1000
self.energy = 10000
self.soil =0
self.nitrogen = 0
self.water = 0
self.co2 = 0
self.oxygen =0
self.sun_energy = 0
sel... |
# -*-coding:Latin-1 -*
# importation du module OS
import os
# On import le module
from hello_world import*
# on lance la function du module
print_hello_world()
# On demande au système de faire pause a la fin de l'exécution
os.system("pause") |
#!/usr/local/env python3
from argparse import ArgumentParser
from multiprocessing import cpu_count
from primer_finder_methods import Methods
from glob import glob
from shutil import rmtree
from random import randint
from psutil import virtual_memory
import os
import pandas as pd
class PrimerFinder(object):
def _... |
# !/Users/ajh59/anaconda3/bin/pip install git+https://github.com/pwdyson/inflect.py
#----
#inflect.py modifiers
#Mappings based on https://github.com/pwdyson/inflect.py
from pandas import isnull, to_datetime
import time
import inflect
p = inflect.engine()
def ordinal(text, *params):
return p.ordinal(text)
def... |
import unittest
from unittest.mock import Mock
from embedded import EmbeddedRuntime
from hardware.camera import Photo, Resolution
from prediction.prediction import TrashClassified
from presentation.led_panel import LedPanel
from tests import factory
class EmbeddedRuntimeTest(unittest.TestCase):
def test_local_p... |
# -*- coding: utf-8 -*-
"""
Created on Thu Jun 30 15:25:06 2016
@author: foos
"""
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import sys
import os
import glob
import numpy as np
# case where file are .HKL from XSCALE (typical output of GA grouping step)
maninput_files = []
for arg in sys.... |
import pyHook, pythoncom, sys, logging,urllib,os
import time, pyautogui
from threading import Thread
file_log = open('Tracketlog.txt', 'a')
def OnKeyBoardEvent(event):
try:
file_log = open('Tracketlog.txt', 'a')
key = event.Ascii
'''if(event.Ascii!=0):
if(event.Asc... |
from datetime import datetime
from django.contrib.auth import login, logout
from django.contrib.auth.decorators import login_required
from django.contrib.auth.forms import AuthenticationForm
# Create your views here.
from django.contrib.auth.mixins import LoginRequiredMixin
from django.contrib.auth.models import User
... |
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import os
import pickle
from tensorflow.keras.utils import to_categorical
from tensorflow.keras.applications import VGG16, InceptionV3
from tensorflow.keras.applications.resnet_v2 import ResNet50V2
from tensorflow.data.expe... |
""" Module responsible for providing control of the camera which the system will use. """
import time
import numpy as np
import cv2
from PyQt5 import QtCore
__author__ = 'Curtis McAllister'
__maintainer__ = 'Curtis McAllister'
__email__ = 'mcallister_c20@ulster.ac.uk'
__status__ = 'Development'
class Camera(QtCore.Q... |
from flask_login import UserMixin, LoginManager, current_user, login_user, login_required
from flask import Flask, request, render_template, redirect, flash, url_for
from flask_sqlalchemy import SQLAlchemy
from werkzeug.security import generate_password_hash, check_password_hash
import json
from flask_login import User... |
#oef6
string1 = input("Geef een naam op, schrijf deze met een hoofdletter: ")
string2 = input("Geef dezelfde naam op, schrijf deze zonder hoofdletter: ")
if (string1 == string2):
print("Python is niet hoofdlettergevoelig.")
else:
print("Python is hoofdlettergevoelig.") |
import itertools
from utils import *
ids = ['314771692']
def is_symbol(s):
return isinstance(s, str) and s[:1].isalpha()
def dissociate(op, args):
"""Given an associative op, return a flattened list result such
that Expr(op, *result) means the same as Expr(op, *args).
>>> dissociate('&', [A & B])
... |
default_app_config = 'sermons.apps.SermonsConfig'
|
class ActivationRecord(object):
def __init__(self, name, type_of, nesting_level):
self.name = name
self.type = type_of
self.nesting_level = nesting_level
self.members = {}
self.return_value = None
def __setitem__(self, key, value):
self.members[key] = value
... |
__all__ = ['UserView', 'GetUsersView', 'GroupViewset']
from django.contrib.auth.models import Group
from api.serializers import GroupSerializer
from rest_framework import viewsets, views
from rest_framework.permissions import IsAuthenticated, AllowAny
from rest_framework.parsers import JSONParser
from rest_framework.r... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2019-04-24 09:58
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('blog', '0003_auto_20190424_1436'),
]
operations = [
migrations.AlterField(
... |
binance_api_key = "<INSERT_HERE>"
binance_api_secret = "<INSERT_HERE>"
|
import boto3
import os
import logging
from crhelper import CfnResource
from botocore.exceptions import ClientError
logger = logging.getLogger(__name__)
helper = CfnResource(json_logging=False, log_level='INFO', boto_level='CRITICAL')
try:
## Init code goes here
pass
except Exception as e:
helper.init_fail... |
# Generated by Django 2.0.5 on 2020-01-02 09:42
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('task_management', '0002_auto_20200102_1454'),
]
operations = [
migrations.RemoveField(
model_name='tasklist',
name='updated_... |
#List alternate max and min
import math
def alterNate(arr):
n = len(arr)
arr.sort()
for i in range(1 , math.ceil((n + 1) / 2)):
print(i , 2 * i - 1)
x = arr[-1]
arr.pop()
#arr[2 * i - 1] = x
prin... |
# -*- coding: utf-8 -*-
"""
Created on Sun Jul 7 15:27:09 2019
@author: RobertWinslow
"""
data = """Alabama, 95.7, 9.5, 0.028, −11.9, 0.004, 1.3
Alaska, 99.0, 6.1, 0.047, −0.8, 0.006, 3.3
Arizona, 97.4, 11.0, 0.032, −1.1, 0.005, 4.3
Arkansas, 97.5, 6.8, 0.027, −14.3, 0.005, 3.0
California, 95.5, 10.6, 0.040, 4.9, 0.... |
# 최솟값 구하기
arr = [5, 3, 7, 9, 2, 5, 2, 6]
# 가장작은 숫자가 저장될 변수 지정
arrMin = float('inf') # 파이썬에서 가장 큰값으로 저장하여 초기화
for i in range(len(arr)):
if arr[i] < arrMin:
arrMin = arr[i]
print(arrMin) |
class LanguageNotConfiguredError(Exception):
send_exec_as_response = True
|
import torch
import torch.nn as nn
import numpy as np
import random
import cv2
from utils import initialize
class Net(nn.Module):
def __init__(self, s_dim, a_dim):
super(Net, self).__init__()
self.s_dim = s_dim
self.a_dim = a_dim
self.cnn = nn.Sequential(
nn.Conv2d(i... |
import subprocess
from subprocess import PIPE
from concurrent import futures
A = []
def test(index):
if index%10 == 0:
print(index)
cmd = "cargo run --release --bin tester in/" +"{:0>4d}".format(index)+ ".txt cargo run --bin a"
proc = subprocess.run(cmd, stdout=PIPE, stderr=PIPE, shell=True)
... |
####setup####
#fb
FB_USERNAME = 'username'
FB_PASSWORD = 'password'
#source
GROUP = ['1035597676524401', '1482220008675596', '132883360033', 'DanseursDisponibles', 'dedanseuradanseur', '387335561366945', '519113364957271', '615272628502151', '131294164200737']#get username in the member of the group and who have pos... |
# from selenium import webdriver
# import time
# driver = webdriver.Chrome()
# driver.get('http://192.168.1.22:20004/#/passport/login')
# time.sleep(2)
# driver.find_element_by_xpath('//button[@type="submit"]').click()
# time.sleep(3)
# driver.find_element_by_xpath('//span[text()="系统管理"]').click()
# time.sleep(3)
# dri... |
#!/bin/env python
import os, sys
sys.path.insert(0, '/nfs/lhcb/malexander01/charm/baryon-lifetimes-run-I/')
from baryondata import *
from pyroot import *
def check_dec_sel(mother, bachelor) :
f, t = mc_file(mother, bachelor)
t.Draw(triggerDecSel, stripping_sel(mother, bachelor))
def check_dec_sel_realdata(mo... |
from django.test import TestCase
from backend.user_service.user.domain.user import User
from backend.user_service.user.domain.driver import Driver
from backend.group_service.group.domain.group import Group
class GroupTestCase(TestCase):
def test_group(self):
mockUser = User()
mockDriver = Driver... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function
import sys
from parglare.termui import s_attention as _a
if sys.version < '3':
text = unicode # NOQA
else:
text = str
class Location(object):
"""
Represents a location (point or span) of the object in the source code.
... |
import wx
import os
class NewFileDialog(wx.Dialog):
def __init__(self, okayhandle, cancelhandle, ide):
# begin wxGlade: MyDialog3.__init__
## kwds["style"] = wx.DEFAULT_DIALOG_STYLE
wx.Dialog.__init__(self, ide, style=wx.DEFAULT_DIALOG_STYLE)
self.bitmap_button_1 = wx.BitmapB... |
# n! means n × (n − 1) × ... × 3 × 2 × 1
# For example, 10! = 10 × 9 × ... × 3 × 2 × 1 = 3628800,
# and the sum of the digits in the number 10! is 3 + 6 + 2 + 8 + 8 + 0 + 0 = 27.
# Find the sum of the digits in the number 100!
def factorial(x):
result = 1
for i in range(1, x+1):
result = result * i
... |
# Copyright 2017 - The Android Open Source Project
#
# 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 ... |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... |
# coding=utf-8
import wx
import time
import threading
import C2B
import tempfile
import cv2
import addSPN
import shutil
import process
import Score
import os.path as path
import datetime
def addlog(msg):
"""
打印log方法
:param msg:
:return:
"""
def annofunc(func):
def inne... |
from django.shortcuts import render, get_object_or_404, render_to_response
from django.utils.translation import ugettext_lazy as _, ugettext
from django.contrib import messages as flash_messages
from django.http.response import HttpResponse, HttpResponseRedirect
from django.views.generic.edit import CreateView,... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2017-04-15 20:25
from __future__ import unicode_literals
import datetime
from django.db import migrations, models
from django.utils.timezone import utc
class Migration(migrations.Migration):
dependencies = [
('portfolio', '0001_initial'),
]
o... |
students = ["wenty", "kekek", "suci", "rini"]
for student in students:
print(student)
|
import sys
import os
#input a file
if len(sys.argv) == 0:
print sys.argv
print "no file input"
else:
fi = open("Arquivos/IMG.txt","rb")
infile = bytearray(fi.read()) #turn input into arrays of bytes
size = len(infile) #size of the bytes array
#print "before ... |
## TLS Motion Determination (TLSMD)
## Copyright 2002-2005 by TLSMD Development Group (see AUTHORS file)
## This code is part of the TLSMD distribution and governed by
## its license. Please see the LICENSE file that should have been
## included as part of this package.
import os
import sys
import subprocess
import t... |
#!/usr/bin/env python
# coding: utf-8
# Copyright 2013 The Font Bakery 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/LIC... |
import contextlib
import os
import subprocess
import time
import unittest
from choose_port import choose_port
from common import mock_client, QUANTUM_SECONDS, BINARY_PATH
PLAYER_HOSTNAME = b"mojavm"
MASTER_PATH = os.path.join(BINARY_PATH, "master")
class Master(subprocess.Popen):
def __init__(self, args=(), por... |
#!/usr/bin/python3
import basics
class Class:
def __init__(self, type):
self.type = type
def get_class_average(self):
# Simple division to get a class average
if self.type == "uncategorized":
try:
self.class_average = round(self.points_achieved / self.po... |
/home/ochir/regular/102/C.py |
from django.test import TestCase
from backend.carpool_request_service.carpool_request.app.\
carpool_request_application_service \
import CarpoolRequestApplicationService
from backend.user_service.user.domain.user import User
from backend.user_service.user.domain.rider import Rider
class CarpoolRequestApplic... |
import numpy as np
import pandas as pd
from numpy import *
import matplotlib.pyplot as plt
import matplotlib.animation as ani
from matplotlib.animation import FuncAnimation
import matplotlib.animation as animation
freq = array([4.040, 3.760, 3.600, 3.030, 2.560, 1.000])
voltage = array([-158.594, -120.000, ... |
#!/usr/bin/python
"""
Query domain using AENS
Author: John Newby
Copyright (c) 2018 aeternity developers
Permission to use, copy, modify, and/or distribute this software for
any purpose with or without fee is hereby granted, provided that the
above copyright notice and this permission notice appear in all
copies.
T... |
"""initial_db
Revision ID: 948d8e6d3f83
Revises:
Create Date: 2019-01-10 15:53:34.778442
"""
from alembic import op, context
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '948d8e6d3f83'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
schema_upgrades()
... |
#coding=utf-8
import Datastores
import DB
if __name__ == '__init__':
DB.CreateGroupType('default','A blank test group type')
DB.CreateGroup(1, 'lol', 'pies', 0)
DB.CreateModule(1, 'rofl','šopter')
DB.CreateUser(1, 1, 'Herp Derpington')
pass
|
import json
import os
import transaction
def test_principal_app_cache(election_day_app_zg):
assert election_day_app_zg.principal.name == "Kanton Govikon"
election_day_app_zg.filestorage.remove('principal.yml')
assert election_day_app_zg.principal.name == "Kanton Govikon"
def test_principal_app_not_exist... |
"""
comment
"""
from markov_python.cc_markov import MarkovChain
import fetch_data
link='http://www.e-reading.club/bookreader.php/1020088/Fomina_-_Pritchi._Daosskie%2C_kitayskie%2C_dzenskie.html'
#link='http://www.krotov.info/acts/01/joseph/filon_02.htm'
vocabul=fetch_data.load_web_to_text(link,'voc.txt')
print type... |
import os
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
os.chdir("F:\Rohan\data science\python")
bank=pd.read_csv("PL_XSELL.csv")
bank.head()
bank.info()
bank.TARGET.value_counts()
bank['FLG_HAS_CC']=bank['FLG_HAS_CC'].astype(str)
bank['FLG_HAS_ANY_CHGS']=bank['FLG_HAS_ANY_CHGS'].asty... |
# -*- coding: utf-8 -*-
'''
matriz = []
filas = raw_input('FILAS:_')
columnas = raw_input('COLUMNAS:_')
contador = 0
for i in range(int(filas)):
fila = []
for j in range(int(columnas)):
fila.append(contador)
contador = contador + 1
matriz.append(fila)
for i in matriz:
print i
'''
'''
matriz = []
tam = int(... |
import os
from flask import Blueprint, render_template, url_for, flash, redirect, request, abort
from flask_login import current_user, login_required
from flask_mail import Message
from gemlibapp import db, bcrypt, mail
from gemlibapp.models import BookList, BookStatus, credentials
from gemlibapp.booklist.forms import ... |
"""
Your task is to find the angle of the sun above the horizon knowing the time of the day.
Input data: the sun rises in the East at 6:00 AM, which corresponds to the angle of 0 degrees.
At 12:00 PM the sun reaches its zenith, which means that the angle equals 90 degrees.
6:00 PM is the time of the sunset so the an... |
# For Loop Counter
print "Counting from 0 to 9\n"
for i in range(10):
print i
print "Counting down from 10\n"
for i in range (10, 0, -1):
print i
print "Counting up by 2's\n"
for i in range (0, 10, 2):
print i
print "Print Hi 10 times:\n"
for i in range (10):
print "Hi"
raw_input("\n... |
from os.path import join
import pandas as pd
# import os
import matplotlib.pyplot as plt
from joblib import dump
# import numpy as np
from time import time
# import matplotlib.pyplot as plt
from pca.PCA import PCA
from pca.viz import scree_plot
from pca.rank_selection.noise_estimates import estimate_noise_mp_quantile
... |
import trans
import os
from multiprocessing import Process, Pool, Queue
import mmap
from arguments import get_args
def writeToBin(name, strbuf):
with open(name, 'r') as csv:
line = csv.readlines()
with open(name.replace('csv','bin'), 'wb') as binary:
binary.write(trans.str2b... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.