index int64 0 1,000k | blob_id stringlengths 40 40 | code stringlengths 7 10.4M |
|---|---|---|
994,500 | b158ae2372122c7dc082a81779c3fe938ead4b4f | # Dakota Bourne (db2nb) Nick Manalac (ntm4kd)
import robot
def square():
answer = 1
r = robot.Robot(1)
while True:
if r.check_south():
r.south()
answer += 1
else:
r.say(answer ** 2)
break
def rect():
r = robot.Robot(2... |
994,501 | b6e6e6bbb3aebb7b233ab7c4f8a636e602cc49bf | # coding=utf-8
# 这个是获取芝麻代理ip的小程序,通过requests.get 访API 接口,获取json数据,数据选型的时候勾选过期时间
# 。此api设定为每次获取任意个ip,ip存活时间为5-25分钟不等。放到redis中
# 启动blog爬虫之前,先启动此proxies.py 让redis的代理ip实时更新着
import requests
from time import sleep
import json
from redis import *
import time
import datetime
from other_process.python_send_emil import let_send
... |
994,502 | 168d33db167e86d116570ac85d171b44c8ca6198 | # -*- coding: utf-8 -*-
# Generated by Django 1.9.3 on 2017-07-31 22:12
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import uuid
class Migration(migrations.Migration):
initial = True
dependencies = [
... |
994,503 | a3699625819bbdb41d7f1622cf99f1c996ee406d | import numpy as np
import matplotlib.pyplot as plt
from scipy.special import comb
p = 0.4
n = 10
x = np.linspace(1,n,n)
y = p*(1-p)**(x-1)
print(x)
print(y)
z = 0
for i in y:
z = z +i
print(z)
plt.scatter(x,y)
plt.grid(True)
plt.show() |
994,504 | 7e3f77afc93e9c5915f5487953c4508e5e3487bb | # -*- coding: UTF-8 -*-
import os
import numpy as np
import pandas as pd
from stock.globalvar import FINANCE_DIR, BASIC_DIR, LRB_CH2EN, XJLLB_CH2EN, ZCFZB_CH2EN
from stock.utils.symbol_util import symbol_to_exsymbol
def _set_quarter(df):
for i in range(len(df)):
dt = df.index[i]
if dt.month == 3:
... |
994,505 | 70bad2bf7bd0e86680908541ff992f922e150d15 | import os
import sys
import pytest
from layer_linter.contract import get_contracts, Layer
from layer_linter.dependencies import ImportPath
from layer_linter.module import Module
class TestGetContracts:
def test_happy_path(self):
self._initialize_test()
contracts = get_contracts(self.filename_an... |
994,506 | 0f89e31d9b3acee567be23fe481d9a6794ccd0b9 | """
Load a CSV raster file to RasterAggregatedLayer object and related NumericRasterAggregateData.
NOTE: Input CSV expected to be AGGREGATED.
"""
import os
import csv
import gzip
import datetime
from django.core.management.base import BaseCommand, CommandError
from django.contrib.gis.geos import Point
from django.utils... |
994,507 | f25f3e17c4f5140befa9b3060f0528698efdf937 | from pycocotools.coco import COCO
import numpy as np
import skimage.io as io
import matplotlib.pyplot as plt
import pylab
import cv2
import copy
import math
rescale_size = 300
n_vertices = 128
pylab.rcParams['figure.figsize'] = (8.0, 10.0)
dataDir = '/media/keyi/Data/Research/course_project/AdvancedCV_2020/data/COC... |
994,508 | a13d429c9ac55f991c1f9699dd5d27e5108c7517 | """
===========================================
DL8.5 used to perform predictive clustering
===========================================
This example illustrates how to use a user-specified error function to perform predictive
clustering. The PyDL8.5 library also provides an implementation of predictive clustering
that ... |
994,509 | 37de8547c68f4d36561f2f36de10014409003a96 | import tensorflow as tf
import argparse
import configparser
import os
import time
import numpy as np
from model import Prototypical
from load_data import load
def preprocess_config(c):
conf_dict = {}
int_params = ['data.train_way', 'data.test_way', 'data.train_support',
'data.test_suppor... |
994,510 | 508b7eac7ec92e4d422804cda1460ed95500aaa4 | from django.shortcuts import redirect, render
from django.utils import timezone
from .models import Post
from django.shortcuts import render, get_object_or_404
from .forms import PostForm
def home(request):
return render (request,'home.html')
def post_list(request):
posts=Post.objects.filter(created_at__lte=t... |
994,511 | 6a041af537c4c9bdcffb847c1407f4d36a89def0 |
from urllib import request as url_request
import requests
from requests.exceptions import SSLError, HTTPError as ReqHttpError
# from requests.adapters import HTTPAdapter
# from requests.packages.urllib3.util.ssl_ import create_urllib3_context
from io import open
import os
import sys
cwd = os.getcwd()
splits = cwd.s... |
994,512 | e45b8d380f38d769575250bc6851e9618a726b95 | import os
import sys
from sandvet.wsgi import application |
994,513 | 187607c4e04af8ec87ad7c8a795192867833fa4a | from channels.generic.websocket import AsyncWebsocketConsumer
from channels.layers import get_channel_layer
import redis
import json
# https://ssungkang.tistory.com/entry/Django-Channels-%EB%B9%84%EB%8F%99%EA%B8%B0%EC%A0%81-%EC%B1%84%ED%8C%85-%EA%B5%AC%ED%98%84%ED%95%98%EA%B8%B0-WebSocket-3?category=320582
class Chat... |
994,514 | 8dd87d68191bbde02ce2f00e699807078f6acfa9 | import sys
num = int(input("Enter number of matrices:"))
matrices = []
for i in range(1, num+1):
a = (eval(input("enter number "+str(i)+" matrice:")))
rows = len(a)
col = len(a[0])
for j in a:
if len(j) != col:
print("INVALID")
sys.exit()
matrices.append((a, (rows, co... |
994,515 | b01462fe60a92db4c3f7052aa43e135447bb91f1 | from livelineentities import Odds
class Participant(object):
def _setParticipantName(self, participant_name=None):
self._participant_name = participant_name
def _getParticipantName(self):
return self._participant_name
def _setRotNum(self, rot_num=None):
self._rot_num = rot_num
de... |
994,516 | 70c69ab8c1036c7a96de7540d7ea7248f5a1f244 | # Brute Force method
# 2 loops - first loop on input_string_1 and second loop on input_string_2
# Time Complexity - O(n^2)
# Space Complexity - O(n)
def check_permutations_bfm(input_string_1, input_string_2):
# Check if the lengths are equal or not
if len(input_string_1) != len(input_string_2):
print(... |
994,517 | 72d16b134b4d38b1f4554a205823d07bccd6045d | import csv
with open('u.item') as csv_file:
csv_reader = csv.reader(csv_file, delimiter='|')
line_count = 0
for row in csv_reader:
line_count += 1
if ((row[1] == "") or (row[2] == "") or (row[4] == "")):
print 'Skipping movie ID=' + str(line_count)
|
994,518 | de88caad8181101487dd6c2ec98f4fe20678cd33 | #! /usr/bin/python3
from pymongo import MongoClient
client = MongoClient('mongodb://147.2.212.204:27017/')
prods = client.bz.prods
prod_all = [ 'SUSE Linux Enterprise Desktop 12',
'SUSE Linux Enterprise Desktop 11 SP3',
'SUSE Linux Enterprise Desktop 11 SP4 (SLED 11 SP4)']
bug_sts = ['-... |
994,519 | a811aee8c4cd42eda287c4c0804b87777c3198c8 | #!/usr/bin/env python
# coding: utf-8
# In[1]:
a=10 #a is a varibale name which isalso called identifier
# '=' is the assignment operator
print(a)
# In[2]:
a=10.6#over riding of variables
print(a)
# In[8]:
#to check the type of variable
a=10.6
type(a)
# In[9]:
a='HUZAIFA'
type(a)
# In[10]:
a=10
type(... |
994,520 | 0d87c9544c24336bc1577737a627deb6e848055b | from panther_base_helpers import gsuite_details_lookup as details_lookup
def rule(event):
if event['id'].get('applicationName') != 'groups_enterprise':
return False
return bool(
details_lookup('moderator_action', ['ban_user_with_moderation'], event))
def title(event):
return 'User [{}] ... |
994,521 | 56d047b5737d5313b3d3588dc700b3806b193934 | from Crypto.PublicKey import DSA
from Crypto.Signature import DSS
from Crypto.Hash import SHA256
from base64 import b64encode
import binascii
import json
def formatHex(temp_key):
return "\""+hex(temp_key)+"\""
file_in = open("Transaction_Format.JSON","r+")
content = file_in.read()
#DSAParam & pubkey
key = DSA... |
994,522 | 74ccc5ec5cb926784f673e0e45c03c2d0737db80 | #!/usr/bin/env python
# coding: utf-8
# In[1]:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
# In[2]:
pip install xlrd
# In[3]:
excelfile=pd.ExcelFile("TakenMind-Python-Analytics-Problem-case-study-1-1.xlsx")
df_resign=pd.read_excel(excelfile,'Employees who hav... |
994,523 | f75afff7cc1c224ecdd005afebaca2de3019402d | import numpy as np
import cv2
import cv
import freenect
import numpy as np
import time
range_dic=((400,677,50),(677,724,100),(724,834,150),(834,890,200))
def getDepthMat(lower,higher,color):
depth,timestamp = freenect.sync_get_depth()
depth = 255 * np.logical_and(depth > lower, depth < higher)
depth = dept... |
994,524 | c275bd8e08ed28ab94b5545f443df5e7292598bd | #!/usr/bin/env python3
'''This program takes an image that in TIFF format, which is rotated counter-clockwise with a size of 192 * 192
and chaning it to .jpeg file type, correcting the rotation, resizing it to 128 * 128 and saving the resultant
image in new folder /opt/icons/'''
import os
from PIL import Image
dir... |
994,525 | ec82d11a3afe0b57fa440617d843946a9b9140d0 | lista= []
palavra= 10
while palavra!= 'fim':
palavra= input('qual a palavra? ')
primeira_letra= palavra[0]
if primeira_letra =='a':
lista.append (palavra)
print (lista) |
994,526 | 9838303d1f090e8302d2eed3f0a8c1cb9bf4d180 | # Copyright 2021 Google LLC. 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 a... |
994,527 | cfc9d48afcd6241f2bb241f34f64b73bd7024b1a | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""Disassembler engine for disassemble and instrumentation base on Capstone
disassemble engine.
"""
import struct
import os
from Log import LoggerFactory
class CodeManager(object):
def __init__(self, code, rva):
self.code = code
self.rva = rva
... |
994,528 | 6e0b8580a8f858f9dbe279e4c1f214c561b46dbb | # Exploratory data analysis for auto-mpg dataset
# https://www.kaggle.com/devanshbesain/exploration-and-analysis-auto-mpg
#https://github.com/tensorflow/docs/blob/master/site/en/tutorials/keras/basic_regression.ipynb
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
import warnings
warnings.fi... |
994,529 | cde1b524cd60c9d9b1995ce42828b663845a2edf | import networkx as nx
import torch_geometric
from torch_geometric.datasets import Planetoid
import markov_clustering as mc
import random
import matplotlib.pyplot as plt
dataset = Planetoid(root='/local/scratch', name='Cora')
G = torch_geometric.utils.to_networkx(dataset[0])
G = G.to_undirected()
matrix... |
994,530 | 0086688ec97851d3f62e998fe4f586b9d088561d | from function_stock_esg_scraper import(
get_stock_index,
download_yahoo_stock_htmlfile,
get_stock_data,
write_to_csv,
get_esg_from_html,
join_stock_esg,
download_msci_esg_ratings_htmlfile
)
def scrap_stock():
table = get_stock_index(url='https://finance.yahoo.com/quote/%5EDJI/compon... |
994,531 | 947b78f50fb1596a33d162652f426b88143a733b | import numpy as np
def series_to_supervised(data, window, forcast_horizon):
X = []
y = []
for i in range(data.shape[0] - window - forcast_horizon + 1):
X.append(data.iloc[i:i + window])
y.append(data.iloc[i + window: window + forcast_horizon + i, 0])
X = np.stack(X, axis=0)
y = np.... |
994,532 | 766c7689b8ed6ae19cb31ff4e6c8a8b08fdaeb44 | """
INPUT:
4
Sasikumar:50:60:70
Arun:60:40:90
Manoj:50:50:60
Rekha:60:35:45
OUTPUT:
Arun
"""
n=int(input())
max=0
for i in range(n):
inp=input().split()
for j in range(len(inp)):
name,m,p,c=inp[j].split(':')
m,p,c=int(m),int(p),int(c)
sum=m+p+c
if sum>max:
max=sum
... |
994,533 | 240e28359913bc8949ce85c6f1489d3d113d69d7 | #!/usr/bin/python3
# Powered by FJW!
import sys
import os
import argparse
import random
import threading
import backTCP
from utils import *
# Actions: What to do for a stream of incoming packets
# 0: Do nothing and forward
# 1: Drop unless retransmitted
# 2: Swap two packets
# 3: Randomly order 3 packets an... |
994,534 | 838b547d74999d4c1ccf4e393d7d8d9295db5fdb | from .encodeClass import encoderClass
from .decodeClass import decoderClass
|
994,535 | 3c13ac301182ddfb9971996d40f46eec493b300b | # you are given a an array of words and ask to check if that list exist or not
class Solution:
def findRansom(self, arr, word):
res = {}
for i in arr:
if (i in res):
res[i] += 1
else:
res[i] = 1
for w in word:
if (... |
994,536 | 5b5574468d3716c96c76ea5aef1b125352497fe5 | #! /usr/bin/env python
import os, sys, glob, re, shutil, time, threading, json
def doCmd(cmd, dryRun=False, inDir=None):
if not inDir:
print "--> "+time.asctime()+ " in ", os.getcwd() ," executing ", cmd
else:
print "--> "+time.asctime()+ " in " + inDir + " executing ", cmd
cmd = "cd " ... |
994,537 | acfc53e80ecdb62a70a57e9d02270aaf7a4310d7 | # 若為Mac電腦,請先貼上此段程式碼
########### For Mac user ###########
import os
import ssl
# used to fix Python SSL CERTIFICATE_VERIFY_FAILED
if not os.environ.get('PYTHONHTTPSVERIFY', '') and getattr(
ssl, '_create_unverified_context', None
):
ssl._create_default_https_context = ssl._create_unverified_context
############... |
994,538 | 5d4b47237af0299b6bbfa67d119cc01c0708dab7 | # -*- coding: utf-8 -*-
# <nbformat>3.0</nbformat>
# <markdowncell>
# ###Description and preliminary code for Continuous-Time Markov Chain Model
#
# This model will test the importance of including a spatial component in the system. We will use ODEs to describe the dynamics of each lineage and competition between li... |
994,539 | 457309a52de2137e72028c15cab4eea122b7aeb6 | # -*- coding: utf-8 -*-
"""
Created on Sun Feb 14 10:53:22 2021
@author: ant67
"""
# 1. 단어 횟수를 기록한 사전을 만든다.(띄어쓰기 기반)
# 2. 각 단어에 대해 연속된 2개의 글자의 숫자를 세고 가장 많이 나오는 글자 2개의 조합을 찾는다.(bi-gram)
# 3. 두 글자를 합쳐 기존 사전의 단어를 수정한다.
# 4. 미리 정해 놓은 횟수만큼 2~3번의 과정을 반복한다.
# Algorithm 1: Learn BPE opertaions
import re, collec... |
994,540 | e53bba1f745551ea19b8d94b1b0b069426830f62 | """
This type stub file was generated by pyright.
"""
from .vtkDataObject import vtkDataObject
class vtkAbstractElectronicData(vtkDataObject):
"""
vtkAbstractElectronicData - Provides access to and storage of
chemical electronic data
Superclass: vtkDataObject
"""
def DeepCopy(self, vtkDat... |
994,541 | 5ca4140c98c82cfcc4132e7e4e081ac2776f5ea2 | # all the computations for these problems are done using binary arithmetic
# only the user input and the final output will be in decimal.
# dec2bin and bin2dec convert between binary and decimal.
import random
import sys
import time
sys.setrecursionlimit(10000000)
from random import *
def Problem1Proj... |
994,542 | ed3c61b16d7b5341adb3085aae10fd5ca09f839d | # -*- coding: utf-8 -*-
# Generated by Django 1.9.12 on 2017-04-26 13:06
# Updated in Django 2.0.5 on 2018-06-02 11:15
from __future__ import unicode_literals
import json
from django.db import migrations, models
PREVIOUS_NAME_MAX_LENGTH = 40
def fix_truncated_language_names(apps, schema_editor):
"""Some langua... |
994,543 | e0d1d0529a660aa73b76a1fa804ef1f2563a2e0d | #!/usr/bin/python
#copyright (c) 2010 Knowledge Quest Infotech Pvt. Ltd.
# Produced at Knowledge Quest Infotech Pvt. Ltd.
# Written by: Knowledge Quest Infotech Pvt. Ltd.
# zfs@kqinfotech.com
#
# This software is NOT free to use and you cannot redistribute it
# and/or modify it. You should be possesion of ... |
994,544 | 5d55ee09d0ec867dc75a098f29e8b134d23f59a1 | #!/usr/bin/python
# -*- coding: utf-8 -*-
import xml.etree.cElementTree as ET
import csv
import cerberus
import codecs
import tool
"""
When create the csv file ,use this file.
The path is at result directory.
"""
file_name = "data/shanghai_china.osm"
NODES_PATH = "result/nodes.csv"
NODE_TAGS_PATH = "result/nodes_tag... |
994,545 | e5539edd7ea27f6caaa47aa517c6fdb7192772f6 | #!/usr/bin/env python
import json
import sys
def main():
input_filename = sys.argv[1]
output_filename = sys.argv[2]
output = {'trivia': []}
with open(input_filename, 'r') as input_file:
question = None
category = None
answer = None
regexp = None
for line in input_file:
if line[0] =... |
994,546 | 0a5303f41d8ff628f79b14c8f35318a3cb2b959e | import string
input = []
with open('day6-input') as file:
lines = file.readlines()
answers = []
questions = 0
persons = 0
for line in lines:
if line != "\n":
persons += 1
answers.append(set(line.strip('\n')))
else:
input.append({"persons": person... |
994,547 | 4d2116bf9a8cbc748b05f27e7645449f109a3bf7 | #!/usr/bin/env python3
import cmath
def main():
z = complex(input())
print(abs(z))
print(cmath.phase(z))
if __name__ == "__main__":
main()
|
994,548 | 87fb5976611b2eb235ac0a307bbe410f71210a62 | """
python 3.6 built-in functions
https://docs.python.org/3/library/functions.html#built-in-functions
"""
print("\n", 1)
print("abs(x)")
print(abs(-4)) # >>> 4
# absolute value
# argument: int and float
# return the
print("\n", 2)
print("all(iterable)")
print(all([0, 4])) # >>> False
print(all([])) # >>> True
# a... |
994,549 | 8abb56393f80fa6578eaf5695ceee4632425cdbb | class Interval:
def __init__(self,s=0,e=0):
self.start=s
self.end=e
class Solution:
def merge(self, intervals):
"""
:type intervals: List[Interval]
:rtype: List[Interval]
"""
intervals.sort(key=lambda x:x.start)
result=[]
for inte... |
994,550 | 97fe61f190289d3a51f5435d208d1fba673e6b83 | x=input("Enter text to encrypt: ")
key=int(input("Enter Caesar's key (0-25): "))
def rotate(string1,k):
M=[]
A="abcdefghijklmnopqrstuvwxyz"
for i in range (len(A)): #cipher solution
M.append(A[(i+k)%26])
#print (M)
N=""
for g in range (len(string1)):
for j in range (len(A)):
... |
994,551 | 648c15a119dd91869e1b2f8804473802c8278e1c | # for loops
for n in range(1,20,2): # range(5) start with 0 until and including 4 !!
print(n)
# do more stuff in here
print("Whew all done",n)
print("\n")
print("Printing my food")
food = "kartupelis"
for c in food:
print(c, "::", end="") # are end="" es atsledzu newline
my_list = [1,2,3,6,7,2,19,645,5453,... |
994,552 | 410ad5c1c480a12b461d70a1b92671163355f73b | import unittest
import arrays
import conversion
import floats
import ifelse
import integers
import strings
ArrayTest = arrays.ArrayTest
ConversionTest = conversion.ConversionTest
FloatsTest = floats.FloatsTest
IfElseTest = ifelse.IfElseTest
IntegersTest = integers.IntegersTest
StringsTest = strings.StringsTest
clas... |
994,553 | 8e85b62c8b6ad2ac0bac23093ab3fe15c2ad9711 | import torch
import torch.nn as nn
class Net(nn.Module):
def __init__(self):
super(Net, self).__init__()
# 1 input image channel (grayscale), 32 output channels/feature maps
# 4x4 square convolution kernel
## output size = (W-F)/S +1 = (224-4)/1 +1 = 221
# the out... |
994,554 | 92e83a0658f296f830679db2641c499f06ffa911 | from argparse import ArgumentParser
from glob import glob
import os
import numpy as np
from sklearn.utils import shuffle
import matplotlib.pyplot as plt
import pandas as pd
from tqdm import tqdm
from PIL import Image
import matplotlib.pyplot as plt
def load_image(filename):
try:
with open(filename, "rb") ... |
994,555 | 060daac13ed163d889911f72faa1a574491baa97 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# the above line is to avoid 'SyntaxError: Non-UTF-8 code starting with' error
'''
Created on
Course work:
@author: raja
Source:
'''
# Import necessary modules
def get_country_details(name):
country_details = {
"name" : "N/A",
"capital_... |
994,556 | b2d4588a72bf7a91ce965a8a8415bcb735467d22 | #!/usr/bin/env python
import time
import pigpio
pi = pigpio.pi()
pin=20
pi.set_mode(pin,pigpio.OUTPUT)
while True:
pi.write(pin, 1)
print('high')
time.sleep(.01)
pi.write(pin,0)
print('low')
time.sleep(.01)
|
994,557 | 38eb795432e44f6cc99a3677a1c23cd9f749bb12 | #内联回调函数
#问题
#当你编写使用回调函数的代码的时候,担心很多小函数的扩张可能会弄乱程序控制流。你希望找到某个方法来让代码看上去更像是一个普通的执行序列
#解决
#通过使用生成器和协程可以使得回调函数内联在某个函数中
#为了演示说明,假设你有如下所示的一个执行某种计算任务然后调用一个回调函数的函数
from queue import Queue
from functools import wraps
def apply_async(func,args,*,callback):
#compute the result
result =func(*args)
#invoke the callback wit... |
994,558 | c9b541b8e77aff46dd61023323ee9ef643f3ad76 | # coding=utf-8
"""
Logging package.
"""
import logging
LOG = logging.getLogger("trader")
LOG.setLevel(logging.DEBUG)
handler = logging.StreamHandler()
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
handler.setFormatter(formatter)
LOG.addHandler(handler)
|
994,559 | 110d5ca2f70dd0dd58ccd5c529200599195dc646 |
import pygame
from pygame import *
import random as ra
pygame.init()
white = (255, 255, 255)
black = (0, 0, 0)
size = width, height = 800, 800
screen = pygame.display.set_mode(size)
points = [[0, 0, 0],
[0, 0, 0],
[0, 0, 0]]
x = 0
y = 0
flag = 1
lst = []
lst_mine = []
lst_... |
994,560 | 79dcb9cac76973b1bfbdfd0d68486c4cdcd246e9 | print("This program will compute the student average")
print(" ")
pre = float(input("Enter your Prelims Score : "))
mid = float(input("Enter your Midterms Score : "))
sem = float(input("Enter your Semis Score : "))
finals = float(input("Enter your Finals Score : "))
avg = (pre + mid + sem + finals) / 4
print("Y... |
994,561 | 20626f29619db47758062a2d54177a1a944756f6 | fin = open('input.txt')
words = []
A = {}
for now in [i.split() for i in fin.readlines()]:
words.extend(now)
for i in words:
A[i] = A.get(i, 0) + 1
print(A[i] - 1, end=' ')
|
994,562 | 231a1404c0b624ea813e265050516d54457b5e30 | from setuptools import setup, find_packages
setup(
name='tasktimer',
version='0.0.1',
packages=find_packages(),
url='',
license='',
author='thedjaney',
author_email='thedjaney@gmail.com',
description='',
entry_points={
'console_scripts': ['tasktimer=tasktimer.cli:main'],
... |
994,563 | 99664a41a46e882804aeec1c68bd04d8f591d8f2 | #문자열 포맷팅
print("I eat %d apples. " %3)
number = 10
day = "three"
print ("I ate %d apples. so I was sick fot %s days." %(number, day)
#정렬과 공백
print ( "%10s" % "hi" )
print ("%-10sjane." 'hi')
#소수점 표현
print ("%0.4f" % 3.42134234)
print ("%10.4f" % 3.42134234) |
994,564 | ee373a37ff9ceb9a5cff3a4d53c64838eec40043 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Thu Jun 21 22:41:08 2018
@author: ubuntu
"""
import numpy as np
import keras
from keras.models import Sequential
from keras.layers import Dense,Dropout,Flatten
from keras.layers import Conv2D,MaxPooling2D
from keras.optimizers import SGD
x_train = np.rand... |
994,565 | cb6c05dc820cd0ddf1fdd2d70188b3d53bf4fbf7 | import torch
import pandas
import torch.nn.functional as F
import numpy as np
from torch.autograd import Variable
"""
Human Activity neural network implementation (Non-quantization aware training)
"""
class HARnn(torch.nn.Module):
def __init__(self):
super(HARnn, self).__init__()
self.linear1 = torch.nn.Lin... |
994,566 | 1040981351bf495babb3970f655190fc8ce9f588 | '''
https://www.hackerrank.com/challenges/dynamic-array
'''
# Enter your code here. Read input from STDIN. Print output to STDOUT
|
994,567 | 4d60a6bbfa91e6b5269af254cadbe43076f4512a | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from termcolor import *
banner = """ _____________________
| _________________ |
| | LA CHOFIS 7u7 . | |
| |_________________| |
| ___ ___ ___ ___ |
| | 7 | 8 | 9 | | + | |
| |___|___|___| |___| |
| | 4 | 5 | 6 | | - | |
| |___|___|___| |___| |
| | 1 | 2 | 3 | | x ... |
994,568 | f381db855471196ce7babd45c40d10af7ecb3d97 | from setuptools import setup, find_packages
with open('requirements.txt') as f_in:
lines = (l.strip() for l in f_in.readlines())
install_requires = [l for l in lines if l and not l.startswith('--')]
with open('README.md') as f_in:
long_description = f_in.read()
setup(
name='fangorn',
version='0.0... |
994,569 | 078fd85df46231cd0a4b3d202aa254e4fc09b1e8 | import tensorflow as tf
import tensorflow.keras as keras
from dataframe_landmark import DataRepository
from sign_detector import SignDetector
if __name__=='__main__':
datadir = './csv' |
994,570 | 697c648190b7cf023265bce695adfdae38f74ff8 | from .types import Vector2
from . import settings as s
from . import sprites
import pygame as pg
class Menu():
def __init__(self):
self.selected = 0
self.quit_state = None
self.pressed_up = False
self.pressed_down = False
self.selector_pos = Vector2(239, 404)
def draw... |
994,571 | 8bc8437754703fcdae3f74f4e078d8fb61df424e | import png
import pyqrcode
from pyqrcode import QRCode
file = open ("arquivo.txt" )
for line in file.readlines():
s = line
Stringformat = s.replace("\n","")
url = pyqrcode.create(Stringformat)
url.png(Stringformat+'.png',scale=6)
file.close()
|
994,572 | 7d81c67d5e41d970b99325ed5d685b3b53dd4224 | from django.contrib import admin
from .models.comment import Comment
from .models.post import Post
from .models.nav import Nav
from .models.files import Files
from .models.meeting import Meeting
from .models.member import Member
from .models.signin import Signin
from .models.maintext import MainText
from django.db.mod... |
994,573 | 610eb5f37a3520ef1aca9232196838166b347dc1 | import os, sys
import numpy as np
import tensorflow as tf
from tensorflow.contrib.crf import viterbi_decode
from tensorflow.contrib.crf import crf_log_likelihood
from modules import embedding, positional_encoding, \
multihead_attention, feedforward, \
label_smoothing, gelu_fast
... |
994,574 | 23a399bb9f716f7ac01235e657c4e8850312874f | """Construct the link (foreign key or association table) between models."""
from open_alchemy import facades
from open_alchemy import types
from . import association_table as _association_table
from . import foreign_key as _foreign_key
def construct(
*,
artifacts: types.ObjectArtifacts,
model_schema: ty... |
994,575 | c027389845a8e684618088f174cc75e76dd2c82e | import pandas as pd
import re
import nltk
from bs4 import BeautifulSoup
from nltk.corpus import stopwords
stemmer = nltk.stem.PorterStemmer()
def _apply_df(args):
df, func = args
return df.apply(func)
def make_sentences(reviews):
sentences = list()
for review in reviews:
sentences += review_t... |
994,576 | 05385360c132d95a7d17ecca81fbef22fbf5d5b3 | import gzip
import requests
import msgpack
from multiprocessing import Pool
import time
import xmltodict
WORKER_COUNT = 4 # Add CPUs & increase this value to supercharge processing downloaded
def extract_xml_step(xml_row):
"""
Multiprocessing the extraction of key info from selected xml items!
TODO: Handl... |
994,577 | 6be8461161516ed2e243dc166ea30337c90763fa | from textblob import TextBlob
import pandas as pd
testwords = ['good is bad, bad is good good', 'hello', 'fucking', 'best', 'beautiful', 'bad', 'wonderful', 'horrible',
'haha', 'ok', 'accaptable', 'jnfjanfjanfja']
testparagraph = """
Google was bound to make it in here somehow. Here are some intern perks ... |
994,578 | 5fffe560739a589eba94744a3bd58b2efaab3c9e | import struct
import socket
class Ip:
def __init__(self,raw=None):
iph=struct.unpack('!BBHHHBBH4s4s',raw[:20])
self._version=iph[0]>>4
self._ihl=iph[0]&0xF
#iph_length=ihl*4
self._ttl=iph[5]
self._protocol=iph[6]
self._srcip=socket.inet_ntoa(iph[8])
s... |
994,579 | 8bd47109436bf0cc2afb345d1485957d641ea66c | import socket
from logger.logger import Logger
SEND=b'PING!'
RECV=b'PONG!'
PORT = 9999
logger = Logger()
def ping(host):
try:
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect((host, PORT))
sock.sendall(SEND)
# logger.debug(f"Client Sent Request Ping to {host}... |
994,580 | ef896745ad7279be1bcd8c24b110013e627705bf | from __future__ import absolute_import, division, print_function
import os
from subprocess import call
import yaml
import importlib
from collections import OrderedDict
import numpy as np
import xarray as xr
import pandas as pd
import cftime
import calc
grid_file = '/glade/work/mclong/grids/pop-grid-g16.nc'
year_ra... |
994,581 | b34ff480a08a9c64a7cce23a53d7d29e6b9c8f26 | import importlib
from config import settings
for engine_name in settings.ENGINES:
importlib.import_module("." + engine_name, "translators")
__all__ = settings.ENGINES
|
994,582 | b9bab84ef609a956d16e8d9123a93e61857c10b3 | import asyncio
from Heliotrope.utils.hitomi.common import image_model_generator, image_url_from_image
from Heliotrope.utils.hitomi.hitomi_requester import (
fetch_index,
get_gallery,
get_galleryinfo,
)
from Heliotrope.utils.option import config
from Heliotrope.utils.shuffle import shuffle_image_url
async... |
994,583 | 623caa16a826eb4027b558c2a8767899fa75bf50 | """Third commit
Revision ID: 5fc9173a4088
Revises: de9e12edbc8b
Create Date: 2021-05-26 20:02:36.390851
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '5fc9173a4088'
down_revision = 'de9e12edbc8b'
branch_labels = None
depends_on = None
def upgrade():
# #... |
994,584 | e4d62ed1c75f7c975b8ed2d5ba0c2c69dd886ec6 | import frappe
from frappe import _
def execute():
# Initial-Erstellung Demographie Bins
print("Patch: Initial-Erstellung Demographie Bins")
kunden = frappe.db.sql("""SELECT `name` FROM `tabCustomer`""", as_dict=True)
m_max = len(kunden)
print("found {0} Kunden".format(m_max))
loop = 1
for k... |
994,585 | 2f7845ab0f0131b90504883006f3ef6a55b8a473 | from sys import stdout
from time import time
from os import urandom, remove
def write_data_timing(*, fh=None, pth=None, size=1024**3, blocksize=4*1024, pth_remove=True, timeout=60):
if not fh:
assert pth, 'provide fh or pth'
fh = open(pth, 'wb+')
assert fh.writable(), 'fh not writable'
stdout.write('writing {... |
994,586 | 0a3bb3c1078470a32f79384768abaebf9ccc68a4 | # -*- coding: utf-8 -*-
#!/usr/bin/env python2
"""
Example for you to import this function:
from csv_func import csv_deal
filename = "example.csv"
csv_do = csv_deal(filename)
csv_do.print_row()
data = [[1, 2 ,3], [4, 5, 6]]
csv_do.write_row(data)
"""
import csv
class csv_deal:
def __init_... |
994,587 | 6e932b59ca7b2e52da6a912820f5d1bde3cb743e | from django.conf.urls import include, url
from django.contrib import admin
from django.conf.urls.static import static
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.conf import settings
urlpatterns = [
url(r'^$', include('pages.urls')),
url(r'^admin/', include(admin.site.urls... |
994,588 | 7c6144efb42fed8e77c7b3351bdd6102b56f33b3 |
#Welcome to vastauine
#This is a sample code on Raspberry PI (Client End)
#Feel free to edit this code to meet your requirenment
#READ THE LICENCE BEFORE YOU USE OR REPRODUCE THIS CONTENT
#this is a very basic program and not highly realible more realible versions to be roll out sooner
#Vastauine holds no WARRENTY o... |
994,589 | 0c3916938e709df901c940a6741e7e5262c4d856 | from Defs import Defs
class Board:
def __init__(self):
self.defs = Defs()
def new_board(self):
board = [ [ 0 for x in range(self.defs.cols) ]
for y in range(self.defs.rows - 1) ]
board += [[ 1 for x in range(self.defs.cols)]]
for i in range(len(board)):
... |
994,590 | 913dc7f8749aa913620d2fe5825a0ed50ec86366 | from session_directory import get_session
import data_preprocessing as d_pp
from microscoPy_load.ff_video_fixer import load_session
from helper_functions import find_closest, ismember
import numpy as np
import matplotlib.pyplot as plt
import microscoPy_load.cell_reg as cell_reg
from scipy.stats import pearsonr, spearma... |
994,591 | 6d72981084b62dda71573afd0a4eafc0383b9bd9 | #Write a Python GUI program to create three push buttons using Tkinter. The
#background color of frame should be different when different buttons are clicked
from tkinter import *
from random import choice
top=Tk()
top.title("BG Color")
C=Canvas (top, height=250, width=400)
button1 = Button (top, text = ... |
994,592 | 3cd0eaab3243358df8d0a889b17658662d67bba5 | #
# Copyright (c) 2015 nexB Inc. and others. All rights reserved.
# http://nexb.com and https://github.com/nexB/scancode-toolkit/
# The ScanCode software is licensed under the Apache License version 2.0.
# Data generated with ScanCode require an acknowledgment.
# ScanCode is a trademark of nexB Inc.
#
# You may not use... |
994,593 | 85836cbfcd508df10d27de76d57aed50565ca528 | import os
os.environ['CUDA_VISIBLE_DEVICES'] = '-1'
import base64
from datetime import datetime
import shutil
import numpy as np
import socketio
import eventlet
import eventlet.wsgi
from PIL import Image
from flask import Flask
from io import BytesIO
import utils
from keras.models import load_model
import argparse
o... |
994,594 | 82929b0c9a35ea543d843826ad4bcf3bb1cb2f89 | from socket import *
serverIP = "127.0.0.1"
serverPort = 12345
clientSocket = socket(AF_INET, SOCK_STREAM)
clientSocket.connect((serverIP, serverPort))
req = "GET /" + "hello.html" + " HTTP/1.1\r\n\r\n"
clientSocket.send(req.encode())
rec=""
rec2 = clientSocket.recv(1024).decode()
while True:
if l... |
994,595 | 1806693428d861e136f3b734ec7b5c89608acf91 | import numpy as np
import random
import os
GAME_SIZE = 8
START_POS = [1,1]
END_POS = [GAME_SIZE - 1, GAME_SIZE - 1]
def clear():
if os.name == "nt":
_ = os.system("cls")
else:
_ = os.system("clear")
class Game():
def __init__(self):
self.map_array = np.zeros((G... |
994,596 | a4013e5bdac2e4ff5b5b5020c19cf59322107c83 | print("hello view") |
994,597 | e25fa02261c22dd7e44223faf04931c6c8a95cec | from django.apps import AppConfig
class VisualadminConfig(AppConfig):
name = 'visualAdmin'
|
994,598 | ff29168da30024b6dd5e3ca57de674412fb0a371 | from sympy import *
from abc import ABC, abstractmethod
from spec.time import timifyVar
from spec.contract import *
import spec.conf
# Some motion primitives have parameters, we represent that with a factory.
# Given some concrete value for the parameters we get a motion primitive.
# Currently the values should be con... |
994,599 | 2db44bcdb5d23331b3837dff79f874f937df504b | import signal
import asyncio
from pathlib import Path
from sys import stderr
from pika import BasicProperties
from pika.exceptions import UnroutableError, AMQPConnectionError, ChannelClosed, ChannelWrongStateError
import json
from collector.brdige import BLiveDMBridge
from mylib.mq import connect_message_queue, queue_n... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.