index int64 0 1,000k | blob_id stringlengths 40 40 | code stringlengths 7 10.4M |
|---|---|---|
988,400 | 564f4fe353cbdb604e0efcdf8fc728e45f10f920 | '''
Created on Jan 3, 2012
@author: eocampo
'''
__version__ = '20120224'
# DB ERRORS
DB_GRAL_ERR = -1
DB_CON_ERR = -101
DB_CON_HDL_ERR = -102
DB_CONSTR_ERR = -103
DB_OPER_ERR = -104
DB_NO_HANDLER = -105
# APP ERRORS
INV_LOAD_FILENAME = -200
INV_CRED_TBL_KEY = -201
SNAME_NOT_FOUND = -... |
988,401 | 00126e93625db32acb2e2954680642b20bc74d68 | import copy
import numpy as np
import pyfits as pf
def expand_fits_header(header, factor):
header = header.copy()
header['CDELT1']/=factor
header['CDELT2']/=factor
header['NAXIS1']*=factor
header['NAXIS2']*=factor
header['CRPIX1']=header['CRPIX1']*factor - factor/2.0 + 0.5
header['CRPIX2... |
988,402 | 4dbefc9b0c95d96ee453ecbf271cbbcd8db21c5e | def LCM(a,b):
if a>b:
z=a
else:
z=b
while(True):
if(z%a==0) and (z%b==0):
LCM=z
break
z+=1
return LCM
print(LCM(78,45))
print(LCM(4,8)) |
988,403 | 908265a0c6ea4e567780ba4b8070c826484c9de5 | # WARNING: parser must be called very early on for argcomplete.
# argcomplete evaluates the package until the parser is constructed before it
# can generate completions. Because of this, the parser must be constructed
# before the full package is imported to behave in a usable way. Note that
# running
# > python3 -m st... |
988,404 | 56a5968317d75ac2aaef6b006ee750027eca3e6f | # Generated by Django 3.0.5 on 2020-05-06 18:27
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('Clients', '0008_auto_20200506_1803'),
]
operations = [
migrations.AlterField(... |
988,405 | 6321c50afb7a7dccc04d0be719a9f7b4e121b841 | def proc_array_val(array, val):
try: return array[int(val)]
except (IndexError, TypeError, ValueError): return array[0]
def proc_enum_val(array, val):
return {"value": val, "str": proc_array_val(array, val)}
# set up enum arrays
enum_state = [
"unknown", "Unknown", ... |
988,406 | 9e0c104bc035436e69b11ee738abe92dab5bf709 | from tqsdk import TqApi
from DataLoader import download_data, read_data
from datetime import datetime
api = TqApi()
quotes = api._data['quotes']
symbols = []
for symbol, item in quotes.items():
if item['ins_class'] == 'FUTURE':
symbols.append(symbol)
<<<<<<< HEAD
print(len(symbols))
download_data(symbols[... |
988,407 | b4b7dfcdeee510b943792357712bab37fd2871ca | from words import w_list
#words.py is a file containing a list of words.
import random
#Function to get a random word from the file "words.py".
def get_word():
word = random.choice(w_list)
return word.upper()
#Function to display the design of the hangman for each stage or try.
def display_hangman(l... |
988,408 | 87806f9540664754600a69f9d6e91e3733d7b087 | from urllib.parse import parse_qsl
from config import cache_config
from cache import Cache
class CacheMiddleware(object):
def __init__(self, app):
self.app = app
def __call__(self, environ, start_response):
cache = Cache(cache_config)
cache_control = do_caching(environ.get('Cache-Cont... |
988,409 | a4a952fc85b89377e8fc83ea32d57cc312a4c6c5 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from collections import defaultdict
class Node():
def __init__(self,n_node,nchilds, nmetadata):
self.nchilds = nchilds
self.nmetadata = nmetadata
self.n_node = n_node
def set_metadata(self,metadata):
self.metadata = metadata
def ... |
988,410 | 8a2bcbc4928eab529dce9463fa1c63174759427c | """TENANTS ROUTING
routing for tenants zone
- all routes use language code prefix (ex: /en/dashboard)
"""
from django.contrib import admin
from django.urls import path
from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.i18n import i18n_patterns
from django.utils.transl... |
988,411 | 6017647df7e24e81bd8c070c28cde4a78afad6da | import os
import django_filters
from django.contrib import messages
from django.contrib.auth.decorators import login_required, permission_required
from django.http import HttpResponse, HttpResponseBadRequest
from django.shortcuts import render
from django.utils.translation import ugettext_lazy as _
from django.views.g... |
988,412 | f1ae41d68629efc3239ed3f0156f260f39071118 | def counter(path):
with open(path) as file:
d = file.read()
d.replace("," , " ")
return len(data.split(" "))
print(counter(path)("b.txt")) |
988,413 | 01e26944b69e95c32bf2fac5aea92b285f333377 | # 1.通过索引可以访问序列中的任何元素
# verse = ["圣安东尼奥马刺","洛杉矶湖人","休斯顿火箭","金州勇士"]
# print(verse[2]) #输出第3个元素
# print(verse[-1]) #输出最后一个元素
#
# # 2.通过切片获取列表n中的第2个到第5个元素,以及第一个、第三个和第五个元素
# n = ['0','1','2','3','4','5','6','7','8']
# print(n[1:5]) #获取第二个到第五个元素
# print(n[0:5:2]) #获取第一个、第三个、第五个元素
#
# # 3.使用n关键字检查某个元素是否是序列的成员
# nba = ["圣... |
988,414 | fb63fcf0236bc9dc15c06817fb40212afa6c3e8e | #-*- coding:utf-8 -*-
import sys
import os
import datetime
from time import sleep
import shutil
### path
pcap_path = "./"
accesslog_path = "/server/logs/access.log"
### By G
file_list = os.listdir(pcap_path)
file_list_py = [file for file in file_list if file.endswith(".pcapng")]
def tmp_dir():
try:
if not(os.pa... |
988,415 | 5869b51439371136198bd4c9644afc69fb69c254 | from django.contrib import admin
from .models import Specialty, Company, Application
class SpecialtyAdmin(admin.ModelAdmin):
pass
class CompanyAdmin(admin.ModelAdmin):
pass
class ApplicationAdmin(admin.ModelAdmin):
pass
admin.site.register(Specialty, SpecialtyAdmin)
admin.site.regis... |
988,416 | b38e81ce0e2d505f1b341c268ca46807a2646190 |
def garage(initial, final):
initial = initial[::]
seq = []
steps = 0
while (initial != final):
for i in range(len(initial)):
zero = initial.index(0)
# print (zero, end=":")
if initial[i] != final[i]:
initial[i], initial[zero] = initial[zero], ... |
988,417 | 83cf921913bbf70fa582c27bd14fe277500f2101 | This is a test for fixing bug.
And then we fix it!
|
988,418 | 830aefca6c48fbfdcf1acd625c68c7d10d72aa7e | from random import choice
from django.contrib.auth.models import User
from django.shortcuts import redirect, render
from django.urls import reverse
from core.models import Game
CHOICE = ['Rock', 'Paper', 'Scissors']
def rps_list(request):
games = Game.objects.all()
user = request.user
data = {
'... |
988,419 | 6653a9143042ba735ec433f20745e05460b15d5c | from plugins.telegram import handlers
__all__ = [
'bot',
'dispatcher',
]
|
988,420 | f72618c0c8a4ead9dd66b216dad9c2078404456e | def remove_vogais(palavra):
lista_vogais=['a','e','i','o','u']
sem_vogal=''
for i in range(len(palavra)):
if palavra[i] not in lista_vogais:
sem_vogal.append(palavra[i])
return sem_vogal |
988,421 | 5131b0c1cb3584a9d1d4ee1399fa1e7b6885acfb | """
Author: Ishan Thilina Somasiri
E-mail: ishan@ishans.info
Web: www.blog.ishans.info
Git: https://github.com/ishanthilina/Gnome-Online-Documents-Manager
"""
class CustomException(Exception):
"""
Class to create custom exceptions
"""
def __init__(self, value):
self.parameter = value
def _... |
988,422 | 286bf00c1f9c5ea48bb632573dfd5f0e75672461 | # Import module
from flask import Flask, render_template
# app devient notre server
app = Flask(__name__)
# Création d'une route "/"
@app.route("/")
def helloWorld(): # La fonction de notre route
return "Hello, World!"
# Notre route "/hello"
@app.route("/hello")
def hello():
return render_template("index.htm... |
988,423 | 545afc3b48d348409a4e9ffac57fd9e58f52728a | from tensorflow import keras
from tensorflow.keras import layers
def BuildVgg19():
vgg = keras.applications.VGG19(weights='imagenet')
outputs = [vgg.layers[i].output for i in range(3, 10)]
model = keras.Model([vgg.input], outputs)
return model
def ResidualBlock(x):
filters = 64
kernel_size = 3
momentu... |
988,424 | cf42c316ca5fdad9da7e4134598cddc2d566195c |
'''
皮一下
'''
if __name__ == '__main__':
print('finish this book!')
|
988,425 | eb2810fe559840ae7f43769be436516c034875cd | # Copyright 2022 Huawei Technologies Co., Ltd
#
# 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... |
988,426 | bd2a29d87830fec99d756f57a92efba69aa6ca11 | # -*- coding: utf-8 -*-
from django.test import TestCase
from dedal import ACTIONS, ACTION_CREATE
from dedal.site import site, Dedal
from dedal.decorators import crud
from dedal.exceptions import ModelIsNotInRegisterError
from example.blog.models import Post
class FooModel(object):
class _meta: # noqa
m... |
988,427 | d0880230db2256ee23a781df3fcf4406955fbfc2 | # Generated by Django 3.1.2 on 2020-10-17 13:20
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('test', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='categoryattribute',
name='attributes',
... |
988,428 | 87027ec3e0b7cab90d6d8f2f1658315dfc24d880 | #!/usr/bin/python
import os
import sys
import urlparse
import subprocess
import argparse
import giturlparse
from mygogs import *
import gogs_client
import errno
from inspect import getmembers
from pprint import pprint
from common import *
from mygogs import *
from fnmatch import fnmatch
def main():
parser = argpa... |
988,429 | a3088f95abfc3aa387e3914226b4febcc4af1f15 | l = input().split(' ')
for i in range(0, len(l), 2):
print(l[i])
|
988,430 | f1547499fc27492e5d1b8bd218a21fe7405a1335 | from django.apps import AppConfig
class LevelgamingConfig(AppConfig):
name = 'levelgaming'
|
988,431 | 91362c68f0822f0f8647e900144da8b7c1bd2fd0 | ####
#Vacation Cost Calculator
####
#Calculates total cost of vacation
#Completed by Anthony Lee
#from Unit4: "Functions" on Codecademy
#Hotel cost function
def hotel_cost(nights):
return 140*nights
#Plane ride cost function
def plane_ride_cost(city):
if city == "Charlotte":
return 183
elif ci... |
988,432 | 95bf2e01a9a148f0176e7051f4ef11282dc32bd3 | #! python3
# excelToCsv.py
# Author: Kene Udeh
# Source: Automate the Boring stuff with python Ch. 14 Project
import os
import csv
import openpyxl
def excelToCsv(folder):
"""converts sheets in every excel file in a folder to csv
Args:
folder (str): folder containing excel files
Returns:
... |
988,433 | 0c0d95078a25bffb60ce54183cb4e80dac540cfe | '''
Tugas Kecil 3 IF2211 Strategi Algoritma : Shortest Path with A* Algorithm
Cr : Mohammad Sheva Almeyda Sofjan (13519018/K01) | Alif Bhadrika Parikesit (13519186/K04)
'''
import graph
import math
import sys
def start():
print("#### A* Shortest Path Finder ####")
filename = input("ENTER MAP NAME (map.txt): "... |
988,434 | 8e05a16fb92419a5a8fbbdff37f8a5c8f776cfe9 | '''
Created on Mar 7, 2011
@author: mkiyer
'''
def insert_sam(self, filename, genome=False, fragment_length=-1, rmdup=False,
multimap=False):
bamfh = pysam.Samfile(filename, "rb")
# count reads and get other info from BAM file
logging.debug("%s: Computing track statistics... |
988,435 | 2b6bf599f20f5cc18c5fe8d38ef8576be116fbb1 | '''
!/usr/bin/env python
_*_coding:utf-8 _*_
@Time :2019/9/4 10:22
@Author :Zhangyunjia
@FileName: 4.5_featureSelection.py
@Software: PyCharm
'''
from sklearn.datasets import load_boston
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import MinMaxScaler |
988,436 | f4612fb4ca946e020e31d6ea956a56390a3a59c8 | def mul(li):
out=[]
p=1
#왼쪽부터 곱해서 result 추가 [1,1,2,6]
for i in range(0,len(li)):
out.append(p)
p=p*li[i]
p=1
#오른쪾부터 시작 [24,12,4,1]
for i in range(len(li)-1,-1,-1):
out[i]=out[i]*p
p=p*li[i]
return out
li=[1,2,3,4]
print(mul(li)) |
988,437 | 0ecff6284f491bcf0697643870726bed9c6321d9 | import ldap
import os
from loguru import logger
from .db import db, User
def init(app):
ldapuri = os.environ.get("LDAPURI")
ldapbase = os.environ.get("LDAPBASE")
ldapbind = os.environ.get("LDAPBIND")
ldappswd = os.environ.get("LDAPPSWD")
ldap_conn = ldap.initialize(ldapuri)
ldap_conn.simpl... |
988,438 | 638e3a43889dccc64840c664934f967d34d6b94e | # Copyright (c) 2021-22 elParaguayo
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, dist... |
988,439 | cf4f98a99530c512f1ea5fe03928d700d2d6e42a | import random
import math
import matplotlib.pyplot as plt
def init_weights(layers):
weights = list()
#probar con layers[i] + layers[i+1] en el denomidor
#probar con diferente numerador, 2.0 es XAVIER method
for i in range(len(layers)-1):
var = math.sqrt(2.0/layers[i])
weights.append([[r... |
988,440 | 2233f1daeafc13cc24bbf822cad731ee16bc5b64 | # encoding = utf-8
def fetch_every_nth_record(db, table, n, limit, where=None):
query = create_query_every_nth_record(table, n, where, limit)
records = db_perform_query(db, query)
return records
def create_query_every_nth_record(table: str, n: int, where: str, limit: int = 50):
query = create_query_... |
988,441 | e30bc421edb93ea8857219585c62e2dcdb5fd824 | # bfs, dfs 에서
# Queue 또는 Stack을 활용하여 그래프를 traverse해야하는 예
# 1000 1 1000
# 999 1000
# 에러가 계속 났던 이유
# 답을 구하고 print 할 때,
# list 자체를 print해서 []를 포합하고 있었기 때문
class My_Vertex:
def __init__(self, nodeA, nodeB=None):
self.node_main = nodeA
self.node_neighbors = []
if nodeB != None:
self... |
988,442 | 6b7c05fd482cdcc043cd6fe7cc53df8850a0f35c | num1 = int(input("Enter 1st number: "))
num2 = int(input("Enter 2nd number: "))
def compute_lcm(num1, num2):
largest = max(num1, num2)
while True:
if largest % num1 == 0 and largest % num2 == 0:
lcm = largest
break
largest += 1
return lcm
result = compute_lc... |
988,443 | 98cb5e1c225be283a4b98e5f48a05b3d004dd9f3 | #!/usr/bin/env python
import re
from re_08_choiceredata import choice_data
# data = choice_data()
# print(data)
#
# patt_time = ' (\d+:\d+:\d+) '
# print("Time: " + re.search(patt_time, data).group(1))
#
# patt_email = '\w+@\w+\.(?:net|org|edu|com|gov)'
# print("Email: " + re.search(patt_email, data).group())
#
# pat... |
988,444 | 767274f2c9c0ea68419398651f575509363fa2fd | import torch.nn as nn
import params as P
import utils
import basemodel.model4
import hebbmodel.top4
class Net(nn.Module):
# Layer names
FC5 = 'fc5'
BN5 = 'bn5'
FC6 = 'fc6'
CLASS_SCORES = FC6 # Symbolic name of the layer providing the class scores as output
NET_G1_4_PATH = P.PROJECT_ROOT + '/results/gdes/conf... |
988,445 | 99f56e27bc022e0206fe096db958b342940635d6 | import requests
import json
from conf import *
from hidden_conf import *
__version__ = '1.0'
__author__ = 'Yair Stemmer and Yoav Wigelman'
class PostText(object):
def __init__(self, text: tuple, content_type: str = CONTENT_TYPE, accept_encoding: str = ACCEPT_ENCODING,
x_rapidapi_key: str = X_RAP... |
988,446 | 0acf61e2b8da8740403b14694cb95e344605878d | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Sep 3 22:04:52 2017
@author: akashmantry
"""
import os
from models import ParserModel
from bs4 import BeautifulSoup
from readability.readability import Document
from text_utils import TextFilter
class Parser:
def __init__(self, path):
se... |
988,447 | ce3876916bccd79e422fb1e5125e11a6a4c03842 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Aug 11 13:47:53 2018
@author: emrecemaksu
"""
import pandas as pd
import numpy as np
from sklearn.preprocessing import LabelEncoder, OneHotEncoder, StandardScaler
from sklearn.svm import SVC
from sklearn.cross_validation import train_test_split
from sk... |
988,448 | 058379d22d4c8b9f1e6134b023e0ab3e8d975f8c | from scrawler import *
import pymysql
import uuid
import sys
from database import *
from logger import Logger
import time
l = Logger()
db = Database("pitt_course")
subject_list = []
subject_dict = db.query_db_dict("SELECT major_id, subject_index FROM subject", l)
for i in subject_dict:
subject_list.append({'su... |
988,449 | 4bec8a5796cf9bd0486306c214b5056c4075ed6e | #!/bin/env python3
# https://pymolwiki.org/index.php/Launching_From_a_Script # how to use pymol as cli
# https://pymolwiki.org/index.php/Iterate # how to get information from selected atoms
# https://github.com/schrodinger/pymol-open-source/blob/master/modules/pymol/wizard/mutagenesis.py # pymol mutagenesis internals,... |
988,450 | c102cad4e037cf8685b1848f8b7db0dcbcfb7b11 | import requests
import webbrowser
import time
import turtle
screen = turtle.Screen()
screen.setup(8192,4096)
screen.bgpic('map.gif')
turtle.mainloop()
'''astronaut_data= 'http://api.open-notify.org/astros.json'
#result=requests.get(astronaut_data).json()
#print(result)
#print(f"People in space {result['number']}")... |
988,451 | 649a1d39a6c295e15cc761e97ab6e39b0e26b0bd | import random
import turtle
class TurtleFPO:
def __init__(self, energy=100):
self.t = turtle.Turtle()
self.energy = energy
def forward(self, value):
if value < 0:
raise ValueError('Error: Value must be positive')
if self.energy - value >= 0:
self.t.for... |
988,452 | 3430e2493be60aa8df485c8d23e9a97ac426933a | '''
@Author: CSY
@Date: 2020-01-27 15:31:29
@LastEditors : CSY
@LastEditTime : 2020-01-27 15:35:25
'''
"""
23、用lambda函数实现两个数相乘
"""
sum=lambda x,y:x*y
print(sum(1,2)) |
988,453 | c321873e2067e22078930b140b690de024fae742 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os.path
import time
class Query(object):
endpoint = 'https://api.us2.sumologic.com/api/v1/logs/search'
def __init__(self, template, conn, timestamp='_timeslice', value='value',
span=900000):
template_path = os.path.join(os.path.e... |
988,454 | f142f9192a2415a0fadf31f47e5264d13f011adb | #returns approved, incresed/decreased, number
def main(last2, last1, new):
if new >= 100 or last1 >= 100 or last2 >= 100: #if too far
return ["FAR", new]
if abs(last1 - new) >= 30: #if big difference
return ["BIG", new]
if abs(last1 - new) <= 0.5: #if very small difference
return ["S... |
988,455 | 4a28f74b35a7faaaa3b4a9733a074928174ddef7 | from collections import deque
def is_scheduling_possible(tasks, prerequisites):
nodes = [[] for task_index in range(tasks)]
in_degree = [0 for task_index in range(tasks)]
for from_node, to_node in prerequisites:
nodes[from_node].append(to_node)
in_degree[to_node] += 1
q = deque()
... |
988,456 | c7a5a9263dc1666ce0b9590bd79997d0a93124f3 | # General Utility
import time
import sys
# PYQT5, GUI Library
from PyQt5 import QtCore, QtGui, QtWidgets
# Serial and MIDI
from serial.tools import list_ports
import rtmidi
# SKORE modules
import globals
#-------------------------------------------------------------------------------
# Functions
class DeviceDetect... |
988,457 | 90f4bad1fd73fb63118fe388d1e680057e06e85b | #NAME:
# Board.py
#
#PURPOSE:
# To organize and manage the data of a Sudoku game board. The Board class
# represents the Sudoku game board as a 9x9 array of Cell objects.
#
#INPUTS:
# In order to properly function, the Cell class must be imported, along with
# copy and random packages.
#
#CALLING SEQUENCE:
# ... |
988,458 | 2b63a6d9c70755a081c9125ad5fe815eb540e41e | # from urllib.parse import quote
# from django.core.urlresolvers import reverse
# from django.core.exceptions import ObjectDoesNotExist
# from django.test import TestCase, Client
#
# from ..models import User
#
#
# class UserViewsTests(TestCase):
# def setUp(self):
# self.password = 'mypassword'
#
# ... |
988,459 | deda5609f81313e92d98d632cf5ec9ef7c2c23db | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: root
# @Date: 2015-08-25 15:44:32
# @Last Modified by: lancezhange
# @Last Modified time: 2015-08-26 14:59:21
import cv2
import numpy as np
import logging
import logging.config
from array import array
logging.config.fileConfig("logger.conf")
logger = loggi... |
988,460 | a4f21d29dd199869a89abf032a50f9433a353f4c |
import re
from glob import glob
def parseTexts(fileglob='G:/TEC/tablas1/*txt'):
texts, words = {}, set()
documento_t = {}
for txtFile in glob(fileglob):
with open(txtFile, 'r') as f:
txt = re.findall(r'([-À... |
988,461 | d30bf02a37c4149de62912963f36d9827574af1c | from rest_framework import viewsets, serializers
from profiles.models import GigPoster, GigSeeker
# serializers
class GigPosterSerializer(serializers.ModelSerializer):
class Meta:
model = GigPoster
class GigSeekerSerializer(serializers.ModelSerializer):
class Meta:
model = GigSeeker
# viewse... |
988,462 | de21b931e141e8b52418bee944203c129cda66c8 | # -*- coding: utf-8 -*-
aliceblue=(240,248,255)
antiquewhite=(250,235,215)
aqua=(0,255,255)
aquamarine=(127,255,212)
azure=(240,255,255)
beige=(245,245,220)
bisque=(255,228,196)
black=(0,0,0)
blanchedalmond=(255,235,205)
blue=( 0,0,255)
blueviolet=( 138,43,226)
brown=( 165,42,42)
burlywood=( 222,184,135)
cadetblue=( 9... |
988,463 | 20a9393fd51e68efff51dc2e5ed3aa3179324ec9 | # Generated by Django 3.0.8 on 2020-07-31 04:09
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('gestor_general', '0003_auto_20200731_0106'),
]
operations = [
migrations.RenameField(
model_name='ansewer_post',
old_name='i... |
988,464 | 3d738de7c59a05e8083186aafefdceaf40493506 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from os.path import expanduser
from workWithModule import workWithModule
from basicCommands import basicCommands
from Googletts import tts
import xml.etree.ElementTree as ET
import os, gettext, time, sys, subprocess
# Permet d'exécuter la commande associée à un mot prononc... |
988,465 | 855f7302dbb2bd76ce17f299df090a3fb9f31008 | # Generated by Django 3.0.8 on 2020-08-12 22:46
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('data', '0001_initial'),
migrations.swappable_dependency(setting... |
988,466 | 960f40ac05845aafde22b636311a3c2186fbd44f | from typing import Generator
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from core.config import settings
from typing import Generator
# # For PostgreSQL
# SQLALCHEMY_DATABASE_URL = settings.POSTGRES_URL
# engine = create_engine(SQLALCHEMY_DATABASE_URL)
# For SQLite
SQLALCHEMY_DATAB... |
988,467 | 713730a20f151adf26f22c698a1e76bb4ea4537b | #! /usr/bin/python
#k-means clustering is a method of vector quantization,
#originally from signal processing, that is popular for cluster
#analysis in data mining. k-means clustering aims to partition n
#observations into k clusters in which each observation belongs
#to the cluster with the nearest mean, serving a... |
988,468 | d4842bf5d1f69425080dc5b39f090a4c64f0bfd7 | import pdb
import uuid
import json
import base64
import logging
from django.conf import settings
from django.core.files.base import ContentFile
from django.db.models import F
from django.shortcuts import render
from models import Card, ShareText, CardList
from users.models import UserProfile
from django.http import Jso... |
988,469 | e6bff741c074db80c0d1539bd48583284e392e6d | from django.db import models
# Create your models here.
class Home(models.Model):
title=models.CharField(max_length=50)
description=models.CharField(max_length=100)
Tech=models.CharField(max_length=50)
image=models.ImageField(upload_to='home')
project_link = models.URLField(max_length=100)
gith... |
988,470 | a37fcc090e40b7341fb75f620d92e8ef98f2e7be | class SegmentTreeNode:
def __init__(self, start, end) -> None:
self.start = start
self.end = end
self.left :'SegmentTreeNode' = None
self.right :'SegmentTreeNode' = None
self.val = None
class SegmentTree:
def __init__(self, seq) -> None:
self._seq = seq
... |
988,471 | 9a6670eb9c401fac00f7bfb56167499c6f04540b | # Copyright 2011 the original author or authors.
#
# 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 a... |
988,472 | 4ee8e9c6b876fe8cb6d07251dd175419a5c2effb | from flask import Flask
from flask_cors import CORS
from pymongo import MongoClient
from cashcog.config import DEBUG, MONGODB_CASHCOG_URI
app = Flask(__name__, static_url_path="/static/")
CORS(app)
app.debug = DEBUG
client = MongoClient(MONGODB_CASHCOG_URI)
db = client.expenses_db
from cashcog.routes import routes
|
988,473 | 89f042eca67cdbc4a683dfc67cfd42cddfd5af3e | tF = int(input("t = "))
tC = (tF-32)*5/9
print ("Температура в цельсиях = ",tC)
|
988,474 | 31446f6b0b53d409db359e54b00c1cfadd79784f | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 6 05:32:49 2018
@author: yahkun
"""
from random import randint, sample
# 每个字母代表一个球员
data = sample('abcdefg', randint(3, 6))
s1 = {x: randint(1, 4) for x in data}
s2 = {x: randint(1, 4) for x in data}
s3 = {x: randint(1, 4) for x in data}
#方法1
r... |
988,475 | 20e5a5c1abbc340132daaba27e8772bbdce297d3 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import numpy as np
a = np.array([[1, 2, 3],
[4, 5, 6]])
print(a)
b = a.ravel()
print('b', b)
c = a.flatten()
print('c', c)
a *= 10
print('a', a, 'b', b, 'c', c, sep='\n')
d = a.reshape(6)
print(d)
a += 1
print(a, d, sep='\n')... |
988,476 | f25ce7934b600306dabc2549817fffd392d73172 | #!/usr/bin/env python
import sys
from litter import LtrCli
if __name__ == "__main__":
LtrCli(sys.argv[1:])
|
988,477 | 2b758a484f159bf94f03d519925b09f3cf6002ee |
import numpy as np
import scipy.spatial.distance
import scipy.stats as st
import matplotlib.pyplot as plt
from ..search import get_distributed_recipes
from ..search import get_random_recipes
def compare_cluster_vs_random(cursor,ingred,metric,
num_recipes_list=[10,20,30],num_trials=10,
... |
988,478 | 4cc67c778d8ffb4a5033071cc3f19f34cf5b5629 | from abc import ABCMeta, abstractmethod
from typing import List
from core.customer.domain.customer import Customer
from core.customer.domain.customer_id import CustomerId
class CustomerRepository(metaclass=ABCMeta):
@abstractmethod
def find_by_id(self, customer_id: CustomerId) -> Customer:
raise Not... |
988,479 | 243fa72218e73d8833a69a878ccd4be88fa1af0e | import socket
import time
import os
UDP_MASTER_IP = "192.168.111.101"
UDP_MASTER_PORT = 5010
UDP_IP = "192.168.111.100"
UDP_PORT = 5006
UDP_IP_RPI = "192.168.111.99"
UDP_PORT_RPI = 5009
print "UDP target IP:", UDP_MASTER_IP
print "UDP target port:", UDP_MASTER_PORT
print "UDP receive IP:", UDP_IP
print "UDP receive... |
988,480 | 1c7bcd4286dde9628f7ccd81053479d25ecb46f5 | pessoa =[]
lista = []
maior = menor = 0
continuar = 's'
while continuar not in 'Nn':
pessoa.append(str(input('Informe o nome : ')))
pessoa.append(float(input('Informe o peso : ')))
if maior == 0:
maior = pessoa[1]
menor = pessoa[1]
if pessoa[1]>maior:
maior = pessoa[1]
if pe... |
988,481 | 4ff10f8499caea4d5b5b13c16eb0d1891621c0e7 | import requests
# 需要请求的目标地址
# 人人字幕
# url = 'http://www.zmz2019.com/user/user'
url = 'https://www.lmonkey.com/'
# 登录请求的地址
# 人人字幕
# login_url = 'http://www.zmz2019.com/user/login/ajaxlogin'
login_url = 'https://www.lmonkey.com/login'
# 请求头
headers = {
'User-Agent':
'Mozilla/5.0 (X11; Linux x86_64) AppleWebKi... |
988,482 | a25a2de708cb14227ad570dbf27fa39eae76c7f6 | class Bank:
# #static declaration
# @staticmethod
# def utility_method():#nothing related to object
# print("utility method")
#class method
@classmethod
def change_bank_name(cls):
cls.bank_name("SBI")
bank_name="sbk"
def create_account(self,acno,person_name,balance):
... |
988,483 | ca26ba9db40190b18b2a002ee0c6798187139297 | """
Demonstrates using an LJTick-DAC with the LabJackPython modules.
"""
import struct
import u3
# import u6
# import ue9
class LJTickDAC:
"""Updates DACA and DACB on a LJTick-DAC connected to a U3, U6 or UE9."""
EEPROM_ADDRESS = 0x50
DAC_ADDRESS = 0x12
def __init__(self, device, dioPin):
"... |
988,484 | e86ed3b75b3245c6dd2842862bc42e0896fcd766 | """
Configures pytest and fixtures for tests in this package
"""
import pytest
from src.app import create_app
from src.settings import TestConfig
def pytest_addoption(parser):
""" Allows us to add --runslow as an argument to py.test so we can run tests marked slow """
parser.addoption("--runslow", action="sto... |
988,485 | 95750b3e5c0bba9d131a176ded01c007f8b27f68 | a=100
b=200
product=a*1000
if product <=1000:
print(product)
else:
sum=a+b
print(sum) |
988,486 | 77f21b4877bdf776dc631c5d7209f8f8556a74d5 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Mar 27 11:18:12 2020
@author: lheusing
Work through the tutorial found at http://earthpy.org/pandas-basics.html
Time series analysis with pands written by nikolay koldunov
majority of commands done via shell line.
Essential commands saved to script
... |
988,487 | 3ffa12528440aecf584901e582e094fe8573f70e |
import json
f= open('./test_intensity.json','w')
import numpy as np
import os
root='./ActionUnit_Labels/'
subs=os.listdir(root)
data=[]
i=0
for sub in subs:
i=i+1
if i%5!=0:
continue
print(sub)
aus=os.listdir(root+sub)
arr=[]
for au in aus:
print(au[6:-4])
f2=open(root+... |
988,488 | 2b5befdb780c92cf6558b0e4d8d33286c1c7c041 | import keras
from keras.models import model_from_json
print('Started')
model = keras.applications.inception_v3.InceptionV3(include_top=True, weights= None, input_shape=(150, 150, 3), input_tensor=None, pooling=None, classes=1000)
print('Downloaded')
model_json = model.to_json()
with open("arch.json", "w") as js... |
988,489 | abedc93baade4c473a0e904ee616c7233808888d | # -*- coding: utf-8 -*-
"""
Created on Sat Jul 18 16:13:57 2020
@author: Shikhar Nathani
"""
print "Hello, world!"
|
988,490 | d23faab3739d96d02ab5ab03daf882da58fe994c | ## simple python script to take a list of customers and generate a MySQL enum for bugs.customer column definition.
# as of: June 4th 6pm
# -- ENUM('-','ALL CUSTOMERS','American Eagle','American Standard','APL','BMS','Cargill','CAT Logistics','CEVA','CEVA-Microsoft','Charming Shoppes','China Shipping','CNH','Cost Pl... |
988,491 | 16e18a740828ff563e5bda8d16eea401ed0cbf2f | from os import makedirs
from os.path import join
import click
APP_NAME = "McScript"
ASSET_DIRECTORY = join(click.get_app_dir(APP_NAME, roaming=False), "assets")
makedirs(ASSET_DIRECTORY, exist_ok=True)
LOG_DIRECTORY = join(click.get_app_dir(APP_NAME, roaming=True), "logs")
makedirs(LOG_DIRECTORY, exist_ok=True)
VER... |
988,492 | 6650fea9025381979c56b8c2b85dca81a907547c | #loops in Python
# use for loops over a list
numbers = [1,2,3,4,5]
for number in numbers:
print (number)
stocks = ["fb", "aapl", "nflx", "goog"]
for stock in stocks:
print (stock.upper())
|
988,493 | 250f9c71187da43868f4b8fb09daa34e24bb1b18 | # File generated from our OpenAPI spec
from __future__ import absolute_import, division, print_function
from stripe import util
from stripe.api_resources.abstract import APIResource
from stripe.api_resources.customer import Customer
from stripe.six.moves.urllib.parse import quote_plus
class CashBalance(APIResource):... |
988,494 | 85bbb88e9d4767f02efbad0e8e187d308d62c122 | from django.shortcuts import render, get_object_or_404
from .models import Skill
from random import shuffle
# Create your views here.
def skill(request, skill_id):
skill = get_object_or_404(Skill, pk=skill_id)
skill_questions = skill.skillquestion_set.all()
for q in skill_questions:
answers = [q.an... |
988,495 | 692aff7dba51c62bf238c2c67fdecf55c20331e9 | #!/usr/bin/env python3
#-*- coding: utf-8 -*-
import json
import re
import base64
import urllib.request
import urllib.error
import urllib.parse
import time
import html.parser
# Parameters
URL=""
USERNAME=""
PASSWORD=""
# Calculated parameters
TENANT=URL.split("//")[1].split(".")[0]
CLIENT_ID=URL.split("/")[-1]
# Con... |
988,496 | 0d72336563340d6390d2319d3d81deede2c6f4dd | # Copyright 2020 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import annotations
import tarfile
import textwrap
import zipfile
from io import BytesIO
from textwrap import dedent
import pytest
from pants.backend.python import target... |
988,497 | aefdd394cdd888d30c20f4ac8921be52958bc150 | #
# PySNMP MIB module VALERE-DC-POWER-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/VALERE-DC-POWER-MIB
# Produced by pysmi-0.3.4 at Wed May 1 15:33:30 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python version 3.7.3 (default... |
988,498 | 573298bcc65ad076bc71d5ccf1a10aa396cd82fd | # -*- coding: utf-8 -*-
import Aan
from Aan.lib.curve.ttypes import *
from datetime import datetime
from bs4 import BeautifulSoup
import time, random, sys, re, os, json, subprocess, threading, glob, string, codecs, requests, tweepy, ctypes, urllib, urllib2, wikipedia
import requests
from gtts import gTTS
import goslat... |
988,499 | 0bcc4feb3099494ea47ac91de76061cdc5160dbc | # -*- encoding: utf-8 -*-
##############################################################################
#
# Purchase - Computed Purchase Order Module for Odoo
# Copyright (C) 2013-Today GRAP (http://www.grap.coop)
# @author Julien WESTE
# @author Sylvain LE GAL (https://twitter.com/legalsylvain)
#
# Thi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.