index int64 0 1,000k | blob_id stringlengths 40 40 | code stringlengths 7 10.4M |
|---|---|---|
987,400 | 9bae0801869c41a282d39f3b9d49d58c04e70ffb | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'IPSettings.ui'
#
# Created by: PyQt5 UI code generator 5.14.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_IPSetting(object):
def setupUi(self, IPSetting):
IPSet... |
987,401 | e2bf25ea37337ce47743fe2309aee074772eb02e | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import gzip
import os
import sys
import numpy
from six.moves import urllib
from six.moves import xrange
import tensorflow as tf
import Model_helper as helper
modelName = "./Color/weights/depthwise3unpool.pd"... |
987,402 | 870db5a0d849f566410815eddf4291b204bbe85c | #!/usr/bin/env python3
#-*- coding:utf-8 -*-
import torch
import torch.nn as nn
from IPython import embed
class AnomalyLoss(nn.Module):
def __init__(self, weights = [1.0, 1.0], regular = 1.0, use_gpu = True):
super(AnomalyLoss, self).__init__()
weights = torch.tensor(weights, ... |
987,403 | fd7e0da06790657871d292a7b1e6c846b504c5a9 | # Copyright 2018 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 agreed ... |
987,404 | fad1419d6e1b6a86d3051a0fa3e2ed64564d290d | from .AbstractSensorController import AbstractSensorController
|
987,405 | 5ec71e68d187539e16aba07f323ce25d5165bc29 | def merge_temp_files(self):
"""Merge temporary files
"""
#merging NASTRAN and GENESIS .dat files
self.genesisfile.close()
self.genesisfile = open(self.genesisfile.name, 'r')
genfile = self.genesisfile
genesislines = genfile.readlines(1000000000)
if not genesislines:
print 'GENES... |
987,406 | 517183437cbb24f669abee9fa64111c6cb9b0d32 | '''
Pradeepti Tandra
CS5001 Fall 2020
HW 1 - ATM
'''
def main():
# obtaining input from user
money = int(input("Welcome to PDQ Bank! How much to withdraw?: "))
FIFTIES = money // 50
TWENTIES = (money - (FIFTIES * 50)) // 20
TENS = (money - ((FIFTIES * 50) + (TWENTIES * 20))) // 10
FI... |
987,407 | eae5a8e91fb916a9c1922965d1b1025eef3258a8 | import numpy as np
import random
from numpy import random as rm
import matplotlib.pyplot as plt
def generate_arriving(num_people, top_floor):
people_arriving_time_dict = {}
people_arriving_time = []
rm.seed = 666
# people will arrive between 0-2700 interation (say 3 hours 8:00-11:00 in morning), ... |
987,408 | cd5e11a7b49a676a20bac2b31243d2fd91833a1a | me0 = "Utils"
import numpy as np
import os, time, subprocess
from datetime import datetime
"""
NAME
Utils.py
PURPOSE
Supporting functions for kinetic proofreding project.
EXECUTION
None
"""
##================================================
## PLOTTING
##================================================
fs = {"fs... |
987,409 | cbc91b879f032cf3d7a1684242753f8bd6d90002 | users={
1000:{'empid':1000,'empname':'ajay','job':'developer','sal':25000},
1001:{'empid':1001,'empname':'ram','job':'developer','sal':20000},
1002:{'empid':1002,'empname':'arun','job':'qa','sal':3000},
1003:{'empid':1003,'empname':'nithin','job':'qa','sal':15000}
}
def valid(**kwargs):
user=kwarg... |
987,410 | 0b2c2e57ba77e6a89de67eca6757957fbf540e31 | from typing import List
import discord
import yaml
from src.models.role import Role
from src.models.temp_ban import TempBan
from src.utils.api_manager import APIManager
from src.utils.embeds_manager import EmbedsManager
from src.utils.permissions import PermissionChecker
async def unbantemp_member(client: discord.C... |
987,411 | 37196ee2140d9cded7c857910549c1600a7b47a1 | # 伪私有属性和私有方法
"""
在Python 中,并没有真正的私有
在级属性,方法命名时,实际是对名称做了一些特殊处理,使得外界无法访问到
处理方式:在名称前面加上: 定义__类名, 调用:_类名__名称
"""
class Women:
def __init__(self, name):
self.name = name
self.__age = 18 # 私有
def __secret(self):
return self.__age
if __name__ == '__main__':
rose = Women('rose')
... |
987,412 | 5b8aac3c806b30986204bf112a8891cf07804ddd | import math
def is_prime4(n=1013):
if n<2:
return False
if n==2:
return True # 2 is prime
if n%2 ==0:
print(n, "is divisable by 2")
return False
m = math.sqrt(n)
#print ("using sqrt m is: ",m)
m = int(m)+1
#print("m+1 is : ",m)
for x in range(3... |
987,413 | e0b4ef78644c6dd4b3802a18d8aeafe7b0add7cb | class Event:
def __init__(self, request):
self.account = request['AccountSid']
self.from_ = request['From']
self.to = request['To']
try:
self.from_city = request['FromCity']
except KeyError:
self.from_city = None
try:
self.from_st... |
987,414 | e950e66a848d21d42476f839bd439950eeb8c1b2 | from django.urls import path
from . import views
urlpatterns = [
path('submit/<str:refreshToken>/', views.submit, name='admin_submit'),
path('officer_submit/<str:refreshToken>/', views.officer_submit, name='officer_submit'),
path('officer/<str:refreshToken>/', views.officer, name='officer_reports'),
path('admi... |
987,415 | b6e7732aa787e93c5d5c1f1978da0bfa1b891cb0 | nome = input()
notaAntiga = float(input())
notaNova = float(input())
nomesTransc=[]
notasTransc=[]
with open('ex4.txt', 'r') as f:
nomeFile = f.readline()
notasArrFile = list(map(float, f.readline().split()))
while nomeFile != '' and notasArrFile != '':
if nome == nomeFile[:len(nomeFile)-1]:
for i in ... |
987,416 | 34a345d5cbdd566ea7a9e88db67383a5719208ed | from django.conf.urls.defaults import *
from django.core.urlresolvers import get_callable
from django.core.urlresolvers import RegexURLPattern
from lithium.conf import settings
from lithium.views.date_based import *
from lithium.blog.models import Post
from lithium.blog.feeds import LatestPosts, LatestPostsByTag, Late... |
987,417 | 17a2fa9d37f9287f9ac59bd51fb7bf08f0df55f5 | import math
import random
import sys
import time
import matplotlib.pyplot as plt
import numpy as np
from scene_entities import Scene
def normalize_vector(vector):
return vector / np.linalg.norm(vector)
def length_vector(vector):
return np.linalg.norm(vector)
def arbitrary_vector_in_plane(normal, D, xyz):... |
987,418 | ed4490848bb1a7eea3034cd65742fea505e9385d | # encoding: utf-8
import scrapy
from scrapy.http import Request
import csv
import re
import scrapy
from scrapy.http import Request
import csv
import time
# import MySQLdb as mdb
# con=mdb.connect("localhost","r","","xad_database")
from scrapy.http import FormRequest
import pprint
import MySQLdb
from random import randi... |
987,419 | 02f6ccd65d0730aeb0b0b87fb6c452f735035703 | def palindrome(iniStr): #initial string
str = iniStr.lower().replace(" ", "").replace("\t", "") # conversion to lowercase, removal of whitespace and tab characters
n = len(str)
for i in range(0, n):
if i < n-1-i:
if str[i] != str[n-1-i]:
return False
else:
... |
987,420 | 2e8414d8d3f36d3fc765b9101f70413b838fe884 | import requests
import soldier
import json
import sys
from getpass import getpass
URL = 'https://api.github.com/user/repos'
py2 = True if sys.version_info[0] == 2 else False
def create_readme():
pass
def create_repo(remote_ssh, description, name, is_private):
if not name:
dir_name = soldier.run('pw... |
987,421 | 93ce14d57d53f5caeecd7881647c5e4e5f2abbbe | # write your schemas in this files. Use pydantic
from datetime import datetime
from enum import Enum
from typing import Any, Dict, List, Optional
from uuid import UUID
import asyncpg.pgproto.pgproto
import pydantic.json
from app.data.models import USER_TYPES
from core.factories import settings
from pydantic import Ba... |
987,422 | 866822d8545dd79c5b889cbb5eccd025f1bf8a24 | import re
from Tokens import *
#Keyword - palabra reservada
#ID - identificador
#Delimiter - delimitador
#Arithmetic - operaciones aritméticas
#Assigment - asignación
#EOF - end of file
#Error - Palabra no válida
TokensLst=[
Tokens("EOF","\#","EOF"),
Tokens("EOL","\\"+chr(10),"EOL"),
Tokens... |
987,423 | 1b9c52d82e6fca390a1b81d646172e52cfc37152 | # _*_ coding: utf-8 _*_
import plotly.express as px
import plotly.graph_objects as go
import dash_core_components as dcc
import pandas as pd
def tb_priceData(data_source):
df_views = data_source["df_views"]
period = data_source["period"]
country = data_source["country"]
company = data_s... |
987,424 | e663b5cd77ba17e265bd2af7f91fd1bd4f4af5d8 | def calcula_velocidade_media(distância, tempo):
velocidade_média = distância/tempo
return velocidade_média |
987,425 | a296f187c8ea51dbbb98123a2d9831b15a090781 | from .tensorflow_backend import *
rnn = lambda *args, **kwargs: K.rnn(*args, **kwargs) + ([],)
|
987,426 | 3a30820b88d5282dfc71b4c7ed404a3ef2291419 | # EXAMPLE 1:- To get the source of a website in python....
import requests
r = requests.get('https://xkcd.com/353/')
print(dir(r))
print(r.text) # This line produces the HTML of that page..
# EXAMPLE 2:- To GET AN IMAGE FROM THE WEB IN PYTHON.....
import requests
r = requests.get('https://imgs.xkcd.com/comi... |
987,427 | b3000f1925390a13e1cf5705b02a6e13b7d3e018 | from abc import ABC, abstractmethod
from functools import singledispatch
from typing import TYPE_CHECKING
from order.models import Order, Cart, Item, OrderItem
from order.visitor.visitable import Visitable
if TYPE_CHECKING:
from order.models import Order, Cart, Item
from order.visitor.visitable import Visitab... |
987,428 | 821e64f0e25371b726a93bba1aa0263b2cd0d405 | # -*- coding: utf-8 -*-
#
# Copyright (c) 2015 Cisco Systems, Inc. and others. 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... |
987,429 | 4e9c327054a2befe9bb2ca892fd5e4febf332dfe | from src.data.data import Data
|
987,430 | 82d310c5e718f9fd79d3df9767e24ee9ff88c7f6 | ##-----------------------------------
##re-identification
##
## model:
## intel/person-reidentification-retail-0288
## intel/facial-landmarks-35-adas-0002
##-----------------------------------
import iewrap
import cv2
import numpy as np
import time
import os
import yaml
import re #正規表現
from ... |
987,431 | c55c6712c16ed1f8fc61ade13deea717b418f973 | # import random
#
# class CardRank(): # Создаем колоду"
#
# def __init__ (self, deck = None):
# self.deck = list()
# rank = ['2', '3', '4', '5', '6', '7', '8', '9', '10', 'Jack', 'Queen', 'King', 'Ace']
# suit = ['Pi', 'Che', 'Bub', 'Kre', ]
# for x in rank:
# for y in su... |
987,432 | 10c1185a29a2e549e7ac2d1bc51c93d6bb2c3ec6 | #import APP_SETTINGS
import os # Access to Environment Variables
from twilio.rest import Client # Client object from Twilio
account_sid = "TWILIO_ACCOUNT_SID" # Twilio stuff
auth_token = "TWILIO_AUTH_TOKEN" # Twilio stuff
my_number = "MY_PHONE_NUMBER"
twi... |
987,433 | 98436d5dc64938c26c3cd28b2fdbeec07ec48c98 | def rendre_monnaie(prix, x20, x10, x5, x2, x1):
res20 = None
res10 = None
res5 = None
res2 = None
res1 = None
entree_totale = x20 * 20 + x10 * 10 + x5 * 5 + x2 * 2 + x1
if entree_totale >= prix:
entree_totale -= prix
res20 = entree_totale // 20
entree_totale %= 20
... |
987,434 | 2de174344453b98f2eb3a8d6084ac895531f3f22 | import re
def clean(input):
"""
>>> clean("{}")
'{}'
>>> clean("{{}}")
'{{}}'
>>> clean("{{<>}}")
'{{}}'
>>> clean("{<{}>}")
'{}'
>>> clean("{<a>,<a>,<a>,<a>}")
'{}'
>>> clean("{<{>}>}")
'{}}'
>>> clean("{{<a>},{<a>},{<a>},{<a>}}")
'{{}{}{}{}}'
>>> clean(... |
987,435 | 1b9b2909e24bbc6973a456a40dc400d2934f9b32 | import scipy as sp
import scipy.linalg as linalg
from timeit import timeit
def DoolittleLU(matrix: sp.ndarray, dtype=float):
n, m = matrix.shape
l = sp.zeros((n, n), dtype=dtype)
u = sp.zeros((n, m), dtype=dtype)
for i in range(n):
for k in range(i, m):
s = 0
for j in ... |
987,436 | 73da994a0a3d30be4aff9c23acf055f07400b25d | import unittest
import logging
from api.login_api import LoginAPI
from utils import assert_common
class TestIHRMLogin(unittest.TestCase):
"""测试IHRM登录类"""
def setUp(self) -> None:
pass
@classmethod
def setUpClass(cls) -> None:
cls.login_api = LoginAPI()
def tearDown(self) -> None... |
987,437 | 6b8aec1bea3ac77e58ebab4d8014f7a73eb39df6 | # app.py
import os
import json
from datetime import datetime
import requests
def getDialogue(theBillerCode):
print('getDialogue')
# from botocore.vendored import requests # this is needed for lambda
from requests.utils import quote
from lxml import html
from bs4 import BeautifulSoup
# wpUR... |
987,438 | 552df6050e2f32fad0549c924aaf8db7772de54c | #! /usr/bin/python3
from iris.test.rdma.utils import *
from infra.common.glopts import GlobalOptions
from infra.common.logging import logger as logger
from iris.config.objects.rdma.dcqcn_profile_table import *
def Setup(infra, module):
return
def Teardown(infra, module):
return
def TestCaseSetup(tc):
log... |
987,439 | f9a377813b54c6d4b475e5f8e01dc5c176a25a6b | 方法一:
class Solution:
def countCharacters(self, words: List[str], chars: str) -> int:
ans = 0
ch = {}
for c in chars:
ch[c] = ch.get(c,0) + 1
for w in words:
wc = {}
target = 1
for c in w:
wc[c] = wc.get(c,0) + 1
... |
987,440 | db7b3e246afcd63d1bf65059705b414d870ae1b1 | #!/usr/bin/python
# _*_ coding:utf-8 _*_
import sys
import knock30 as takayuki
def main():
mecab_file = open(sys.argv[1], "r")
all_sentences = takayuki.make_morphdicts(mecab_file)
mecab_file.close()
length_dict = dict()
nounstring = str()
noun_count = 0
for one_sentence in all_sen... |
987,441 | ff5a3ffd646d5e20000db0707e2f2ff52c8cee48 | # Generated by Django 2.1.3 on 2019-04-29 05:05
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('photaMusic', '0010_auto_20190429_0504'),
]
operations = [
migrations.AlterField(
model_name='publictrack',
... |
987,442 | bd1510cd60515b55745934ee8a43c98dd4419d3e | #### the standard form ==> ax^2 + bx + c = 0 #####
import cmath
a = float(input('please enter the coefficient of X^2: '))
b = float(input('please enter the coefficient of X: '))
c = float(input('please enter the coefficient of C: '))
d = b ** 2 - 4 * a * c
root1 = (-b - cmath.sqrt(d)) / (2 * a)
root2 = (-b + cmath.sqrt... |
987,443 | d58c9dd08f3bb556791ee986d8a7fdd95804d4aa | from sqlalchemy import create_engine, Integer, String, Float
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column
# 创建数据库的连接
engine = create_engine("mysql+pymysql://root:root@127.0.0.1:3306/lagou?charset=utf8")
# 操作数据库,需要我们创建一个session
Session = s... |
987,444 | cd51a7b6ac26c76ce4baf8bd38ecafbaa9e3a5d8 | #
# hw3pr1.py
#
# lab problem - matplotlib tutorial (and a bit of numpy besides...)
#
# this asks you to work through the first part of the tutorial at
# www.labri.fr/perso/nrougier/teaching/matplotlib/
# + then try the scatter plot, bar plot, and one other kind of "Other plot"
# from that tutorial -- and cr... |
987,445 | 0428d96bae6c77581af1eda3b30c60cc9814fe3f | from collections import Counter
n = int(input())
a = list(map(int, input().split()))
c = Counter(a)
ans = n * (n - 1) // 2
for k, v in c.most_common():
ans -= v * (v - 1) // 2
print(ans)
|
987,446 | 18132835bec98de592022233720e2cd39501884f | import socket
import json
import time
data = {'message':'hello world!', 'test':123.4}
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
for i in range(10):
s.connect(('127.0.0.1', 9999))
time.sleep(2)
s.send(json.dumps(data))
result = json.loads(s.recv(1024))
print result
s.close()
|
987,447 | 7665f26c221eb98351ff9ef571fd63435c85a19e | import sys
import os
from tinytag import TinyTag
from itertools import groupby
def get_args():
"""
artist_name = sys.argv[1]
"""
return sys.argv[1]
def get_mp3_files(directory_path):
for root, dirs, filenames in os.walk(directory_path, topdown=True):
for filename in filenames:
... |
987,448 | 6ffc3505662b7bacec302342286271f2fbea5d2e | from .symbolics import * # noqa: F401
from .geometry import * # noqa: F401
from .distance import * # noqa: F401
from .stencils import * # noqa: F401
from .topography import * # noqa: F401
from pkg_resources import get_distribution, DistributionNotFound
try:
__version__ = get_distribution(__name__).version
exc... |
987,449 | 0d7206392b7a84b809fc52678737df549728ef24 | from brownie import accounts
def deploy_simple_storage():
account = accounts[0]
print(account)
def main():
deploy_simple_storage() |
987,450 | 95011677285583367ace88e83c5869fd7c84169f | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Jul 11 14:51:02 2019
@author: kyleschneider
"""
import pandas as pd
import numpy as np
# Where you load in CSV file
dataset = pd.read_csv('bestbath.com_organic_keywords.csv',encoding = 'unicode_escape')
#Creates a dataframe filtered to the position y... |
987,451 | 5c5dc2e507705ce3d8559d4515843a1a291ff689 | import pandas as pd
import matplotlib.pyplot as plt
# Create a DataFrame based on a dictionary.
d = {'timeIndex': [1, 1, 1, 1, 1, 1, 1, 2, 2, 2], 'isZero': [0,0,0,1, 1, 1, 1 ,0,1,0],
'isOne':[99,98,99,88,78,89,96,99,97,93], 'xTimes':[0,1,2,3,4,5,6,7,8,9]}
df = pd.DataFrame(data=d)
#print(df)
# Draw the first axi... |
987,452 | 2bc77f07a752cbabb7485a0988b7cda22d13866b | #!/usr/bin/env python
# __author__ = 'RCSLabs'
from gi.repository import Gtk
win = Gtk.Window()
win.connect("delete-event", Gtk.main_quit)
win.show_all()
Gtk.main()
|
987,453 | f5721cad3c7a6316a9b060d3f2bc686d0c024258 | # Writes a JSON to a file
# json.dump() method is used to write the json string to a writeable object
import json
data = {}
data['people']=[]
data['people'].append({"Name":"John Doe",
"Age":27,
"Website":"www.john-d.com"})
data['people'].append({"Name":"Brian Moser... |
987,454 | fc3dcbed4458a4a4133e7779f722c17d56969338 | ''' README
Takes a text file as input and creates a numpy array of glove embeddings for each instance in the text file.
Also creates a dictionary mapping each word in the text file to a 300 dimensional vector embedding.
Steps to perform before running:
1) Make sure you have numpy package installed for python.
2) Downl... |
987,455 | 5025a590ee49a8a88e425e811245ff0dd2030b02 | # -*- coding: utf-8 -*-
import scrapy
from scrapy_splash import SplashRequest
lua_script = """
function main(splash)
assert(splash:go(splash.args.url))
while not splash:select('.quote') do
splash:wait(0.1)
end
return {html = splash:html()}
end
"""
class QuotesTestSpider(scrapy.Spider):
... |
987,456 | 31d53862ea16aa429689da6702bdd69293566cc5 | from .models import VM, Backup, Profile
from .serializers import VMSerializer, BackupSerializer, ProfileSerializer
from django.contrib.auth.models import User
from rest_framework import permissions
from rest_framework import generics
from .permissions import IsOwnerOrReadOnly
from rest_framework.response import Respons... |
987,457 | 62ee98079828fcfead28c48df14a64cfa63fadd9 | from tests.util import utils
from plaza_routing import config
from plaza_routing.integration import geocoding_service
def mock_geocode(monkeypatch):
monkeypatch.setattr(geocoding_service, "_query",
lambda payload:
utils.get_json_file(_get_geocode_filename(payload),... |
987,458 | c60f69a6a911068a7d2e9459311bb0e419a54693 | from flask import Flask
from flask import request
import requests
import facebook
import urllib
import json
#https://teamtreehouse.com/community/can-someone-help-me-understand-flaskname-a-little-better
app = Flask(__name__)
FACEBOOK_APP_ID = '1664841416939079'
FACEBOOK_APP_SECRET = '70e0a8b22eccbab11ee6f3a8306152bd'
... |
987,459 | 608e3c05377998d8a03b15ba019f6a377eded154 | # coding: utf-8
from __future__ import unicode_literals, print_function
def assert_ipymarkup():
try:
import ipymarkup
except ImportError:
raise ImportError('pip install ipymarkup')
def get_markup_notebook(text, spans):
assert_ipymarkup()
from ipymarkup import BoxMarkup, Span
from... |
987,460 | 8d729913131bff94532ce64ca9ca5e50f25f2cc7 | def play_50():
n=int(input('Enter n:'))
for i in range(2,n//2):
if n%i==0:
return "yes"
return "no"
play_50()
|
987,461 | e9f48e3933f006646c08ba0ea785b29f3ce8b6c2 | class Solution: # 61, 91
def longestWord(self, words: List[str]) -> str:
# 这题很坑,必须要从单个字母开始才算
visited = set([""])
for w in sorted(words, key=len):
if w[:-1] in visited:
visited.add(w)
return min(visited, key=lambda w : (-len(w), w))
|
987,462 | e92499394d797fe5efdded894a75e0388d3c711d | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.Create... |
987,463 | bbc9add0d25a200fa92b39b4275515644007b8ab | from sqlalchemy import (
create_engine, Column, Integer, String
)
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
# executing the instructions from our localhost "chinook" db
db = create_engine("postgresql:///chinook")
base = declarative_base()
# create a class-ba... |
987,464 | 07410cf3635fe1ab8d5e44af847d62b1bbcc576d | class Person:
def __init__(self, firstname, lastname, age):
self.firstname = firstname
self.lastname = lastname
self.age = age
def getAge(self):
print("My age is " + self.age)
class Person:
def __init__(self, firstname, lastname, age):
self.firstname = firstname
self.lastname = lastname
... |
987,465 | 61cbaf34713ace4a4e292efff7690fa2f25b8b95 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import ssl
import logging
import wsc.logging
from wsc.server.protocol import Adapter
from wsc.server.handler import ConnectionHandler
from wsc.server.manager import ConnectionsManger
from wsc.server.compatiblity import TCPServer, ThreadingMixIn
logger = ... |
987,466 | b6d32e9a636dcf9950281a4402c6547eb63e49fc | # This program is to print factorial
def factorial(num):
factor = 1
for i in range(1,num+1,1):
factor *= i
return factor
# main
if __name__ == "__main__":
nums=int(input("Enter the number for factorial: "))
print("factorial of ",nums," is ",factorial(nums))
|
987,467 | 593b0c0b6b7f57a870243602943e0bf85126a720 | from flask import Flask, render_template, request, redirect
import jinja2
import json
import uuid
app = Flask(__name__)
@app.route('/allcontacts')
def allcontacts():
with open('contact.json', 'r') as f:
data = f.read()
mylist = json.loads(data)
return render_template('allcontacts.html', contacts=m... |
987,468 | a57a1ce85728ec2383004e1b85f8267c7b2bd55c | # N.B Before running, make sure:
# - all photon files are in a folder called 'photon'
# - the spacecraft file is named 'spacecraft.fits' and is in a folder called 'spacecraft'
# You have these 4 files in a folder called model:
# i) gll_iem_v05.fits
# ii) gll_iem_v05_rev1.fit
... |
987,469 | 0c63e9e615b1fbda117c399559c04176b2298463 | ### serious exercise 4 part c
n_c = 9
print("c.", n_c, "stars and xs in total:")
# 1st solution:
print("1st solution")
c = ""
for i in range(n_c):
if i%2 == 0:
c += "x "
else:
c += "* "
print(c)
print()
# 2nd solution:
print("2nd solution")
for i in range(n_c // 2):
print("x *", end = " "... |
987,470 | 777d5938c9de8f30f8018dd88668e34429385355 | # -*- coding: utf-8 -*-
from tender_additional_data import *
from flask import abort
import core
from database import BidsTender, Tenders, db
from language.translations import alert
def validator_create_tender(data):
for field in range(len(create_tender_required_fields)):
if create_tender_required_fields[... |
987,471 | 63f5cadd81ef1a99c4d6b469f00484ea4fa72462 | import re
from .models import WordStats
from .models import Bucket
from django.shortcuts import render
from django.utils import timezone
from review.models import Word
from rest_framework.views import APIView
from rest_framework.permissions import AllowAny
from rest_framework.response import Response
def play(reque... |
987,472 | b1dc5f73266cf0b476051fcd72cbb0a2853af1ea | import logging
from ibmsecurity.utilities import tools
logger = logging.getLogger(__name__)
# URI for this module
uri = "/iam/access/v8/alias_service"
requires_modules = ["federation"]
requires_version = "9.0.1.0"
def get(isamAppliance, sortBy=None, count=None, start=None, filter=None, check_mode=False, force=False... |
987,473 | 37d9a58837489f5d62f7323cfb07e157d61d5076 | # Copyright 2021 QuantumBlack Visual Analytics Limited
#
# 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
#
# THE SOFTWARE IS PROVIDED "AS IS",... |
987,474 | 2998d164e23c3351fe2506199ee9a056e75e9761 | __author__ = 'Ingrid Marie'
import sqlite3
conn = sqlite3.connect('test.db')
c = conn.cursor()
def tableCreate():
c.execute('CREATE TABLE love (ID INT, name TEXT)')
def enterData():
c.execute("INSERT INTO love VALUES (6,' peter')")
enterData()
|
987,475 | 016f9e75365a325243c879bbf998bea12fb429e1 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from datetime import datetime
import tabun_api as api
from tabun_api.compat import text
from .. import core, user, worker
from ..db import db, get_db_last, set_db_last
def reader():
last_comment_time = get_db_last('last_comm... |
987,476 | 33b6e0fd223e7613bde7e597105e8cc0ee0fb862 | # -*- coding: utf-8 -*-
u"""
============================
Unicode Case Folding Support
============================
This module generates a CASE_MAP dictionary which maps upper case characters to
lower case characters according to the Unicode 5.1 Specification:
>>> CASE_MAP[u'B']
u'b'
Note that some codepoi... |
987,477 | 0811e3b365b462e1588a776b4570d50193001faa | from django.shortcuts import render
from django.contrib.auth.forms import UserCreationForm
from django.urls import reverse_lazy
from django.views import generic
from .forms import UserCreationFormWithEmail
# Create your views here.
class SignUpView(generic.CreateV... |
987,478 | aceb232618e9e65ad07200771183d4ccdd45db51 | #!/usr/bin/env python3
"""
Baum-Welch Algorithm module
"""
import numpy as np
def baum_welch(Observations, Transition, Emission, Initial, iterations=1000):
"""
performs the Baum-Welch algorithm for a hidden markov model:
- Observations: numpy.ndarray of shape (T,) that contains the index
of the obser... |
987,479 | 2de3044c028288a52bdaee5c622144544e8935d4 | from django.conf.urls import url
from . import views
app_name = 'salesman_mgr'
urlpatterns = [
url(r'^view/(?P<username>[\w.@+-]+)/$', views.viewStock, name='view_stock'),
url(r'^dashboard/(?P<username>[\w.@+-]+)/$', views.renderSalesman, name='dashboard'),
url(r'^history/(?P<username>[\w.@+-]+)/$', v... |
987,480 | 90fa8b3d724b621802d060b492c4563fe67e388d | # Copyright 2018 Francesco Ceccon
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... |
987,481 | b8e56b32d640e070bbe400b3dfccc1cb3ff2a298 | import time
from selenium.webdriver.support import expected_conditions as EC
from selenium import webdriver
from selenium.webdriver.common.by import By
def do_like(drv,id):
for i in range(0, 3, 1):
try:
npage = 2
#go to profile
# btn = drv.find_element_by_xpath("//a[@dat... |
987,482 | f1c01bfec82fc86692ef50936a6377d254602e00 | """
印刷文字识别WebAPI接口调用示例接口文档(必看):https://doc.xfyun.cn/rest_api/%E5%8D%B0%E5%88%B7%E6%96%87%E5%AD%97%E8%AF%86%E5%88%AB.html
上传图片base64编码后进行urlencode要求base64编码和urlencode后大小不超过4M最短边至少15px,最长边最大4096px支持jpg/png/bmp格式
(Very Important)创建完webapi应用添加合成服务之后一定要设置ip白名单,找到控制台--我的应用--设置ip白名单,如何设置参考:http://bbs.xfyun.cn/forum.php?... |
987,483 | 6b2d9421b3478266835bf579275866f432f84284 | # Generated by Django 2.2.5 on 2019-11-04 21:01
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('Crime', '0003_auto_20190927_0401'),
]
operations = [
migrations.CreateModel(
name='Locationdata',
fields=[
... |
987,484 | 0525559abfa982b5b96603301caa5b7da808e3aa | import collections
import functools
import math
import os
import shlex
import subprocess
import sys
import typing as t
import attr
import click
import lark
import clout.exceptions
from .. import _util
ALWAYS_ACCEPT = True
HELP_COMMAND = "HELP_COMMAND"
class CountingBaseCommand:
def __init__(self, *args, nar... |
987,485 | 80d8a67fd76c1b74f9e0dc19ac423afa418f5c05 | # Generated by Django 3.0.3 on 2020-09-10 05:42
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('wxchat', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='user',
name='isonline',
fi... |
987,486 | b10a21adb5028aa51948ead0e6770bf388fbe1ba | from .models import Inbox, Setting, Dislike, Like, UserPhoto, Match, Profile
from django.views.generic import CreateView, UpdateView, DetailView, ListView
from django.shortcuts import render
# Create your views here.
|
987,487 | b138d59edfd9c8c8b24fad3d4cdc2e12c732c3fc | # -*- coding: utf-8 -*-
#
# Copyright (C) 2014-2020 Bitergia
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This ... |
987,488 | 10f92c61d572f98af2cd5f422457f156655f9ab5 | from contextlib import contextmanager
from py_sexpr import terms
import warnings
__metadata_to_wrap = terms.metadata
def metadata(line, col, filename, sexpr):
"""https://github.com/purescript-python/purescript-python/issues/8
"""
if line is 0:
line = 1
return __metadata_to_wrap(li... |
987,489 | bd3c43ac4eea33ff87908774159972b13438daeb | # #!/usr/bin/env python
# # -*- coding: utf-8 -*-
#
# # Example of `bridge' design pattern
# # This code is part of http://wp.me/p1Fz60-8y
# # Copyright (C) 2011 Radek Pazdera
#
# # This program is free software: you can redistribute it and/or modify
# # it under the terms of the GNU General Public License as published... |
987,490 | d91627af0ee0c94eb1c2ae0f4eca417d93ff3d5f | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Schooner - Course Management System
# University of Turku / Faculty of Technilogy / Department of Computing
# (c) 2021, Jani Tammi <jasata@utu.fi>
#
# SubProcess.py - Class to run a subprocess and collect output
# 2021-09-11 Initial version.
#
import subprocess
cl... |
987,491 | f1e2a59b84c968c4d4ece436736975d832a345e0 | from django.apps import AppConfig
class LawblogConfig(AppConfig):
name = 'lawBlog'
|
987,492 | bd8b2c967955572bd2f1b0fe70079b2b5fd9f00d | # from bottle import Bottle, route, run, get, template, post, request
# from cred import cred_consumer_key, cred_consumer_secret, cred_access_token, cred_access_token_secret
# import pymysql
# import time
# import tweepy
# import json
# import os
# import datetime
# import python_jwt as jwt
# import Crypto.PublicKey.R... |
987,493 | 2434e0e2a7ffaf53a779aa120ce255edea6ceb75 | from functools import partial
import json
import os
from ubuntui.ev import EventLoop
from subprocess import run, PIPE
from conjureup import controllers
from conjureup import juju
from conjureup import async
from conjureup.app_config import app
from conjureup.ui.views.service_walkthrough import ServiceWalkthroughView
fr... |
987,494 | f4f0dde0e2c0b06d56750cb4788ba66861caf244 | # age=int(input("请输入年龄: "))
#
# if age>=18:
# print("恭喜你,你成年了")
# elif 18>age>=0:
# print("你还太小了 ")
# else:
# print("你输入有误")
#
#
# l=[[5,6,9,3,7],[1,2,3,4,]]
# for i in l:
# print(i)
# for a in i:
# print(a)
#
# sum=0
# for i in range(101):
# sum=sum+i
# print(sum)
# for i in range(... |
987,495 | cc2f394bc6623013980a56a313b3446544b6279d | # -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2017-01-06 09:22
from __future__ import unicode_literals
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('lyceum', '0001_initial'),
]
operations = [
migrations.Alter... |
987,496 | 3de4dad21e9eaa9fb250ac6ac9eb9df9b69d2a84 | # C111152 임종욱
from random import randint
dice_1 = int(randint(1,6))
dice_2 = int(randint(1,6))
Sum = dice_1 + dice_2
user = int(input('원하는 두 주사위의 합을 입력하시오? '))
while Sum != user:
print('첫번째 주사위=',dice_1,'두번째 주사위=',dice_2,'합 = ',Sum)
dice_1 = int(randint(1,6))
dice_2 = int(randint(1,6))
S... |
987,497 | 5545e4614a8d1208728c6dcbfa45ee0f5bad1039 | import Database
import datetime
import compiler
def rodarFilaArquivos(every_minute):
print("Rodando Fila de Arquivos a cada " + str(every_minute) + " minuto(s)")
rodou = False
minute = datetime.datetime.now().strftime('%M')
while(True):
if minute != datetime.datetime.now().strftime('%M'):
... |
987,498 | fb1115b2e725ac6c91a253063a5be034b57ae4bf | from StringIO import StringIO
import os
from tempfile import mkstemp
import unittest
from mock import patch, mock_open
import sys
from striketracker import Command, APIError
class TestStrikeTrackerCommand(unittest.TestCase):
def setUp(self):
self.fd, self.cache = mkstemp()
self._stdout = sys.stdo... |
987,499 | 6d0c5f8d566eacf761308736e3662e18f41c8b4f | import matplotlib.pyplot as plt
import numpy as np
from instagramy import InstagramUser
import sys
"""
Usage:
python instalysis.py <text_file_of_usernames>
"""
try:
filename = sys.argv[1]
except (IndexError, KeyError):
print("List of username as textfile in arguement")
usernames = []
file = open(filena... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.