blob_id large_string | repo_name large_string | path large_string | src_encoding large_string | length_bytes int64 | score float64 | int_score int64 | detected_licenses large list | license_type large_string | text string | download_success bool |
|---|---|---|---|---|---|---|---|---|---|---|
c4e4266c18220abbc37160a1878331adbc24013a | oldinaction/rent-house-spider | /houseScrapy/spiders/house_spider.py | UTF-8 | 4,571 | 2.53125 | 3 | [
"Apache-2.0"
] | permissive | # -*- coding: utf-8 -*-
import traceback
import scrapy
from scrapy.contrib.loader import ItemLoader
from houseScrapy.items import RenthouseItem
from smutils.ConfigU import ConfigU
from smutils.MysqlU import MysqlU
class RentHouseSpider(scrapy.Spider):
'''
爬取安居客上海江浦路房源
'''
name = "rentHouseSpider"
... | true |
7fee8cffeffb410121855e12aa35d3aafb5b11dc | v-yunbin/STTWebApp | /app/STT/Vosk/transcribe.py | UTF-8 | 871 | 2.59375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
from vosk import Model, KaldiRecognizer, SetLogLevel
import sys
import os
import wave
import json
SetLogLevel(0)
if not os.path.exists("model"):
print ("Please download the model from https://alphacephei.com/vosk/models and unpack as 'model' in the current folder.")
exit (1)
wf = wave... | true |
1ba2f89a40ef868ef25dd20d4e886e31bf388b3f | michaeljohnbarr/mystiko | /mystiko/k8s.py | UTF-8 | 392 | 2.90625 | 3 | [] | no_license | import os
def get_secrets(directory='/etc/secrets/'):
secret_dict = {}
# make sure the directory has the trailing slash
if directory[-1] != '/':
directory = directory + '/'
for s_key in os.listdir(directory):
with open(directory + s_key, 'r') as sf:
s_value = sf.read()
... | true |
42fc8eecc806e70c2a37104401a5c12759e5d04b | houhailun/deep-learning | /tf2/examples/embedding.py | UTF-8 | 930 | 3 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding:utf-8 -*-
# Time: 2020/10/12 17:52
# Author: Hou hailun
# embedding
# Q1: 什么是embedding?
# A1: 在推荐系统中,对于离散特征通常转换为one-hot,造成特征维度很大,数据稀疏,针对这种问题,需要做embedding处理;
# Q2: embedding的过程是什么样子?
# A2: 实际上是一层全连接神经网络,由于one-hot后只有1个位置是1,其他是0,因此得到的embedding就是1上与下一层的的权重
import tensorflow as t... | true |
761d0bc332d72e02cb790dd10493882cb4d87ede | youxiue/python-learn | /demo13.py | UTF-8 | 3,903 | 4.3125 | 4 | [] | no_license | # youxiue
# createTime: 2021/1/23 21:45
# 列表
'''
1. 列表元素按顺序有序排列
2. 索引映射唯一一个元素
3. 类别可以存储重复元素
4. 任意数据类型混存
5. 根据需要动态分配 和 回收内存
'''
# 第一种创建方式
lst = ['hello', 'world', 98, 'hello', 'jojo']
# 第二种创建方式, 使用内置函数 list()
lst2 = list(['hello', 'world', 98])
# 列表中查询操作
'''
index() 返回指定元素的索引
1. 如过列表中存在N个相同元素, 只返回相同元素的第一个元素的索引
... | true |
3d2264104620ef31d6616558eae4626508861f96 | lraynes/cheat_sheets | /Pandas/pandas.py | UTF-8 | 7,238 | 3.546875 | 4 | [
"MIT"
] | permissive | import pandas as pd
# Then create a Pandas Series from a raw list
data_series = pd.Series(["UC Irvine", "UCLA", "UC Berkley", "UC Riverside", "UC Davis"])
data_series
# Convert a list of dictionarys into a dataframe
states_dicts = [{"STATE": "California", "ABBREVIATION" : "CA"},
{"STATE": "New York", ... | true |
343efe95f94180b1314835fc17b8079a29ceaa82 | Aasthaengg/IBMdataset | /Python_codes/p02855/s803891877.py | UTF-8 | 1,074 | 2.765625 | 3 | [] | no_license | from collections import defaultdict
H, W, K = map(int, input().split())
cake = []
sbdict = defaultdict(list)
sbrows = set()
for i in range(H):
line = input()
assert len(line) == W
cake.append(line)
for j in range(W):
if line[j] == '#':
sbrows.add(i)
sbdict[i].append(j)
s... | true |
6ff2292e70172da0a7eb9a780d8aa80b4fad866f | rdecoito/senior_design | /testing/udp_test/udp_server.py | UTF-8 | 466 | 2.6875 | 3 | [
"MIT"
] | permissive | from socket import socket, AF_INET, SOCK_DGRAM
serverSocket = socket(AF_INET, SOCK_DGRAM)
serverSocket.setblocking(False)
serverSocket.bind(('', 8765))
#serverSocket.settimeout(0)
while True:
try:
message, address = serverSocket.recvfrom(1024)
if message:
print(f'Received message from {address[0]}:{address[1]... | true |
44301225e34556b29b5c16630390ed579a2898ca | knight-apple/Proxies-Get | /QueueCount.py | UTF-8 | 1,249 | 2.875 | 3 | [] | no_license | import threading
import time
import datetime
import queue
from random import randint
class WaitQueue(threading.Thread):
def __init__(self, countq):
threading.Thread.__init__(self)
self.q = countq
def run(self):
strsize = -1
maxn = self.q.qsize() + 1
cnt ... | true |
d1e15945dba63318657bf69fd28ada34d08b9630 | NotSpooky/gtsrb_pytorch | /example.py | UTF-8 | 4,232 | 2.59375 | 3 | [] | no_license | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.utils.data import DataLoader
from torchvision.datasets import ImageFolder
import torchvision.transforms as transforms
import numpy as np
# Assumes a gtsrb folder inside next to this file
BATCH_SIZE = 32
EPOCHS = ... | true |
b490b4c6298268d07f572537fe5cd598e5ebecdc | Kawser-nerd/CLCDSA | /Source Codes/AtCoder/abc027/C/4831116.py | UTF-8 | 376 | 3.4375 | 3 | [] | no_license | n=int(input())
i=0
while 2**i<=n:
i+=1
if i%2==0:
def t(x):
return 2*x
def a(x):
return 2*x+1
else:
def a(x):
return 2*x
def t(x):
return 2*x+1
x=1
j=0
while x<=n:
if j%2==0:
x=t(x)
else:
x=a(x)
j+=1
if j... | true |
c0916478ec743c42acc822949b0b925084321f4a | yuanjinren/Unit3_TwitOff | /twitoff/predict.py | UTF-8 | 813 | 2.515625 | 3 | [
"MIT"
] | permissive | import numpy as np
from sklearn.linear_model import LogisticRegression
from .db_model import User
from .twitter import BASILICA
def predict_user(user1, user2, tweet_text):
user1 = User.query.filter(User.username == user1).one()
user2 = User.query.filter(User.username == user2).one()
user1_embeddings = np.a... | true |
ae302a74962b60358679ed0a58e4f928e6ef9264 | ToldYa/Python | /inceptionv3.py | UTF-8 | 8,638 | 2.609375 | 3 | [] | no_license | """
inceptionv3-modell testkörd för både random och imagenetvärden
Skapa testgenerator
Batchsize måste vara delbar med antal bilder till generator
Sätt train_batchsize, test_batchsize, val_batchsize
"""
from __future__ import print_function
import numpy as np
import keras
from keras.preprocessing.image import ... | true |
7832dbb860ea7f330d6b4e4210efd7964f04d827 | yaolizheng/leetcode | /259/3sum_smaller.py | UTF-8 | 412 | 3.375 | 3 | [] | no_license | def sum_smaller(n, t):
n.sort()
length = len(n)
res = 0
for i in range(length):
l = i + 1
r = length - 1
while l < r:
s = n[i] + n[l] + n[r]
if s < t:
res += r - l
l += 1
else:
r -= 1
return r... | true |
2b8017d7766c5fd2ca521eb26c6729617083b685 | RestlessMystic/TamingthePython | /prog04b.py | UTF-8 | 167 | 3.15625 | 3 | [] | no_license | #
# Taming the Python
# Govind Maheswaran
# Example Programs
# Prog 04b
# Program to demonstrate for loop
for i in range(1,5):
print i;
for i in range(1,10,2):
print i;
| true |
f166de03596b26d7dd83b13a968730fe342d2de8 | lybing/LotteryAnalysis | /lottery.v2.py | UTF-8 | 4,753 | 2.71875 | 3 | [
"MIT"
] | permissive | import requests
import re
import pymysql
from pyecharts import Bar, Pie, Bar3D
from lotterymodel import PeriodModel,WinningNumberModel,SalesInfoModel
def getContent():
url = 'https://datachart.500.com/ssq/history/newinc/outball.php?start=01001&end=18100'
return requests.get(url).text
def parsePage():
try... | true |
afd263a9a8e9f2227946f82b5969f3ffc57f498c | pvsoriano/mlscripts | /import-data.py | UTF-8 | 963 | 3.09375 | 3 | [] | no_license | # Imports housing data from ageron's github
import os
import tarfile
import urllib
import pandas as pd
# Define URL and paths to download and store datasets
ROOT_URL = "https://raw.githubusercontent.com/ageron/handson-ml/master/"
DATASET_PATH = 'datasets/housing'
DATASET_URL = ROOT_URL + DATASET_PATH + '/housing.tgz'
... | true |
3b0001e426517f9caac1b19ffc84f2d0e0398003 | dkqyqyt/Algorithm | /Codes/Python/Practice/n2193 이친수.py | UTF-8 | 196 | 3.109375 | 3 | [] | no_license | n = int(input())
memo = [[0,0] for _ in range(n+1)]
memo[1][1] = 1
for i in range(2,n+1):
memo[i][0] = memo[i-1][0] + memo[i-1][1]
memo[i][1] = memo[i-1][0]
print(memo[n][0]+memo[n][1]) | true |
62fed370b61bfdc3c8196eea0710a0c714cd8afb | demos/developer_skins | /LateNight1920x1080/mult.py | UTF-8 | 3,266 | 2.796875 | 3 | [] | no_license | #!/usr/bin/python
import os, sys, os.path
for fname in sys.argv[1:]:
f = open(fname)
for line in f.readlines():
line = line.rstrip()
if "<POS>" in line.upper():
s = line.upper().find("<POS>") + 5
e = line.upper().find("</POS")
if e == s:
... | true |
dbe32a38ff9f30e24fd23b4752813fc7b9b877d0 | andriar2/TUGAS1-KB | /video 11/Andriar Mikahrun_F55118046_Kelas A_V11.py | UTF-8 | 2,010 | 3.015625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sun May 3 02:58:04 2020
@author: User
"""
from random import randint,random
from operator import add
from functools import reduce
def evolve(pop, target, retain=0.2, random_select=0.05, mutate=0.01):
graded = [ (fitness(x, target), x) for x in pop]
graded = [x[1] for ... | true |
f4584a8c6e4044755a86fbede09a3c13e0729e33 | sreeds82/controlled_abstention_networks | /classification/abstentionloss.py | UTF-8 | 18,139 | 3.359375 | 3 | [
"MIT"
] | permissive | """Abstention loss function classes and associated alpha updater classes for
classification.
loss function classes
---------------------
* DACLoss(tf.keras.losses.Loss):
Modified k-class cross-entropy per-sample loss with spinup, as defined by
Sunil Thulasidasan.
* NotWrongLoss(tf.keras.losses.Loss):
Abst... | true |
1c10a9406928db7da6c3ad1df072a59e88c8ff30 | nvnhcmus/1M-agents-RL | /src/plot_largest_group.py | UTF-8 | 2,523 | 2.671875 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
from cv2 import VideoWriter, imread, resize
import cv2
import os
import numpy as np
def make_video(images, outvid=None, fps=5, size=None, is_color=True, format="XVID"):
"""
Create a video from a list of images.
@param outvid output video
@pa... | true |
8222e2428955f62b18b3255cdcb0eb0dd9b6bd3f | tzahishimkin/extended-hucrl | /rllib/dataset/transforms/angle_wrapper.py | UTF-8 | 1,351 | 3.0625 | 3 | [
"MIT"
] | permissive | """Implementation of a that wraps angles to -pi and pi."""
import torch
import torch.jit
from rllib.dataset.datatypes import Observation
from .abstract_transform import AbstractTransform
class AngleWrapper(AbstractTransform):
"""Implementation of a Reward Clipper.
Given a state vector, it will wrap the an... | true |
b466903a9c2b891ffe51599cccd493e0b0cf5432 | sjl421/ML-Pipeline | /ml/Reporting.py | UTF-8 | 21,527 | 2.8125 | 3 | [] | no_license | #!/usr/bin/python
# coding=utf-8
import logging
import os
from datetime import datetime
import matplotlib.pyplot as plt
import numpy as np
from sklearn import metrics
from sklearn.learning_curve import learning_curve
from sklearn.learning_curve import validation_curve
from sklearn.metrics import explained_variance_sco... | true |
5290c4069f76d7fb303779cb6ea3ae24b688a850 | oliviagardiner/green-fox-projects-oliviaisarobot | /week-05/day-01/cows-and-bulls.py | UTF-8 | 3,140 | 4.6875 | 5 | [] | no_license | #Create a class what is capable of playing exactly one game of
#Cows and Bulls (CAB). The player have to guess a 4 digit number.
#For every digit that the player guessed correctly in the correct place,
#they have a “cow”. For every digit the player guessed correctly in the
#wrong place is a “bull.”
#The CAB object sho... | true |
0e16af94aac69f36b9e50571bb4c34cafe5c12fa | korea7030/py_block | /ch05/mining.py | UTF-8 | 3,504 | 3.015625 | 3 | [] | no_license | import binascii
import hashlib
import time
from datetime import datetime
# big-endian <-> little-endian 변환
# x는 hex-string
def reverse(x):
return ''.join(reversed([x[i:i+2] for i in range(0, len(x), 2)]))
def double_sha256(header):
return hashlib.sha256(hashlib.sha256(header).digest()).digest()
def make_head... | true |
4f95fe4b6fcef70c8796db53b23ff308ef34401e | alonsoggpablo/DL_1_HOUSING_PRICES | /housing_prices_regression_models.py | UTF-8 | 4,922 | 3.25 | 3 | [] | no_license | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from pandas.plotting import scatter_matrix
from sklearn.ensemble import RandomForestRegressor
from sklearn.linear_model import LinearRegression
from sklearn.metrics import mean_squared_error
from sklearn.model_selection import train_test_split, Stra... | true |
e46e26981007bf80a388df2180196d55434b493a | redmage123/basicpython | /examples/cleanup.py | UTF-8 | 741 | 2.953125 | 3 | [] | no_license | #!/usr/bin/env python
f = open("ALbb.salaries.2003.csv")
offset = 3
salarylist = []
salary=""
for i in range(0,4):
f.readline()
input=f.readline()
while (input != ",,,"):
inputlist = input.split(",")
salarylist.append(inputlist[offset].replace("\"",""))
offset +=1
while inputlist[offset].isdigi... | true |
b2bd6644995d9a742a146a22713c55462c9e8d91 | lygeneral/LeetCode | /Python/Array/middle/79_word-search.py | UTF-8 | 2,127 | 3.9375 | 4 | [] | no_license | '''
79. 单词搜索
给定一个二维网格和一个单词,找出该单词是否存在于网格中。
单词必须按照字母顺序,通过相邻的单元格内的字母构成,其中“相邻”单元格是那些水平相邻或垂直相邻的单元格。同一个单元格内的字母不允许被重复使用。
示例:
board =
[
['A','B','C','E'],
['S','F','C','S'],
['A','D','E','E']
]
给定 word = "ABCCED", 返回 true
给定 word = "SEE", 返回 true
给定 word = "ABCB", 返回 false
提示:
board 和 word 中只包含大写和小写英文字母。
... | true |
10805d9b8bfb0de853fc59d23df9904f9dfc9608 | mdelhoneux/oDETTE | /odette/scripts/experiment.py | UTF-8 | 4,409 | 2.703125 | 3 | [
"Unlicense"
] | permissive | #!/usr/bin/env python
#==============================================================================
#author :Miryam de Lhoneux
#email :miryam.de_lhoneux@lingfil.uu.se
#date :2015/12/30
#version :1.0
#description :Transform parse detransform experiment pipeline on a treebank
#usage :python scripts/experiment.... | true |
3632713260d3073028c89d36a18b85f16995fd81 | Fansion/sharefun | /sharefun/script/spider/crawlDoubanWorkInfoTest.py | UTF-8 | 5,400 | 2.8125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
__author__ = 'frank'
"""Unit Test Cases for crawller"""
import unittest
from crawlDoubanWorkInfo import *
from spider_config import *
from bs4 import BeautifulSoup
import os
class crawllerTest(unittest.TestCase):
def testDownloadPic(self):
url = 'http://img3.douban.com/view/mov... | true |
29f075086e574c066b9ce5b77ee2eb5c89692814 | Jackline-cheptanui/AAAABBLIST | /jack.py | UTF-8 | 607 | 3.71875 | 4 | [] | no_license | name=input("Enter your name: ")
print(name*100)
name =input("Enter your name : ")
while 1:
print(name, end = " ")
name = input("Enter your name : ")
for k in range (1, 101):
print(k, name)
print("Squares of integers are : ")
for p in range (1, 21):
p... | true |
9babbdc74c7072b5b18ee3cee500a53ff793acff | wonjames/ML_Final | /MLP_predict_popularity.py | UTF-8 | 2,659 | 2.859375 | 3 | [] | no_license | import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.neural_network import MLPClassifier
import joblib
from sklearn.metrics import classification_report, confusion_matrix
from sklearn.neural_network import MLPRegressor
import spotify as sp
import ast
from pandas import DataFrame
from sk... | true |
d520d87a98157c215be2656784646e76489c2317 | Muditalbet/FirstProject | /first.py | UTF-8 | 104 | 3.421875 | 3 | [] | no_license | x=int(input())
if(x%2==0):
print("X is divisible by 2")
else:
print("the no. is not divisible by 2")
| true |
d5fe5747c84c5e59c3a0f40a8f7b7f08d5033735 | LelsersLasers/Python-Sticks | /Sticks.py | UTF-8 | 7,246 | 3.578125 | 4 | [] | no_license | oneLeft = 1
oneRight = 1
twoLeft = 1
twoRight = 1
gameOn = True
while gameOn:
#one turn
turnOne = True
while turnOne:
turnOne = False
print("playerOne Left Hand: " + str(oneLeft))
print("playerOne Right Hand: " + str(oneRight))
print("playerTwo Left Hand: " + str(twoLeft))
print("playerTwo Right Hand: "... | true |
ddecbb7f67eb333ed4b8afdee0a4638e256c3203 | lilianhj/d4d | /countysums.py | UTF-8 | 1,786 | 2.609375 | 3 | [] | no_license | from __future__ import division
import numpy as np
import pandas as pd
import sys
import re
df = pd.read_csv("AK_12_withcounty.csv")
df['groupby_obama'] = df.groupby(by=['County'], as_index=False)['obama'].transform('sum')
df['groupby_romney'] = df.groupby(by=['County'], as_index=False)['romney'].transform('sum')
df['... | true |
ac3ee3affa4e1bf8bc16bffbf169863372294bc8 | sreeven/Bootcamp | /sqlalchemy-challenge/app.py | UTF-8 | 3,476 | 2.640625 | 3 | [] | no_license | # Import Dependencies
import numpy as np
import datetime as dt
import sqlalchemy
from sqlalchemy.ext.automap import automap_base
from sqlalchemy.orm import Session
from sqlalchemy import create_engine, func
# Set Base
engine = create_engine("sqlite:///Resources/hawaii.sqlite")
Base = automap_base()
Base.prepare(eng... | true |
2712aedf00a7156fd8030f0f60037180311ea8b6 | aickathon2018/teams | /Phenomenal/ClothStore/server/model.py | UTF-8 | 2,399 | 2.859375 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import random
def get_mapper(data):
mapper = {"Nothing" : -1}
for datum in data:
if datum not in mapper:
mapper[datum] = len(mapper) - 1
return mapper
def map(data, mapper):
result = []
f... | true |
2f791138ca7f3af0841d5eed1a18898a06c549f7 | Utpal-Mishra/Omdena-Nigeria-Local-Chapter-2021 | /one.py | UTF-8 | 2,387 | 3.203125 | 3 | [] | no_license | import streamlit as st
import sys
import pandas as pd
import matplotlib.pyplot as plt
import plotly.express as px
import pickle
import joblib
def app():
st.title("OMDENA NIGERIA LOCAL CHAPTER 2021")
st.write("")
st.write("")
# loading the trained model
#pickle_in = open('c... | true |
ce2e7fa9564551d3cb0a44c73eb3b05ae1033c2d | yangy09/Drosophila-embyogenesis-study | /CNN_implementation/data.py | UTF-8 | 2,074 | 2.703125 | 3 | [] | no_license | import os
import csv
import numpy as np
from PIL import Image
from keras.utils import np_utils, generic_utils
def read_image(img_url):
img = Image.open(img_url).convert('L')
arr1 = np.asarray(img,"float64")
return arr1
def data_set_loading(samples_csv):
# dir_path is where FlyExp... | true |
b9adc1f2b5ec2e446e2ffc4d145ec5456f368f7b | UWPCE-PythonCert-ClassRepos/SP_Online_PY210 | /students/mattcasari/lesson03/slicing_lab.py | UTF-8 | 2,302 | 4.59375 | 5 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
""" Lesson 3, Excercise 1
@author: Matt Casari
Link: https://uwpce-pythoncert.github.io/PythonCertDevel/exercises/slicing.html
Tasks:
Write some functions that take a sequence as an argument, and return a copy of that sequence:
- with the first and last items excha... | true |
003280c0a08bed921a88f8b186e53f67e14fd232 | Shivani-01/Python-Assignment | /Python-Asignment/Module 6/datastore.py | UTF-8 | 13,986 | 2.78125 | 3 | [] | no_license | import pickle
def fn(datastore):
for i in datastore:
print(i,end=' ')
for j in datastore[i]:
if j != "parking":
print(j,end="\t ")
print(datastore[i][j][0])
for k in range(1,len(datastore[i][j])):
print("\t\t... | true |
95c96c7ae697b4693ed2e6862c78c1f11752a9ff | AndrianovaVarvara/algorithms_and_data_structures | /TASK/Хирьянов 1 лекция черепаха/10_flower.py | UTF-8 | 311 | 3.671875 | 4 | [] | no_license | import turtle
turtle.shape('turtle')
def circle(a):
for i in range (36):
turtle.forward(a)
turtle.left(10)
for i in range (36):
turtle.forward(a)
turtle.right(10)
turtle.speed(10)
a = 10
for i in range (3):
circle(a)
turtle.left(60)
input ()
| true |
8e4ca71943348437370d751a8498996cf2e08239 | willdickson/m1_wind_sensor | /software/python/m1_wind_sensor/examples/run_wind_sensor.py | UTF-8 | 991 | 2.984375 | 3 | [
"MIT"
] | permissive | from __future__ import print_function
import time
import sys
import signal
import matplotlib.pyplot as plt
from m1_wind_sensor import M1WindSensor
duration = 15.0
wind_sensor = M1WindSensor()
wind_sensor.start()
quit = False
def sigint_handler(signum, frame):
global quit
quit = True
signal.signal(signal.SIG... | true |
fd49e7d2826120d8a7f5d9003f3c5c3adc438d1f | EoinDavey/Competitive | /MUCSS/compqs/turtle_troop/generators/gen.py | UTF-8 | 190 | 2.78125 | 3 | [] | no_license | from random import randint, shuffle
import sys
TOT = randint(500, 1000)
M = randint(TOT//2, TOT)
print(TOT, M)
ls = [randint(-1000, 1000) for _ in range(TOT)]
print(' '.join(map(str, ls)))
| true |
a65bce3e5781c26106e9148a29d74dda98ff230b | Roy-Rupak/graph_mining | /codes/cluster.py | UTF-8 | 2,552 | 2.671875 | 3 | [] | no_license | import networkx as nx
import pickle
from sklearn import cluster
def clusterize(G_nx, k, clustering_technique = 'k_means'):
nodes = G_nx.nodes(data=True)
coordinate_list = [[nodes[i]['x'], nodes[i]['y']] for i in range(len(nodes))]
num_clusters = k
if clustering_technique == 'k_means':
res = cl... | true |
70f587ef98928b8d94a235f17145985791ff57da | sanidhyamangal/interviews_prep | /code_prep/abstract_structures/heap/priority_queue.py | UTF-8 | 1,339 | 3.4375 | 3 | [] | no_license | #!/usr/bin/env python
__author__ = "tchaton"
from ..heap.heap import Heap
import numpy as np
def test():
''' push and pop are all O(logN) '''
q = PriorityQueue()
q.push(Item('test1', 1))
q.push(Item('test2', 4))
q.push(Item('test3', 2))
#q._print()
assert(str(q.pop()) == "Item('test2')")
... | true |
83e16c7dce9d742ab414844d2fb3312ed24c7231 | goyalgaurav64/Stack | /max-area-rectangle-in-binary-matrix.py | UTF-8 | 2,229 | 3.59375 | 4 | [] | no_license | def createStack():
s=[]
return s
def push(s,ele):
s.append(ele)
def pop(s):
return s.pop()
def top(s):
n=len(s)
return s[n-1]
def isEmpty(s):
return len(s)==0
def NSR(a):
right=[]
s=createStack()
n=len(a)
for i in range(n-1,-1,-1):
if isEmpt... | true |
b7f848df41d7f513941457335dd5c8cdac26afc9 | satyajeetdeshmukh/Python-OpenCV | /learning basics/range.py | UTF-8 | 39 | 3.09375 | 3 | [] | no_license | for x in range(5, 12, 2):
print(x)
| true |
bd0298d9a90db13c1483d3fb92410726488a2c7d | PnuLikeLion9th/Summer_algorithm | /joonghoo/6주차/0727 안녕.py | UTF-8 | 737 | 3.140625 | 3 | [] | no_license | # 백준_1535_안녕_DP_실버 2
# 배낭 알고리즘을 사용하는 문제
import sys
input = sys.stdin.readline
n = int(input())
hp = [0] + list(map(int, input().split()))
happy = [0] + list(map(int, input().split()))
dp = [[0 for _ in range(100)]for _ in range(n+1)]
for i in range(1, n+1):
for j in range(100):
if hp[i] > j: # j 보다 큰 hp... | true |
d79d0ec5399fdbd69cc6fe3051269f16ebd581f2 | ccarlocchia/Flights-Manager | /Ejemplos grafos/es_arbol.py | UTF-8 | 2,718 | 3.28125 | 3 | [] | no_license | import random
class Cola:
def __init__(self):
self.items = []
def encolar(self, x):
self.items.append(x)
def desencolar(self):
if self.esta_vacia():
raise ValueError
return self.items.pop(0)
def esta_vacia(self):
return len(self.items) ==... | true |
f34d7fb51d02d8e27112d2e130d5d3d13e4aa2a9 | Te12944265-AMAHA/112 | /stella_bullet_kinect.py | UTF-8 | 10,631 | 2.671875 | 3 | [] | no_license |
import pygame
from pykinect2 import PyKinectV2, PyKinectRuntime
from pykinect2.PyKinectV2 import *
import ctypes
import _ctypes
import sys
import math
import random
pygame.init()
class Axolotyl(object):
def __init__(self, x, y, width, height, picture, attack):
self.x = x
self... | true |
b8bbcf12e71a46fea0ad882cb79bd63964abaee0 | Oz-like-the-Wizard/Deep-Learning---Image-Gun-Detector | /modules/kerasfns.py | UTF-8 | 2,163 | 2.609375 | 3 | [] | no_license | from keras.models import Sequential
from keras.layers import Conv2D
from keras.layers import MaxPooling2D
from keras.layers import Flatten
from keras.layers import Dense
from keras.layers import Dropout
from keras.callbacks import EarlyStopping
from keras.callbacks import ModelCheckpoint
from sklearn.metrics import cla... | true |
b8316ee9871633f76ed3a838c638f2f14cccda20 | MirzoevNik/University | /Programming Technologies (Python)/task1_3.py | UTF-8 | 425 | 3.625 | 4 | [] | no_license | from math import *
# 1
x = int(input())
print(x % 10)
# 2
x = float(input())
print(int(x * 10) % 10)
# 3
h = int(input())
a = int(input())
b = int(input())
print(ceil((h - b) / (a - b)))
# 4
x = float(input())
result = int(x)
if int(x * 10) % 10 > 4:
result += 1
print(result)
# 5
p = int(input())
x = int(input... | true |
435a9192dbdb9177206ce199b283297d0802fa8c | alexandraback/datacollection | /solutions_5662291475300352_0/Python/bambit/3.py | UTF-8 | 667 | 3 | 3 | [] | no_license | inp = open('3.test')
T = int(inp.readline().rstrip())
for t in range(1,T+1):
N = int(inp.readline().rstrip())
hikers = []
for n in range(N):
startloc, numhikers, fastest = map(int, inp.readline().rstrip().split())
for i in range(numhikers):
hikers.append((fastest+i, startloc))
... | true |
df7aebd0b9a3350a3bfd162a1dd17eb7b336866d | MingyangYin/CS231n_2019 | /npy.py | UTF-8 | 289 | 3.015625 | 3 | [] | no_license | import numpy as np
a = np.array([[1,2], [2,3] ,[3,0]])
print(a.shape)
print(a.shape[0])
print(a)
x = 100
# for i in range(x):
# print(i)
# print(np.arange(i))
x = np.array([[1,2],[3,4]])
y = np.array([[5,6],[7,8]])
v = np.array([9,10])
w = np.array([11, 12])
print(np.dot(v,x))
| true |
691aa13e47d0b35c5ee0f7341a35907351bc07bc | NathanaelV/CeV-Python | /Modulos Curso em Video/ex111_transformando_modulos_em_pacotes.py | UTF-8 | 125 | 2.65625 | 3 | [] | no_license | # Class Challenge 22
from ex111.utilidades.moeda import moeda
p = float(input('Enter a Value: '))
moeda.resumo(p, 80, 35)
| true |
4930f53dbf1457615595bfadb41785363aa9f226 | vitorassis/forca_enzo_vitorassis | /forca.py | UTF-8 | 10,609 | 2.5625 | 3 | [] | no_license | from src.forca import Forca
import os
des_forca = ['''
+---+
| |
|
|
|
|
=========''', '''
+---+
| |
O |
|
|
|
=========''', '''
+---+
| |
O |
| |
|
|
=========''', '''
+---+
| |
O |
/| |
|
|
=========''', '''
+---+
... | true |
8d13841618dcae9695181d4cd1255e0a2b3ae6f5 | swtwinsy/Code_Challenges | /dailyprogrammer.reddit.com/easy/E_challenge_265.py | UTF-8 | 438 | 3.34375 | 3 | [] | no_license | from itertools import permutations, combinations
def gen_permuation(idx, num):
perms = list(permutations([x for x in range(num)]))
print(*perms[idx-1], sep=' ')
def gen_combination(idx, cnt, num):
combos = list(combinations(range(num), cnt))
print(*combos[idx-1], sep=' ')
if __name__ == '__main__'... | true |
fd77ad9390f6960e8f319edea465c22910e71902 | adriiancorral/PBE | /pruebas/amor.py | UTF-8 | 2,482 | 2.65625 | 3 | [] | no_license | from lcd_display import lcd
from time import sleep
screen = lcd()
screen.clear()
screen.display_string("* ", 1)
screen.display_string("*- ", 1)
screen.display_string("*-- ", 1)
screen.display_string("*--- ", 1)
screen.display_string("*---- ... | true |
0c6b63c383fabd38515e438138da13c5979de0e8 | Elephant34/pygletLearning | /basics/HelloWorld.py | UTF-8 | 703 | 3.203125 | 3 | [
"MIT"
] | permissive | import pyglet
window = pyglet.window.Window(500, 400, caption="Hello World")
label = pyglet.text.Label(
"Hello World",
font_name="Arial",
font_size=25,
x=window.width//2,
y=window.height//2,
anchor_x="center",
anchor_y="center"
)
'''
event_logger = pyglet.window.event.WindowEventLogger()
... | true |
0ec1aa135a733f280577ad7d3c5c11e241b14f1e | pauljherrera/options_backtester | /strategies/strategies.py | UTF-8 | 1,299 | 2.765625 | 3 | [] | no_license | import pandas as pd
import numpy as np
from config import config
from strategies.baseStrategy import BaseStrategy
positionPercent = config['%ofPosition']
class CoveredCall(BaseStrategy):
"""
Covered call strategy.
"""
def __init__(self):
super().__init__()
name = 'Covered Call '
... | true |
d24db1751a476cc071feed465475b0d63ada4d39 | LFZ1994/WeChat-JumpGame-Cheat | /frames_analyze.py | UTF-8 | 7,002 | 2.53125 | 3 | [] | no_license | import cv2
from getscreen import getScreen
import numpy as np
import math
def findTopPoint(img_binary,cols,rows):
for i in range(int(rows*0.3),int(rows*0.9)):
for j in range(int(cols*0.02),int(cols*0.98)):
if(img_binary[i,j] == 0):
point = [j,i]
return point
def... | true |
168437f5c6c04fdada72cbccdbbec11da51d3b6b | bhavishya18/Let-s-Code-Python- | /Search2DMatrix.py | UTF-8 | 604 | 3.359375 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[4]:
def searchMatrix(matrix, target):
if matrix==[] or matrix==[[]]:
return False
if target<matrix[0][0] or target>matrix[-1][-1]:
return False
row=len(matrix)
col=len(matrix[0])
i=0
j=col-1
while i>=0 and i<row and j>=0 and j<col... | true |
0dca166dfe82b98a3adbe25a6a0a8ace7c3f0757 | zhiwenwei/python | /day4/迭代器&生成器.py | UTF-8 | 1,227 | 4.0625 | 4 | [] | no_license | #coding:utf-8
#Author:Mr Zhi
#生成器:只有在调用时才会生成相应的数据,只记录当前位置,只有一个__next__()方法
#列表生成式:
l = [i * 2 for i in range(10)]
print(l)
#生成器:
c = (i*2 for i in range(100))
#print(c.__next__) 每次调用一个元素,直到计算到最后一个元素,没有更多的元素时,抛出StopIteration的错误
for a in c:
print(a)
#经过测试生成器和列表生成器,两者占用cpu和运行速度不差上下,但是生成器只占用4g内存的0.3%,列表生成式占2.4%
#迭代... | true |
2b6091abd96c589d4944d478117554a7d9d53379 | zhaozhilong1993/openstack_test | /wsgi/pecan/golden/api/controllers/v1/user.py | UTF-8 | 1,323 | 2.578125 | 3 | [] | no_license | from golden.api.controllers.v1 import base
from golden.api import expose
from wsme import types as wtypes
"""
class Base(six.with_metaclass(BaseMeta)):
def __init__(self, **kw):
for key, value in kw.items():
if hasattr(self, key):
setattr(self, key, value)
"""
class Us... | true |
8a75c0fdc03f686e8583e621f0eba840ea54d248 | guoyunqian/Python_meteo-lib | /basicdatafunctions/sta_sta_function.py | UTF-8 | 2,519 | 2.53125 | 3 | [] | no_license | #!/usr/bin/python3.6
# -*- coding:UTF-8 -*-
import numpy as np
from copy import deepcopy
import basicdatas as bd
from mymethods.math import lon_lat_to_cartesian
from scipy.spatial import cKDTree
import math
from collections import OrderedDict
import pandas as pd
def recover(sta_from,sta_to):
ids = st... | true |
30b821c56b42fdff047da1b38bcb942058322407 | Nguyen-Thanh-Tung/Sentiment | /test/readFile.py | UTF-8 | 284 | 2.921875 | 3 | [] | no_license | import zipfile
import tensorflow as tf
def read_data(filename):
"""Extract the first file enclosed in a zip file as a list of words."""
with zipfile.ZipFile(filename) as f:
data = tf.compat.as_str(f.read(f.namelist()[0])).split()
return data
print(read_data("text8.zip")) | true |
36b0773311f06947d3d43710b704dc8a6defcd50 | gabriellaec/desoft-analise-exercicios | /backup/user_292/ch16_2020_03_16_22_38_43_749094.py | UTF-8 | 112 | 3.171875 | 3 | [] | no_license | y=int(input('qual o valor da conta?'))
valor=y*1.1
texto='Valor da conta com 10% {0}'.format(valor)
print(texto) | true |
d289f679509e8d9d38ac4b4428844a1456ba7305 | vt0311/python | /FaceBook/test01.py | UTF-8 | 239 | 2.515625 | 3 | [] | no_license | '''
Created on 2017. 11. 1.
파일 다운로드 하기
@author: acorn
'''
import urllib.request
url = "http://uta.pw/shodou/img/28/214.png"
savename = "test.png"
urllib.request.urlretrieve(url, savename)
print('저장되었습니다.') | true |
5819eeef3987a90dc81a2e1a18be309406266cb1 | lisuizhe/algorithm | /leetcode/python/Q0133_Clone_Graph.py | UTF-8 | 720 | 3.46875 | 3 | [
"Apache-2.0"
] | permissive | import queue
# Definition for a Node.
class Node(object):
def __init__(self, val, neighbors):
self.val = val
self.neighbors = neighbors
class Solution(object):
def cloneGraph(self, node):
"""
:type node: Node
:rtype: Node
"""
visited = dict()
def... | true |
ca5def647d12e992c82948975c547881aeafd816 | matt-bentley/Chinese-Text-Classification | /train.py | UTF-8 | 2,520 | 2.71875 | 3 | [] | no_license | import data_helpers
from sklearn import model_selection, preprocessing, linear_model, naive_bayes, metrics, svm
from sklearn.feature_extraction.text import TfidfVectorizer, CountVectorizer
from sklearn import decomposition, ensemble
from sklearn.linear_model import SGDClassifier
from sklearn.svm import LinearSVC
impo... | true |
f18fb5bde8ac1d0ca9f21aa914b98244755e177d | FrancescoPenasa/UNITN-CS-2019-LaboratoryOfComputerScienceEducation | /ESEMPI_TURTLE/FOR/da_while_a_for.py | UTF-8 | 386 | 3.40625 | 3 | [] | no_license | # importiamo il package turtle
import turtle
# inizializzazione
s = turtle.getscreen() # finestra
t = turtle.Turtle() # tartaruga
lato = 1
while lato <= 3:
print("disegno lato" + str(lato))
t.forward(100)
t.right(120)
lato = lato+1 # stepper
for lato in 3:
t.goto(300, 0)
print("disegno lato" + str(lato))
t.f... | true |
5329878ba0d40eee0e7af4c3f5a00c1286b32d4b | MukHansen/pythonAfleveringer | /Uge2-lists,loops,functions/.history/utils_20200204170857.py | UTF-8 | 323 | 2.65625 | 3 | [] | no_license | from sys import argv
import csv
import platform
import argparse
import os.path
from os import path
from exercise1 import write_list_to_file
def files_in_folder(foldername):
lst = []
with open(foldername) as f_obj:
content = f_obj.readlines()
for line in content[:20]:
lst.append(lin... | true |
7e6be0c26326d139633e40a3a3d08f9c01a76be0 | tokirmanva22/Coursera-Data-Structures-and-Algorithms | /Algorithmic Toolbox/week4_divide_and_conquer/6_closest_points/closest.py | UTF-8 | 1,573 | 3.5625 | 4 | [
"MIT"
] | permissive | # Uses python3
import sys
from math import sqrt
def min_dist_sort(x, y):
points = list(zip(x, y))
points = sorted(points, key=lambda x: x[0])
return sqrt(minimum_distance(points))
def minimum_distance(points):
N = len(points)
if N <= 3:
x, y = [list(t) for t in zip(*points)]
retu... | true |
481c06be54f821b0583567e370707ce21bb18399 | BartoszBiskupski/PyloveProject | /pylove1.6.py | UTF-8 | 2,214 | 3.53125 | 4 | [] | no_license | class Czas:
"""Stwórz klasę Czas, której konstruktor (__init__)
będzie brał trzy opcjonalne argumenty, godzine, minuty,
sekundy i zapisywal je w odpowiednich zmiennych w klasie."""
def __init__(self, h=0, mins=0, sec=0):
self.h = h
self.mins = mins
self.sec = sec
... | true |
55c385228aa8b22a8535a43454ae27edc1079efe | JETSCAPE/STAT | /src/design.py | UTF-8 | 13,156 | 2.78125 | 3 | [
"MIT"
] | permissive | """
Generates Latin-hypercube parameter designs.
When run as a script, writes input files for use with my
`heavy-ion collision event generator
<https://github.com/jbernhard/heavy-ion-collisions-osg>`_.
Run ``python -m src.design --help`` for usage information.
.. warning::
This module uses the R `lhs package
... | true |
aae459b72282d590d4689105bb2f15e49e10ce69 | PavelBjorn/ADBI-1 | /idk/cachebuilder/location.py | UTF-8 | 4,974 | 2.875 | 3 | [
"Apache-2.0"
] | permissive | from itertools import count
import logging
import os
def iter_files(compilation_unit):
'''Yield all file paths in the given compilation unit.
Yield absolute paths if possible. Paths are not guaranteed to be unique.'''
topdie = compilation_unit.get_top_DIE()
def iter_files_raw():
# Yiel... | true |
65acfb629977c10c1efb0671019bdb7fee4135a9 | Ziang-Lu/Design-Patterns | /3-Structural Patterns/2-Bridge Pattern/Shape Example/Python/bridge_pattern_test.py | UTF-8 | 1,262 | 3.75 | 4 | [
"MIT"
] | permissive | #!usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Application that actually uses Bridge Pattern.
"""
__author__ = 'Ziang Lu'
from color_implementor import BlueImplementor, RedImplementor
from shape import Circle, Rectangle
def main():
rectangle = Rectangle(center_x=0.0, center_y=0.0, width=10.0, height=5.0)
... | true |
5fb01209fd7ad495bd7752bbc32f4325355ad25c | spenserca/aoc-python | /src/_2020/day_one/solution.py | UTF-8 | 539 | 2.5625 | 3 | [] | no_license | from _2020.day_one.utils import get_product_of_2_values_summing_to_2020, get_product_of_3_values_summing_to_2020
from _2020.utils.input_utils import get_input_lines
def day_one_part_one():
input_lines = get_input_lines('day_one')
expense_report = list(map(int, input_lines))
return get_product_of_2_values_... | true |
2936103c55bfd0313e6ac93e06753b92ee7f78e8 | Code-Institute-Submissions/michaelhdev-project-4 | /cart/views.py | UTF-8 | 987 | 2.65625 | 3 | [] | no_license | from django.shortcuts import render, redirect, reverse
from django.contrib import messages
from django.contrib.auth.decorators import login_required
@login_required
def view_cart(request):
"""A View that renders the cart contents page"""
return render(request, "cart.html")
@login_required
def add_to_cart(requ... | true |
df384a5a5e92776b707b1ce080ea1e050f2d370e | maartenbreddels/mab | /mab/asciifile.py | UTF-8 | 2,637 | 2.703125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
import os
from mab.cvsfile import Record, CsvObject
class Column(object):
def __init__(self, start, end, name, format, zerovalue=9999.9):
self.start = start
self.end = end
self.name = name
self.zerovalue = zerovalue
if format[0] == "A":
self.convert = lambda x: x.strip()
elif fo... | true |
fae6b5c69cca79cb4d71f7ea44f0f028f7923941 | Il-c/hy-data-analysis-with-python-2020 | /part01-e17_positive_list/src/positive_list.py | UTF-8 | 180 | 2.546875 | 3 | [] | no_license | #!/usr/bin/env python3
def positive_list(L):
return list(filter(isPositive, L))
def isPositive(x):
return x>0
def main():
pass
if __name__ == "__main__":
main()
| true |
b4dc9a897abe609ff9b127cfcd612d84a2a1f047 | withrocks/confluence-tools | /confluence_tools/workflow.py | UTF-8 | 4,959 | 2.703125 | 3 | [] | no_license | import json
import os
from confluence_tools.content import ConfluenceContent
import logging
class Workflow:
"""
Defines top-level actions in the documentation workflow
"""
def __init__(self, provider, whatif, msg, logger=None):
"""
Initializes the workflow with a provider that looks li... | true |
dc6e6c2582e95df653e7555855b19c418e40f9d6 | Bama-S/algorithms | /sumnrecursive.py~ | UTF-8 | 335 | 3.1875 | 3 | [] | no_license | def recursive (n):
global t
print "list has been called with n =", n
if len(n) ==1:
print "returning back the value ", n[0]
return n[0]
else:
print "1st element", n[0]
res = n[0]+ recursive(n[1:])
print "Intermediate result", res
return res
t = 1
recursiv... | true |
a15091947d38b37c2321ddc90c9158d15d0b49d8 | shwetaamrit/officetask | /scraping2csv.py | UTF-8 | 1,712 | 3.015625 | 3 | [] | no_license | from lxml import html
import requests
import csv
page = requests.get('https://www.imdb.com/title/tt7638344/fullcredits?ref_=tt_cl_sm#cast')
tree = html.fromstring(page.content)
download_dir = "starcast1.csv" #where you want the file to be downloaded to
csv = open(download_dir, "w")
columnTitleRow = "Actor, Chr... | true |
7513278451d05d9be5921c1b2c1980a26673f06d | renjieliu/leetcode | /2000_2499/2061.py | UTF-8 | 853 | 2.796875 | 3 | [] | no_license | class Solution:
def numberOfCleanRooms(self, room: 'List[List[int]]') -> int:
direction = [[0,1], [1,0], [0,-1], [-1,0]] #right, down, left, up
r = c = d = 0
seen = {(r,c,d)} #(r,c, nxtdirection)
cleaned = {(r,c)}
while True:
if -1 < r+direction[d][0] < len(room)... | true |
80071c3e95ae4b0a383d1763f2bfed8065506218 | zhangchizju2012/LeetCode | /97.py | UTF-8 | 5,350 | 3.40625 | 3 | [] | no_license | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 16 15:40:00 2017
@author: zhangchi
"""
class Solution(object):
# 总体思路:我自己做的,我自己优化的,submit了很多次
# s1,s2,s3各自有一个指针,如果s1(s2)的指针指向的数字跟s3指针指向的数字相等,就挪到下一个数
# 如果s1,s2,s3指向的数都相等,先看看尾部的情况(这个trick只是为了减少recursion的次数)
def isInterleave(self, s1, ... | true |
30662af7d5a0452217533f31327239eed40afad9 | Lingrui/Leetcode | /Algorithms/Easy/best_time_to_buy_and_sell_stock.py | UTF-8 | 556 | 3.703125 | 4 | [] | no_license | #!/usr/bin/python
class Solution(object):
def maxProfit(self,prices):
'''
:type prices: List[int]
:rtype: int
'''
pro = 0
if (len(prices) >= 1):
price_min = prices[0]
for i in range(1,len(prices)):
if ((prices[i]-price_min) > pro):
pro = prices[i] - price_min
if (prices[i] < price_min):
... | true |
d818b02e926f0f9b97595b6f1f1e7cc1ceb22921 | hiwaylon/tornado-baseline | /api/handlers/mixins.py | UTF-8 | 1,585 | 2.90625 | 3 | [] | no_license | """The mixins module provides starndard resource handler mixins."""
import abc
from api.utils import error
class ResourceCreationMixin(object):
"""This mixin provides a standard resource creation interface.
The ``create_resource`` method is called by the subclass. It is a template
method that will perf... | true |
5ab258be4b248001a91813b7134ea2c55150eb48 | gabrielalvesfortunato/TDD-Python | /tests/test_leilao.py | UTF-8 | 3,539 | 3.265625 | 3 | [] | no_license | from unittest import TestCase
from src.leilao.dominio import *
from src.leilao.excecoes import *
# Classe responsável por testar a classe avaliador em dominio.py
class TestLeilao(TestCase):
# Criação do cenário de testes
def setUp(self):
self.usuario_gabriel = Usuario("Gabriel")
self.lance_ga... | true |
b1880dc33e6c435fc76d2be037f3285ad0d6d6ce | nguyenvanhuybk99/django_rest_mongo | /fruit_store/test/customer_test.py | UTF-8 | 1,428 | 2.65625 | 3 | [] | no_license | import click
import requests
@click.group()
def cli():
pass
@click.command('register')
def register():
url = "http://0.0.0.0:8000/customer/register"
print(url)
payload={
'username': 'nguyenvanhuybk99',
'password': 'backend'
}
response = requests.request("POST", url, data... | true |
94f7bd913c7127a1a1980bbfaa6c93cc3b6511a7 | AlexandarDjordjevic/WebPlayer | /test.py | UTF-8 | 2,625 | 2.640625 | 3 | [] | no_license | import vlc
import threading
import time
import os
import json
class Player:
def __init__(self):
self.instance = vlc.Instance()
self.media_player = self.instance.media_player_new()
self.media = 0
self.state = 0
self.play_status = "stop"
self.playlist = ""
self... | true |
e985210670df7e27252538c3a0816643924ac62e | Carmon-Lee/python | /python_cookbook/algorithm/sigmoid.py | UTF-8 | 334 | 3.21875 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
size=50
x1=np.linspace(0,10,size)+np.random.rand(size)*5
y1=2*x1+1+np.random.rand(size)*5
x2=np.linspace(0,10,size)+np.random.randn(size)*1
y2=2*x2+10+np.random.randn(size)*1
plt.figure()
plt.scatter(x1,y1,color='r',marker='s')
plt.scatter(x2,y2,color='b',marker='o... | true |
d265ae8a6fdcac160551f7d6e81d6f0e04086df3 | JerryXue0609/Python-Data-Analysis | /maoyan_data/getMaoyan.py | UTF-8 | 1,624 | 3.015625 | 3 | [] | no_license | import requests
import time
import json
#获取每一页数据
def get_one_page(url):
response = requests.get(url=url)
if response.status_code == 200:
return response.text
return None
#解析每一页数据
def parse_one_page(html):
data = json.loads(html)['cmts']#获取评论内容
for item in data:
yie... | true |
40a745aa07614d7fe2349bc21ed55be49c3bf4e0 | laszukdawid/ai-traineree | /ai_traineree/agents/d4pg.py | UTF-8 | 18,237 | 2.65625 | 3 | [
"Apache-2.0"
] | permissive | # WARNING: This module hasn't been tested after migrating to Spaces.
# It is deemed experimental. No guarantee whatsoever.
# TODO: Test this module on some environments.
import itertools
from functools import cached_property
from typing import Dict
import torch
import torch.nn as nn
import torch.nn.function... | true |
3c55af16a5dcf0204a538bdc6798f8413ebe08f2 | elliottgruzin/irony_prediction | /benchmark.py | UTF-8 | 3,201 | 3 | 3 | [] | no_license | #!/usr/bin/env python3
'''
example.py
Benchmark system for the SemEval-2018 Task 3 on Irony detection in English tweets.
The system makes use of token unigrams as features and outputs cross-validated F1-score.
Date: 1/09/2017
Copyright (c) Gilles Jacobs & Cynthia Van Hee, LT3. All rights reserved.
'''
from nltk.tok... | true |
a06fbeeb20e3c77d7544a5129a752e747579025d | prasannabe2004/PythonLearning | /myStuffs/python2/misc/myThread.py | UTF-8 | 561 | 3.171875 | 3 | [] | no_license | #!/usr/bin/python
import thread
import time
import threading
count = 0
# Define a function for the thread
def print_time( threadName, delay):
global count
lock = thread.allocate_lock()
while count < 50:
time.sleep(delay)
lock.acquire()
count += 1
lock.release()
print "%s: %s %d" % ( threadName, time.cti... | true |
3233e1c5b9409747279849ece68fba857dc64d71 | jaliste/socolar-taylor | /ising.py | UTF-8 | 4,048 | 3.1875 | 3 | [] | no_license | #Phy250 Project: Ising Model Simulator by Jim Ma
#
# TwoDIsing.py: Two-dimensional Ising Model simulator
# Using PyGame/SDL graphics
#
"""
Options:
-t # Temperature
-n # Size of lattice
-c # Size of cell
-s # Number of time steps
"""
from numpy import *
from numpy.random import *
import getopt,sys
import ti... | true |
a075df4aeb7878926ee17b985d17da1bc6aaaa70 | PaulSchulteCS/hanging_wall_plotter_2019 | /VPlotter.py | UTF-8 | 11,947 | 3.390625 | 3 | [
"Apache-2.0"
] | permissive | import math
from threading import Thread
import Motor_own
import time
import Servo
class VPlotter:
x= 0 #actual position
y= 0 #actual position
distanceX= 0
distanceY= 0
max_geschwindigkeit= 0
def __init__(self, distanceBetweenMotors, distanceYtoOrigin, pin1, pin2, pin3, pin4, pin... | true |