index int64 0 1,000k | blob_id stringlengths 40 40 | code stringlengths 7 10.4M |
|---|---|---|
984,800 | ffdb8ad8b6135ffb9c3ae09efc589bd0d9ff365d | from django.db import models
from django.core.urlresolvers import reverse
from django_markdown.models import MarkdownField
class ProjectQuerySet(models.QuerySet):
def published(self):
return self.filter(published=True)
class Project(models.Model):
name = models.CharField(max_length=200)
subtitle =... |
984,801 | 1c18a951d1309db892948b3a4271557a4aec09e6 | import math
angulo = float(input('Digite o angulo: '))
sen = math.sin(math.radians(angulo))
cos = math.cos(math.radians(angulo))
tan = math.tan(math.radians(angulo))
print('O valor de seno é {:.2f}, de cosseno é {:.2f} e da tangente é {:.2f}.'.format(sen, cos, tan)) |
984,802 | 6718d78f6489fb133b1d76ad493b8021be719083 | # -*- coding: utf-8 -*-
#sender identifying code by email or mobile
import sys
import smtplib
import requests
import random
from django.core.cache import cache
from celery import shared_task
from email.mime.text import MIMEText
from ourpro_config import email_password, mobile_api_key
reload(sys)
sys.setdefaultencodin... |
984,803 | 58d64628fa854eb57cf50e28faf34b1de31063b2 | # ======================
# | STANDARD EXERCISES |
# ======================
# EXERCISE 1
# Standard Exercise 1 - Creating a dictionary
# First, create an empty dictionary
# Then, add a key-value pair to it. Have the key be 'my_favorite_class'
# and the value be the name of your favorite Nueva class.
# Standard Exerci... |
984,804 | b528c48661e468c371341ecfcdbc51cf434c6bbe | '''
Created on my MAC Jun 10, 2015-2:59:54 PM
What I do:
edge feature between doc obj
for now only use facc confidence?
What's my input:
doc, obj
What's my output:
hFeature for them
@author: chenyanxiong
'''
'''
Again I am just a virtual to show API
'''
import site
site.addsitedir('/bos/usr0/cx/PyCode/cxPyLib')
site... |
984,805 | c932220f1da87cc47d0b682ca9cfaaf51560e646 | import os
import json
file = "528884874493_Config_us-east-1_ConfigHistory_AWS__AutoScaling__AutoScalingGroup_20181011T012430Z_20181011T012430Z_1.json"
with open (file, 'r') as json_file:
json_obj = json.load(json_file)
json_str = json_obj['configurationItems']
for i in json_str:
print(i['resourc... |
984,806 | 613a992e3327ee7da074a6a43462d2d05d6717f8 | #
# @lc app=leetcode.cn id=85 lang=python3
#
# [85] 最大矩形
#
# https://leetcode-cn.com/problems/maximal-rectangle/description/
#
# algorithms
# Hard (45.24%)
# Likes: 374
# Dislikes: 0
# Total Accepted: 23.7K
# Total Submissions: 52.3K
# Testcase Example: '[["1","0","1","0","0"],["1","0","1","1","1"],["1","1","1",... |
984,807 | 12ac1d84657af0508b4ab8e9a321b58fdbdc14c3 | from . import util
from . import domain
#from . import plotting
|
984,808 | db6dcd75603941c9b0b364580fa842ac11c232c2 | # -*- coding: utf-8 -*-
import os
import sys
import subprocess
import logging
from glob import glob
logger = logging.getLogger(__name__)
def main(app_dir):
cwd = os.getcwd()
pkg_dir = os.path.join(app_dir, 'packages')
eggs_dir = os.path.join(app_dir, 'eggs')
env = dict([(k, os.environ[k... |
984,809 | fcfcf46792efba3fd19441a94ae66df015a97cd6 | bl_info = {
"name" : "My_addon",
"author" : "brandon humfleet",
"description" : "test addon",
"blender" : (2, 80, 0),
"location" : "View3D",
"warning" : "",
"category" : "Generic",
}
import bpy
class Test_PT_Panel(bpy.types.Panel):
bl_idname = "Test_PT_Panel"
bl_label = "Test Panel... |
984,810 | 1fdc9abaac47d04f48ac834261669fdaa2c143ff | # $ python3 -m pip install pyserial
# /dev/cu.usbserial-<XYZ> for mac,
# ...you can find your XYZ using $ python3 -m serial.tools.list_ports -v
# ...it might also be something like /dev/cu.usbmodem<XYZ>, depending on the USB Serial adapter
# My XYZ is "FTVHYZXQ", which matches my USB Serial adapter, model n... |
984,811 | 9dd7e183540b544ae1c93a2071e6954fec38b9fb | # The equation solved is the parabolic equaiton
#
# du d du
# -- = k -- --
# dt dx dx
#
# along with boundary conditions
import matplotlib.pyplot as plt
import matplotlib
import numpy as np
import scipy as sc
import scipy.sparse
import scipy.sparse.linalg
import time
# change some default v... |
984,812 | 400ce82f1014ed63276119cde683ea6bf3a4735e | from django_elasticsearch_dsl import Document
from django_elasticsearch_dsl.registries import registry
from elasticsearch_dsl.connections import connections
from wagtail.search import index
from .models import Employee
from .models import Company
connections.create_connection(hosts=['localhost'])
@registry.register... |
984,813 | b1f5f1ea38464965e32fbf9f75bc600f9d65b079 |
import numpy as np
import tensorflow as tf
import time
from tensorflow.contrib import slim
def trainer(input_dim, num_samples, dataset, learning_rate=1e-3, batch_size=100, num_epoch=75, n_z=10):
#input_dim = (28,28)
model = VariantionalAutoencoder(input_dim, learning_rate=learning_rate,
... |
984,814 | d3c4838c5e2109fbbaa3316770282225c5a3f021 | from spotipy.oauth2 import SpotifyOAuth
import spotipy
from bs4 import BeautifulSoup
import requests
import os
#You need to declare env variables with your spotify developer account credentials. Create one in https://developer.spotify.com/
SPOTIPY_CLIENT_ID = os.getenv("SPOTIPY_CLIENT_ID")
SPOTIPY_CLIENT_SE... |
984,815 | 8a55b79fa28db96a95a86f8d29e056f37ed00480 | # BASIC PLOTTING WITH MATPLOTLIB
# You can show matplotlib figures directly in the notebook by using the %matplotlib notebook and %matplotlib
# inline magic commands.
# %matplotlib notebook provides an interactive environment.
# So what actually has happened when you run the magic function matplotlib with the inli... |
984,816 | 8660a0eed2267f39cf838804476bb9bd14000803 | import os
class wifi():
def __init__(self):
self.ssid = ''
self.wpa = 0
self.psk = ''
self.wep = False
self.key_mgmt = ''
class wifilist():
def __init__(self):
out = os.popen("sudo iwlist wlan0 scanning | sed 's/^ *//'").read()
outArray = out.split('\n')... |
984,817 | 5f37b1c2be0763249300891a751840c6d0e3d286 | import datetime
import urllib.request
import discord
from discord.ext import commands
import os
import errno
class General():
def __init__(self, bot):
self.bot = bot
@commands.command()
async def update(self, ctx, server_id: int = 150):
"""
https://board.fr.ogame.gameforge.com/in... |
984,818 | f0b21fd7f3eab8a7780b4b4338d967847e24a990 |
import os
from flask import render_template
from slugify import Slugify
from WaterTesting import app
from WaterTesting.parse_data import build_source_summary
#~ import flask, flask_frozen
#~ flask.url_for = flask_frozen.url_for
ROOT_DIR = os.path.dirname(os.path.realpath(__file__))
SLUG = Slugify(to_lower=True)
#~... |
984,819 | a4ee2f15b4b08d3dce47167bf191df4818a574fb | import pickle
# file_path="../dataset/iwslt14.tokenized.de-en/"
bin_path='../dataset/test_bin/'
file_path='../dataset/test/'
data_name=['test','valid']
languages=['en','de']
for language in languages:
current_dict={}
current_dict['<padding>']=0
current_dict['<sos>']=1
current_dict['<eos>']=2
... |
984,820 | 852f83462a1e03e8127726b4a412db1b76fbcb38 | import os
import numpy as np
import pandas as pd
import argparse
import matplotlib.pyplot as plt
from scipy import stats, sqrt
from sklearn.metrics import mean_squared_error
from sklearn.decomposition import PCA
from sklearn.preprocessing import StandardScaler
from sklearn.svm import SVR
from sklearn.linear_mo... |
984,821 | be2ba44d29c3158b4b7ec024649eca8bdc5c8a61 | #Exercise 29: What if
people = 15
cats = 400
dogs = 20
if people < cats:
print "Too many cats! The world is doomed!"
if people > cats:
print "Not many cats! The world is saved!"
if people < dogs:
print "The world is Grand!"
if people > dogs:
print "The world is boring!"
dogs += 5
if p... |
984,822 | 46704890599be7c329cf6415c4a30e9bacafeef0 | #!/usr/bin/env python3
# vim: fileencoding=utf-8 expandtab ts=4 nospell
# SPDX-FileCopyrightText: 2020 Benedict Harcourt <ben.harcourt@harcourtprogramming.co.uk>
#
# SPDX-License-Identifier: BSD-2-Clause
"""Create GitHub annotations from pylint output"""
from __future__ import annotations
from typing import List
i... |
984,823 | 9eef3293b55f243f375a198196c5aa8f518c704a | '''
Created on Jan 28, 2015
@author: kyleg
'''
if __name__ == '__main__':
pass
from arcpy import env, AcceptConnections, CreateVersion_management, Compress_management, RebuildIndexes_management, ListVersions, ReconcileVersions_management, AnalyzeDatasets_management
#import datetime
connection = r'D:\SCHED\SDEPR... |
984,824 | e9b186a3f82899a1f3c742396cb3582d060b1e50 | import os
import boto3
from dotenv import load_dotenv
import pymongo
from pymongo import MongoClient
def get_file():
load_dotenv()
aws_access_key_id = os.getenv('aws_access_key_id', None)
aws_secret_access_key = os.getenv('aws_secret_access_key', None)
bucket_pandas = os.getenv('bucket_pandas', None)
... |
984,825 | 38bb2df354088be5203fa008be5646833b5e762a | n = int(input())
if n % 2 != 0:
print(0)
else:
ans = 0
t = 10
while n >= t:
ans += n//t
t *= 5
print(ans) |
984,826 | f8bed1cc904fd81b718658b6021f8ef17ac4a2f5 | '''
Project: Gui Gin Rummy
File name: utils_extra.py
Author: William Hale
Date created: 3/14/2020
'''
from PIL import Image, ImageDraw, ImageFilter
def rounded_rectangle(self: ImageDraw, xy, corner_radius, fill=None, outline=None): # FIXME: not used
upper_left_point = xy[0]
bottom_right_poin... |
984,827 | eefcde5990d146cc9fd9c0d25e9b10d0c9beaebb | # coding=utf-8
import ICP_pos
import ip
import Queue
import threading
import requests
import chardet
import urllib2
import datetime
import re
import time
import sys
sys.path.append("..") # 回退到上一级目录
import database.mysql_operation
'''同步队列'''
domain_q = Queue.Queue()
dm_page_icp_q = Queue.Queue()
res_q = Queue.Queue()
... |
984,828 | dfee3e5424e09e048a0b7b3c4b592d893cd9912e | from BinaryTress.BinarySearchTree import Tree
from array import array
tree = Tree()
tree.seed(50)
a = array('i', [3, 70, 1, 40, 6, 4, 120])
for val in a:
tree.insert(val)
tree.traverse()
root = tree.root
succ = Tree.inordersuccessor(70, root)
pred = Tree.inorderpredecessor(70, root)
print("Maximum Node :", tree.... |
984,829 | 661c87edceee157b7346df666613fa6a40fb4d22 | import re
import datetime
from django import forms
from django.forms.extras.widgets import SelectDateWidget
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext, ugettext_lazy as _
from . import models
def v_err(flaw):
"""Raise validation error with the proper error me... |
984,830 | 929dd17f4684e8d0848094864ebc5b1bee5bfada | import re
img_path = "/Users/DD/Developer/website/Classmates-Website/img/china.svg"
data_path = "/Users/DD/Developer/website/Classmates-Website/others/pname.txt"
pattern = "title=\"(.*)\""
wfile = open(data_path, "w")
with open(img_path, 'r') as f:
while True:
line = f.readline()
if not line:
break
else:
... |
984,831 | 1a1611cb1df8f3c422fba6ae81a458af69814f26 | from terminaltables import SingleTable
from helpers import pretty_print
from messages import help as console_messages
class Help:
def __init__(self):
self.table_title = 'Help Section'
self.table_data = (
('Command', 'Description'),
(console_messages['account_info']['command... |
984,832 | ff434de032bc3bb8d17a21cd4c2e1765dfbcfd71 | #Author: Justin Roberts
#Date: 22 March 2018
#A helper script for running your IBM Quantum Experience scores
#The following implements a quantum score for examining 16 qubit entanglement on ibmqx5
print("\nconnecting....")
#import matplotlib.pyplot as plt
#from qiskit.tools.visualization import plot_histogram
#You ca... |
984,833 | be6c25240a60ec137b4120a02e1cb509ee5e7cb4 | from tkinter import *
import tkinter.messagebox as messagebox
JOGADOR = 0
VALORES = ['X', 'O']
BOTOES = {}
TAB = []
JOGANDO = True
def callback(pos):
"""
Lida com o evento do pressionamento de um botão
Recebe a posição de pressionamento do botão
"""
# Declara as variáveis globais
global ... |
984,834 | 3f0fd41fc1d1ca561fd9abb678b45568258226ff | from logger.station import Station, Metadata
from common.exceptions import StationParseError
import datetime
class XMHits1Station(Station):
_NAME = 'XMHits1'
_SHORTNAME = 'XM1'
_URL = 'https://www.siriusxm.com/metadata/pdt/en-us/json/channels/siriushits1/timestamp/{XMTS}'
def getUrl(self):
d... |
984,835 | 41eb2f8170668fd71c0217b68996e9d4e638820e | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Author : RaXianch
# CreatDATE : 2021/8/21
# CreatTIME : 19:58
# Blog : https://blog.raxianch.moe/
# Github : https://github.com/DeSireFire
__author__ = 'RaXianch'
MYSQL_HOST = '128.0.0.1'
MYSQL_USER = '2333'
MYSQL_PORT = 3306
MYSQL_PASSWORD = '2333'
MYSQL_DB... |
984,836 | da3aee51d7291b10c940e00d447c0f2e93c1bcbc | # -*- coding: utf-8 -*-
"""
Created on Fri Sep 15 23:44:20 2017
@author: Alexandre
"""
############## FILE AKMC_test1.py
from time import time
a=time()
import module_site_deux as mc
from random import randint
size = 50
e_aa = 0
e_ab = 0
e_bb = 0.21
proportion_b = 0.9
systeme = mc.system (size)
systeme.set_maille([(... |
984,837 | bcafe63907245417883e6dcfad56c2b69edf131e | from django.contrib import admin
from visa_app.models import Contact
from visa_app.models import Index
# Register your models here.
admin.site.register(Contact)
admin.site.register(Index) |
984,838 | 98e060e819f3db238aa50532b2ce09477c9ee2f9 | import matplotlib.pyplot as plt
import matplotlib.animation as animation
import matplotlib.cbook as cbook
import time
import numpy as np
fig = plt.figure()
fig.canvas.set_window_title('Frames Alive Graph')
ax1 = fig.add_subplot(1,1,1)
def animate(i):
fname = cbook.get_sample_data('C:\\Users\\yotxb\\Des... |
984,839 | a6c901f8081ee261f30a4bf8e7133eeaf196c24c | # Generated by Django 2.2.3 on 2019-07-25 06:58
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('mainapp', '0007_auto_20190725_1558'),
]
operations = [
migrations.AddField(
model_name='product',
... |
984,840 | 21a8a7a45d5ac1cd05174de59e36f1ac44ca57d7 | import sys
from trade import main
if __name__ == '__main__':
main.set_loggers()
main.main(sys.argv[1:]) |
984,841 | f361fd23d36a6da6b01cd59004ef8177d464744e | t = int(raw_input ())
for i in range (t):
dict = {
'B':0,
'R':0,
'O':0,
'K':0,
'E':0,
'N':0,
}
s = raw_input ()
for c in s:
if c in dict:
dict[c] = dict[c] + 1
if len (set (dict.values())) == 1:
print "No Secure"
else:
print "Secure"
|
984,842 | 73c2ae2738aaf5af229e07f5f726e1096e2f8122 | import pyodbc
#import pymssql
import json
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(("8.8.8.8", 80))
print(s.getsockname()[0])
s.close()
# Load credentials from json file
with open("azure_db_settings.json", "r") as file:
creds = json.load(file)
server = cred... |
984,843 | bcfc6405b1c200badfeb4d10676196848a4a1f6f | # -*- coding: utf-8 -*-
a=int(input('Digite a :'))
fatorial=1
i=1
for i in range (1,(a+1),1):
fatorial=fatorial*1
print(fatorial) |
984,844 | e610f69fdb404ea2cb0d62fbbe24e862a680611d | import pyodbc
class Database:
def __init__(self, server='DESKTOP-ALESSIA' , username='ALESSIA', password='database', database='TEST', table_name='FILM'):
self.server = server
self.database = database
self.username = username
self.password = password
self.table_name = table_name
self.cnxn = pyodbc.connect(... |
984,845 | 2b4cfcdb558b92ffbf42ea6d17392b4a27b2e7d0 | import json
import requests
from datetime import datetime
from config import API_KEY, PLAYER_LIST
from DBOper import get_playing_game, update_playing_game
def gaming_status_watcher():
replys = []
status_changed = False
sids = ','.join(str(p[1] + 76561197960265728) for p in PLAYER_LIST)
r = requests.get... |
984,846 | bfb4863d6c708a044ecc862c8c37ab38977f4b6b | # -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'Backlink.href'
db.alter_column(u'trovetraces_backlink'... |
984,847 | c448e3bb4a13f931d187aa74b757f5ed977cc76e | import pyodbc
# Some other example server values are
# server = 'localhost\sqlexpress' # for a named instance
# server = 'myserver,port' # to specify an alternate port
server = 'tcp:172.20.200.252,8629'
cnxn = pyodbc.connect('DSN=TDB;UID=icam;PWD=kfam1801')
cursor = cnxn.cursor()
#Sample select query
cursor.execute(... |
984,848 | 668d02ddc9d4bbb66c12d5b90f1d7f8666bb114e | #!/usr/bin/env python
def Permutations(iterable, r=None):
pool = tuple(iterable)
n = len(pool)
r = n if r is None else r
if r > n:
return
indices = range(n)
cycles = range(n, n-r, -1)
yield tuple(pool[i] for i in indices[:r])
while n:
for i in reversed(range(r)):
... |
984,849 | 9d30de79f7773cb7300415cd41b049e08b2f3ad0 | from django.db import models
class Category(models.Model):
id=models.AutoField(primary_key=True)
name=models.CharField(max_length=50,default='a')
keywords=models.CharField(max_length=50,default='a')
def __str__(self):
self.name
# Create your models here.
|
984,850 | 9ab76b46d59a0383b9de21893c2a90296e32fcf3 | import pandas as pd
import sklearn.feature_selection as fs
import numpy as np
import os
def data_import(path):
data = pd.read_csv(path, sep=";")
data = data.replace(',', '.', regex=True)
data.columns = [c.replace('.', '_') for c in data.columns]
data = data.loc[:, (data != 0).any(axis=0)]
return d... |
984,851 | 913b0d16a68cd1df6dec4fa736466938291556e5 | #!/home/jhdavis/anaconda3/envs/default/bin/python3
# -*- coding: utf-8 -*-
"""
@author: jhdavis@mit.edu : github.com/jhdavislab
"""
import argparse
import os
import edit_cs
import numpy as np
def crop_stack(input_stack, output_stack, dim_x, dim_y, e2_path=''):
if e2_path == '':
e2_path = 'e2proc2d.py'
... |
984,852 | c0cdecfe121ec4616561ab8f42a4252006e9ceae | from sortedcontainers import SortedDict
"""
@author Anirudh Sharma
Given a binary tree, print the bottom view from left to right.
A node is included in bottom view if it can be seen when we look at the tree from bottom.
Constraints:
1 <= Number of nodes <= 10^5
1 <= Data of a node <= 10^5
"""
def bottomView(root):
... |
984,853 | 7e5f9155c0e22abb671c826d940da51c3ba46294 | # manual function to predict the y or f(x) value power of the input value speed of a wind turbine.
# Import linear_model from sklearn.
import matplotlib.pyplot as plt
import numpy as np
# Let's use pandas to read a csv file and organise our data.
import pandas as pd
import sklearn.linear_model as lm
# read the datase... |
984,854 | 326fa1c08f14885d644a823533d2c75865428d36 | #!/usr/bin/python
import sys
import os
import optparse
from gtclib import golive
DEPLOYMENT_NAME='deploy'
if __name__ =='__main__':... |
984,855 | 813cd1996e16971dd246e4c2646839143056289e | import os
emails = set()
for dir in os.listdir("final_project/emails_by_address"):
s = dir.find("from_")
if s == -1:
s = dir.find("to_")
e = dir.find("@", s + 3)
emails.add(dir[s + 3:e])
else:
e = dir.find("@", s + 5)
emails.add(dir[s + 5:e])
with open("final_pr... |
984,856 | a855b3b3dc8d05663f0a573ae912a418dc8b4e82 | from django.urls import path,include
from test_app import views
from django.contrib.auth import views as auth_views
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
path('', views.LoginView, name='login'),
path('admin_dashboard', views.admin_Dashboard, name='admin_d... |
984,857 | cd71ffec76fb50dca68af0343da648d3a6db99eb | import os
import glob
from skimage import io
import numpy as np
import click
@click.command()
@click.option("--base-dir", required=True, help="PROBA-V root downloaded dir.")
@click.option("--out-dir", required=True, help="Output where to save the pickles.")
@click.option("--band", required=True, help="RED|NIR band."... |
984,858 | 21967d930266438143ca2f6abf49d50572a5207a | #!/usr/bin/env python
name1 = "Dave"
name2 = "Shelly"
name3 = "Corey"
name4 = input("Enter fourth name: ")
print()
print("{:>30}".format(name1))
print("{:>30}".format(name2))
print("{:>30}".format(name3))
print()
|
984,859 | 0560fc1bd23b3ea7079eacbfab95c2ac91d1399c | BUCKET_NAME = 'company-crawler-check'
AUTOMI_LOCAL_LAPTOP_PRODUCTION = "automi-local-laptops-production"
OFFLINE_RESPONSE = "Offline-Response"
FINAL_JSON = "finalJson"
JSON_UPLOAD = "jsonUpload"
PROFILE_JSON = 'profileJSON'
COMPANY_HTML = "companyHTML"
PROFILE_HTML = "profileHTML"
ZIP_FILE = "zipFile"
LOCAL_FILE_PATH =... |
984,860 | e4bae58f7c9d861a28f794b1eb56aae2722bb317 | from behave import *
from features.pages.main_page import MainPage
from pages import LoginPage
@given('I open {page_name} page')
def step_impl(context, page_name):
base_url = context.config.get('settings', 'base_url')
if page_name == "home":
context.driver.get(f'{base_url}')
context.current_p... |
984,861 | b15e5508a2636b554452f8cd44bd6297d0847082 | #!/usr/bin/python
# -*- coding: UTF-8 -*-
import logging
import cymysql
import time
import sys
import socket
import config
import json
import urllib2, urllib
class DbTransfer(object):
instance = None
def __init__(self):
self.last_get_transfer = {}
@staticmethod
def get_instance():
i... |
984,862 | c69876fc0eded570b99f93036f9bbef62452521d | from flask import Flask
from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
class Users(db.Model):
__tablename__ = "users"
email = db.Column(db.String(120), primary_key = True, nullable = False)
password = db.Column(db.String(80), nullable = False)
timestamp = db.Column(db.DateTime, nullable = F... |
984,863 | 73c0071c72b93acd9e16db707896eabcf92f6368 | import os
import csv
from pathlib import Path
# Path to collect data from the Resources folder
bank_csv = os.path.join("Resources", "budget_data.csv")
# Define variables
months = []
profit = []
profit_change = []
# Open the CSV and store the contents
with open(bank_csv) as bankfile:
csvreader = csv.reader(bankfi... |
984,864 | ea2bccf3ff227bb274f9c590d3a29b76dd577a79 | class Trabalhador:
def __init__(self, nome) -> None:
self.__nome = nome #atributo privado da classe
self.__ferramenta = None
@property
def nome(self):
return self.__nome
@property
def ferramenta(self):
return self.__ferramenta
@ferramenta.setter
def fer... |
984,865 | d5489d4c489424ff11b99686e9d76885b69abb34 | class Posts:
def __init__(self):
self.text = None
self.time = None
self.reshare_count = None
self.status_id = None
self.user = None
self.resharers = None
self.keyword = None
def set_text(self, text):
self.text = text
def set_time(self, time):... |
984,866 | 38b81c894e18d45a6161e271ae633710224ad2c7 | import cv2
import numpy as np
import matplotlib.pyplot as plt
#read image and IMREA_GRAYSCALE to convert image in grayscale substitude is 0
img = cv2.imread('D:/d.jpg' ,cv2.IMREAD_COLOR)
#lineDraw
cv2.line(img , (0 ,0) , (150 , 150) , (255 , 0 , 0) ,10)
#line Rectangle
cv2.rectangle(img ,(15 ,25),(200 , 150 ), (0, ... |
984,867 | 5293dde84aa260ab0054b6656e5f4cca3377611c | from PyQt5 import (QtWidgets, QtCore, QtGui)
from PyQt5.QtWidgets import qApp
import cyberchorus
import sys
WINDOW_X_DIM = 500
WINDOW_Y_DIM = 100
aboutText = ['About', 'Developed by Benjamin Swanson and Noah Brown. Thanks for using our software! <license info here>']
helpText = ['Help', '<help text here>']
# Displa... |
984,868 | 2faaa9cdeee2c5cd76865ddae9a5528c9e478699 | from config import *
def main():
# load the todo pointing list
input_filename = rawdata_dir + 'todo_list.dat'
sys.stderr.write('Loading from file {} ...\n'.format(input_filename))
input_file = open(input_filename, 'rb')
todo_list = pickle.load(input_file)
input_file.close()
# loa... |
984,869 | e1111bb43b865b90ed9bdd692f1059e4e39d3d18 | import os
import shutil
from collections import namedtuple
from functools import reduce
from tabulate import tabulate
FileSystemUsage = namedtuple(
'FileSystemUsage',
['total', 'used', 'free', 'percent_used']
)
DirectoryDiskUsage = namedtuple(
'DirectoryDiskUsage',
['name', 'f... |
984,870 | 8d93016c2ce4c86e05c3b2881e1d5f675d468787 | import os
from .trex_reader import TREx
def load_db_general(path, **kwargs):
subs = os.listdir(path)
ret = {sp: [] for sp in ['train', 'dev', 'test']}
print('loading from', path)
for sp in ret:
files = {sub: os.path.join(path, sub, f'{sp}.jsonl') for sub in subs}
ret[sp] = TREx(files,... |
984,871 | 3b5b74388c2b1ca1a6ae8c48ba9e340bcb16e502 | # to run it
#python algPTR.py arg1 arg2 arg3
# db=twitter
# collection=refugees
#arg1 db, arg2 collection, arg3 nome file tweet, arg4 time or not (1,0), arg5 num iterations or num days , arg6 file con i seed, arg 7 param
def clean_collection(collection):
#print "Cleaning..."
collection.update({}, {'$unset': {... |
984,872 | 5485f50d5fa0c8cd44a4d8c242a832c98dbf677d | input1 = int(input("Input N: "))
input2 = int(input("input M: "))
count = 0
matrix = []
for i in range(input1):
a =[]
for j in range(input2):
a.append(int(input(f"Input value A[{i+1}][{j+1}]")))
matrix.append(a)
for i in range(input1):
for j in range(input2):
if matrix... |
984,873 | 64b6364df3d0c0117b151644a99477001b4691b8 | from math import *
import random
import sys
import pygame
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import tensorflow
import keras
from keras import layers
from keras.models import Model
from keras import backend as K
from keras import utils as np_utils
from keras import optimizers
from ker... |
984,874 | 6ad98bc71f0c5b433bb584470e7a39bc5eb4b276 |
#!/usr/bin/env python
# mocks.py: Mock objects for low-level peripheral/hardware-related modules
''' To-Do:
- add iterable support channels passed to GPIO
- add GPIO pull-up/pull-down support
- add event detection support
'''
__author__ = 'Trevor Allen'
# trevor's github https://raw.githubusercontent.com/TCAllen... |
984,875 | 0e7ce8bb7a17812fa1569599cff5c2867d45915d |
# given a list of strings, return a list of the strings, omitting any string length 4 or more
def no_long(strings):
new_list = []
for x in strings:
if len(x) < 4:
new_list.append(x)
return new_list
print(no_long(['this', 'not', 'too', 'long']))
print(no_long(['a', 'bbb', 'cccc']))
pr... |
984,876 | 981f2a932ae20fde05bffa24aeafd7773855c7d0 | # -*- coding: utf-8 -*-
from __future__ import division
def media(lista):
soma = 0
for i in range(0,len(lista),1):
soma = soma + lista[i]
resultado = soma/len(lista)
return resultado
n=input('digite a quantidade de termos das listas:')
a[]
b[]
for i in range(0,n,1):
a.append(input('digite o... |
984,877 | fe75a3bfea7869ddb588de6a4ee83b5563f0015e | # Generated by Django 2.0.2 on 2018-06-28 00:36
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('matches', '0024_auto_20180627_2353'),
]
operations = [
migrations.AddField(
model_name='matches',
name='score_after_... |
984,878 | 7370831ef303ebb17f38cfb0b4858b6406056c2b | """The SalesChannel class."""
class SalesChannel:
"""Container for Cloud Commerce Sales Channels."""
def __init__(self, data):
"""Set attributes from API data."""
self.json = data
self.id = data.get("ID", None)
self.name = data.get("Name", None)
self.domain = data.get(... |
984,879 | 624747133b122b41c43cc7109c2913137e96cd78 | # coding:utf-8
import ConfigParser
import cookielib
import urllib
import urllib2
import os
from scrapy.selector import Selector
from PIL import Image
import sys
reload(sys)
sys.setdefaultencoding("utf-8")
class WeiboCookie:
def __init__(self):
# 定义属于自己的opener,获取记录在登陆过程中返还的cookie
... |
984,880 | e35d4579c2b2f5d8b3d9f2b1a02005253ca38937 | NomeCompleto = str(input('Digite seu nome completo: ')).strip()
print('Seu nome em letras MIÚSCULAS fica: {}'.format(NomeCompleto.upper()))
print('Seu nome em letras minúsculas fica: {}'.format(NomeCompleto.lower()))
print('Seu nome possui {} letras'.format(len(NomeCompleto)-NomeCompleto.count(' ')))
PrimeiroNome = Nom... |
984,881 | 99033f65693588eadea1f514ab81dd4179cb78c7 | # if asked to return list of TreeNodes
class Solution(object):
def generateTrees(self, n):
"""
:type n: int
:rtype: List[TreeNode]
"""
return self.helper(1, n)
def helper(self, min_, max_):
result = []
if min_ > max_:
return result
... |
984,882 | d2ce6dda9027dfd18c3609b65588d64c474f85e0 | import csv
currencyList = {}
dictRow = {}
with open('data/iso4217.csv') as csvfile:
readData = csv.reader(csvfile, delimiter=',')
next(readData)
for row in readData:
#print("'",row[0].lower(),"': {'symbol': '",row[0],"', 'numcode': ",row[1],", 'decimals': ",row[2],"'name': '",row[3],"'}",sep='',fl... |
984,883 | 9c1d542ccdf8ff3d5adb1ecdb637865da1fbbe95 | import unittest
from two_sum import two_sums, two_sums_brute_force
class TestTwoSums(unittest.TestCase):
@classmethod
def setUpClass(self):
self.nums = [2, 7, 11, 15]
self.target = 9
self.wrong_target = 8
def test_two_sums(self):
test = two_sums(nums=self.nums, target=sel... |
984,884 | c02bef95068e56b16ca3921a939554b6ca75b428 | from django.contrib import admin
from products.models import Product
# Register your models here.
class ProductAdmin(admin.ModelAdmin):
'''
To display slug values in admin (related to products)
'''
list_display = ['__str__','slug']
class Meta:
model = Product
admin.site.register(Product,... |
984,885 | d6fe89d1c6bdd3fe5beedc9382c8611692a9ab53 | import discord
import asyncio
import youtube_dl
from os import system
from itertools import cycle
from discord.utils import get
from discord.ext import commands
from discord import FFmpegPCMAudio
# /********************INCLUDE TOKEN BEFORE TEST********************************/
TOKEN = ''
client = commands.Bot(comman... |
984,886 | 5f6e2b0f2b85ff07b6e8b57377d142e82846d5d1 | # App Sizes
APP_WIDTH = 800
APP_HEIGHT = 800
CELL_SIZE = 20
# Color Definitions
COLOR_BLACK = (0,0,0)
COLOR_WHITE = (255,255,255)
COLOR_GREY = (100,100,100)
COLOR_PURPLE = (255, 0, 255, 150)
COLOR_GREEN = (0, 255, 0, 100)
# Surface Colors
COLOR_DEFAULT_BG = COLOR_GREY
# App Render Speed
RENDER_SPEED = 60
|
984,887 | 41e0368001008d893db2db5ed65283ed3f45b9b0 | from math import pi
class Algorithm:
def __init__(self, thresholdSensor1, thresholdSensor2, maxAngle, armLength, speed):
#Stelt de thresholdwaardes in:
self.thresholdSensor1 = thresholdSensor1
self.thresholdSensor2 = thresholdSensor2
#Stelt de fysieke parameters van de arm in:
... |
984,888 | a62f59dd1468332dbeabf3194e528b604961d38a | #!/usr/bin/python
# -*- coding: utf-8 -*-
# General
import os, sys, math
# Happy
try :
from happy.utils import *
except :
from utils import *
try :
from happy.plot import *
except :
from plot import *
# Stats
from scipy.signal import savgol_filter # SmoothingAUC
from scipy.signal import find_peaks ... |
984,889 | 230ab9993b20eb715146ddcc3003b212acbd6241 | # Distributed with a free-will license.
# Use it any way you want, profit or free, provided it fits in the licenses of its associated works.
# AD5252
# This code is designed to work with the AD5252_I2CPOT_1K I2C Mini Module available from ControlEverything.com.
# https://www.controleverything.com/content/Potentiometers... |
984,890 | 63c4b38dfc8dd5fe1590c748ea951b5916f5caeb | import os
import errno
import numpy as np
from math import pi
import pandas as pd
import seaborn as sns
from decimal import Decimal
from collections import Counter
import matplotlib.pyplot as plt
from bokeh.transform import cumsum
from bokeh.io import output_file, show
from bokeh.core.properties import value
from bokeh... |
984,891 | 983070ba80ef997e57fccba159e9c909fec7785d | # -*- coding: utf-8 -*-
"""
Created on Sat Mar 14 12:41:38 2020
@author: Jake Frazer
"""
import numpy as np
import matplotlib.pyplot as plt
# blackjack probabilities - without draws
p_win = 0.464
p_lose = 0.536
# blackjack probabilities - with draws
p_win = 0.4243
p_lose = 0.4909
p_draw = 0.0848
# simulating playin... |
984,892 | c9df73016547ba9230fa67eff32a73c251eabcbd | #!/mnt/ilustre/users/sanger/app/Python/bin/python
from mbio.workflows.single import SingleWorkflow
from biocluster.wsheet import Sheet
wsheet = Sheet("/mnt/ilustre/users/sanger-dev/sg-users/jinlinfang/tooltest/mapsplice_map_single.json")
wf = SingleWorkflow(wsheet)
wf.run() |
984,893 | 38b8faff9dfd248b60e6a44a69b48ed901037e66 | # emacs: -*- mode: python; py-indent-offset: 4; tab-width: 4; indent-tabs-mode: nil -*-
# ex: set sts=4 ts=4 sw=4 et:
# ## ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See COPYING file distributed along with the datalad package for the
# copyright and license terms.
#
# ## ### ### ... |
984,894 | f8965ed141cd6ec3083ada04cc7a1e0118930e01 | def main():
tempo = int(input())
velocidade_media = int(input())
km_l_automovel = 12
quant_litros = (velocidade_media/km_l_automovel)*tempo
print('%.3f'%quant_litros)
if __name__ == '__main__':
main() |
984,895 | 468be556aada157337bfb31a25d44479c4843960 | input_num = int(input())
def is_hansu(num):
if num < 100:
return 1
num = str(num)
num_len = len(num)
num_list = list(num)
minus_list = []
for i in range(num_len - 1):
minus = int(num_list[i]) - int(num_list[i+1])
minus_list.append(minus)
if num_len-1 == minus_list... |
984,896 | 5093ab1d0e5d63e9e77de5fb05b9d745f1480a59 | ii = [('CookGHP3.py', 1), ('WilbRLW4.py', 1), ('CookGHP.py', 1), ('ClarGE2.py', 2), ('CarlTFR.py', 1), ('LyttELD.py', 1), ('AinsWRR3.py', 3), ('BailJD1.py', 2), ('LyelCPG.py', 1), ('DibdTRL2.py', 2), ('AinsWRR.py', 2), ('CrocDNL.py', 2), ('BackGNE.py', 1), ('MedwTAI2.py', 1), ('WheeJPT.py', 1), ('HogaGMM.py', 1), ('Mar... |
984,897 | 6fa96525d622a5011593b16b72c38df77fd374a7 | #!/usr/bin/env python3
import math
import socket
import numpy as np
HOST = '127.0.0.1' # Standard loopback interface address (localhost)
PORT = 65432 # Port to listen on (non-privileged ports are > 1023)
x = 0
y = 0
angle = 0
sensors = 0b000000
sensor_data = np.array([])
for i in range(91):
sensor_data =... |
984,898 | 1ac015b51d55804ffe74e32705b1fa4f5eecc5d2 | ##Write a Python program to find those numbers which are
##divisible by 7 and multiple of 5, between 1500 and 2700 (both included)
for num in range(1500,2701):
if num%7==0 and num%5==0:
print(num)
|
984,899 | f1ab688732ddef09e3469c91d9079ff93b17c949 | #!python3
#-*- coding:utf-8 -*-
import random
import futurist
import timeit
import queue
#from __future__ import print_function
import psutil
import multiprocessing
import os , sys
"""
- java의 multi threading vs python multi threading vs Python Processing
의 performance를 비교하기 위한 예제 소스
- result :
mp_pe... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.