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 |
|---|---|---|---|---|---|---|---|---|---|---|
687250eb039787d80bf6d512e1454c3ccace3728 | zhao750456695/cvpro | /爬虫/使用scrapy模拟登陆csdn/csdn/csdn/spiders/c1.py | UTF-8 | 3,962 | 2.546875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import scrapy
from scrapy.http import Request,FormRequest
import urllib.request
import ssl
import os
from selenium import webdriver
ssl._create_default_https_context = ssl._create_unverified_context
class C1Spider(scrapy.Spider):
name = 'c1'
allowed_domains = ['csdn.net']
# start_u... | true |
a1d621ba66ba9f903ed4af49c9b75467d5acb896 | microsoft/archai | /tasks/face_segmentation/aml/azure/compare_status.py | UTF-8 | 1,659 | 3.203125 | 3 | [
"MIT",
"LicenseRef-scancode-free-unknown",
"LGPL-2.1-or-later",
"Apache-2.0",
"LicenseRef-scancode-generic-cla"
] | permissive | import argparse
import csv
def read_status(filename):
header = None
with open(filename, 'r') as f:
reader = csv.reader(f, delimiter=',')
for row in reader:
header = [x.strip() for x in row]
break
result = {}
with open(filename, 'r') as f:
reader = csv.Di... | true |
a36942de770740a726680750a1a6b0803f272409 | LouisNguyen25/NGCP_Software_2020_2021 | /Main/main.py | UTF-8 | 4,382 | 2.625 | 3 | [] | no_license | """
Main file for running thread processes concurrently:
> Run main on startup/reboot (^–^=)~
> Camera feed (✖╭╮✖)
> GCS Comms (´・Д・lll)ゞ
> Autonomous Navigation Processes:
- IMU
- Waypoint Nav
- Object Avoidance
"""
import time, math, requests, threading, struct
from digi... | true |
c06fae905169fe3ec2d7b95f3af81982627ef8fb | algebra-det/Python | /for loop.py | UTF-8 | 1,075 | 4.15625 | 4 | [] | no_license | # FOR loop
x = ['akash', 22 , 1997]
for i in x: #for loop don't take conditions
print(i)
y = "akash"
for j in y:
print(j)
# OR
print()
for k in "akash": #we can give values in "for" itself without taking any other variable
print(k) #Hence saving... | true |
ad483a869a58860fa2aa6b3977416b9ed7bdf800 | davidgao325/TwitterSentimentAnalysis | /twitter_model_building.py | UTF-8 | 2,469 | 3 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Sat Jul 25 19:19:22 2020
@author: david
"""
# Import the graphs and important classifiers
import pandas as pd
from sklearn.ensemble import RandomForestRegressor
from sklearn.naive_bayes import BernoulliNB
from sklearn.linear_model import LogisticRegression
from sklearn... | true |
4c46391758997d73aa37764fbc7a1b97d8eefdc0 | timothy900/Daily-Coding-Problems | /^DCP/12.27.19 - Sums of zeros/remove_zero_sums.py | UTF-8 | 2,867 | 4.4375 | 4 | [] | no_license | '''
This problem was asked by Amazon.
Given a linked list, remove all consecutive nodes that sum to zero.
Print out the remaining nodes.
For example, suppose you are given the input
3 -> 4 -> -7 -> 5 -> -6 -> 6.
In this case, you should first remove
3 -> 4 -> -7, then -6 -> 6, leaving only 5.
'''
'''
Ma... | true |
dd81dfa76b127e0369aa01177b4267e47b3a8cce | adrianogil/textgen | /src/python/textgen/english/gen_english_phrase.py | UTF-8 | 1,677 | 3.3125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
from simplegrammar.grammar import SimpleGrammar
def gen_english_phrase():
english_phrase = SimpleGrammar()\
.set_text("#main_structure#")\
.add_tag("main_structure", [
"#unreal_conditionals#",
"#used_to_phrases#"
])\
.add_tag("unreal_c... | true |
3c39c6d7f9ba52ee3e6f5508ca2bf45aa0c80281 | cmcahoon01/SpaceRogue | /ships/mothership.py | UTF-8 | 1,557 | 2.75 | 3 | [] | no_license | from ships import ship, projectile
from math import sin, cos, atan2, pi, degrees, sqrt
import pygame
class MotherShip(ship.Ship):
def __init__(self, control):
self.max_health = 150
super().__init__(control)
self.image = pygame.image.load('assets/Mothership.png')
self.ships.ally_shi... | true |
8969e934b3fda640e8abf57f5491e6a7b295eb5f | Aasthaengg/IBMdataset | /Python_codes/p02612/s627951978.py | UTF-8 | 62 | 3.046875 | 3 | [] | no_license | a=int(input())%1000
if a==0:
print(0)
else:
print(1000-a)
| true |
401a4d811027ba4c8d6884fe27cae07e1b2e7b18 | bkerdzaia/nand2tetris | /projects/assembler/Code.py | UTF-8 | 3,207 | 3.078125 | 3 | [] | no_license | #!/usr/bin/evn python3
class Code:
"""
Translates Hack assembly language mnemonics into binary codes.
"""
def dest(self, mnemonic):
""" Returns the binary code of the dest mnemonic. """
translated = ['0', '0', '0']
if mnemonic is None:
return "".join(translated)
... | true |
8324d8a3a9ceb58e00a8d12cf85196d5fb76af83 | moritagit/DAD_Wave | /src/visualize.py | UTF-8 | 591 | 2.65625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
import librosa.display
def visualize_spectrogram(sp, fs, hop_length=128, mel=False, path=None):
# display wave in spectrogram
if mel:
y_axis = 'mel'
title = 'Mel Spectrogram'
hop_length = 128
else:
y_axis = 'log'
... | true |
9e221d33435cb2e79578525afd130fef7333bfd0 | vmelan/cifar-experiment | /LeNet/Keras/data_loader.py | UTF-8 | 3,307 | 2.953125 | 3 | [] | no_license | import pickle
import numpy as np
import cv2
class DataLoader():
""" Load CIFAR dataset """
def __init__(self, config):
# Load config file
self.config = config
# Load data from data_path
self.X_train, self.y_train, self.X_test, self.y_test = self.load_cifar10(
config["data_loader"]["data_path"])
# Shuffl... | true |
8bb3494ece9c4b0e09f404b1b10db9db5a5f84cb | uxiexs/Ubuntu | /LiaoXueFeng/vo84_postgreSQL.py | UTF-8 | 1,714 | 2.859375 | 3 | [] | no_license | #!/home/uxeix/.virtualenvs/py3env/bin/python3
# coding:utf-8
#=========================================================================
# PostgreSQL是一個功能強大,開源對象關係型數據庫係統。它擁有超過15年的持續開發和業經驗證的架構,具有良好的可靠性,數據完整性和正確性。
#
# PostgreSQL能夠運行在所有主流操作係統,包括Linux,UNIX(AIX,BSD,HP-UX,SGI IRIX,Mac OS X上的Solaris,Tru64的),和Windows。
#
# Post... | true |
20bd9127e5658cb1e8457e5bc599de9ad1e24202 | dPfla0130/codingtest_Python | /codingtest/202009/세 소수의 합.py | UTF-8 | 969 | 3.734375 | 4 | [] | no_license | #에라토스테네스의 체 알고리즘 사용
def prime_list(n):
# 에라토스테네스의 체 초기화: n개 요소에 True 설정(소수로 간주)
sieve = [True] * n
# n의 최대 약수가 sqrt(n) 이하이므로 i=sqrt(n)까지 검사
m = int(n ** 0.5)
for i in range(2, m + 1):
if sieve[i] == True: # i가 소수인 경우
for j in range(i + i, n, i): # i이후 i의 배수들을 False 판정
... | true |
c16af5224edcb9cbd9ae8503a5f66056e3029ed5 | Joker2018goon/pyWorkspace | /StudyPy/test/test1.py | UTF-8 | 872 | 3.453125 | 3 | [] | no_license | # -*- coding:utf-8 -*-
import requests
# 调用百度接口
r=requests.get('https://www.baidu.com')
# r.status_code Http请求返回的状态(响应码) 200 - - 表示连接成功 ,404 - -表示失败
print(u'接口响应码:',r.status_code)
print('======================================================')
# r.text HTTP 响应内容的字符串形式,即,URL对应的页面内容
print('页面内容:',r.text)
print('======... | true |
cd7e202f5a014d1c7509838174c2ca347244bfc8 | Richardagudelo/NBA-Predictor | /views/MainW.py | UTF-8 | 11,524 | 2.8125 | 3 | [] | no_license | import tkinter
from tkinter import *
from tkinter import ttk
raiz = Tk()
raiz.title("Simulador NBA 4000 PRO 4K V1.0")
raiz.geometry("1200x1000")
raiz.config(bg="pale green")
team_list = []
def llenar_team_list(lista):
global team_list
team_list = lista
def graficarImagen(text):
miFrame = Frame()
mi... | true |
ffa2136da31d974faf5722aa20fb11284ed86312 | DanShai/metropolis_mcmc | /coin_metro.py | UTF-8 | 1,788 | 3.125 | 3 | [] | no_license | import matplotlib.pyplot as plt
import numpy as np
import scipy.stats as stats
from metropolis import Metropolis
class Coin(Metropolis):
def __init__(self, itr=500, cur=.1):
super().__init__(itr=itr, cur=cur)
self._sigma = 0.3
self._n = 100
self._a = 10
self._b = 8
... | true |
86456dc84dd041975355718c1e3ba691f11ef16e | cmccandless/ExercismSolutions-python | /wordy/wordy.py | UTF-8 | 765 | 2.859375 | 3 | [
"MIT"
] | permissive | op = {
'plus': lambda x, y: x + y,
'minus': lambda x, y: x - y,
'multiplied': lambda x, y: x * y,
'divided': lambda x, y: x / y,
}
def calculate(expr):
s = list(reversed(expr[:-1].split()[2:]))
r, o = (0, op['plus'])
while len(s) > 0:
x = s.pop()
try:
... | true |
dc55205677b5dc14ab7df26ef9b089471a7870b1 | HsinYu7330/HackerRank | /57_xml1_find_the_score.py | UTF-8 | 447 | 3.4375 | 3 | [] | no_license | # XML 1 - Find the Score
import sys
import xml.etree.ElementTree as etree
def get_attr_number(node):
# your code goes here
attr_len = []
for child in node.iter():
attr_len.append(len(child.attrib))
return sum(attr_len)
if __name__ == '__main__':
sys.stdin.readline()
xml = sy... | true |
f6a32a68e6526c4812925e14c4ee4de2ceda50fc | duilee/workspace | /Algorithms/test.py | UTF-8 | 115 | 2.9375 | 3 | [] | no_license | from collections import Counter
#print(Counter("abcdad"))
x = "str"
y = [i for i in x]
y.sort()
print(''.join(y)) | true |
7b334880287bcbdf5ad797063ca1b2ba6db41f81 | ArmanHZ/CS401-GitHub_Analyzer | /Clustering_d3/K_means/scraped_issue_to_json.py | UTF-8 | 1,646 | 2.765625 | 3 | [] | no_license | class Issue:
id = None
issue_link = None
commit_link = None
commits = None
def __str__(self):
if self.commit_link is None:
return str(self.id) + "\n" + str(self.issue_link)
else:
return str(self.id) + "\n" + str(self.issue_link) + "\n" + str(self.commit_link)... | true |
a754cf05f7be4fc2e236f66e9266e92e56439e01 | Sidhved/Coding-Blocks-ML | /Modules_Example/math/complex.py | UTF-8 | 64 | 3.046875 | 3 | [] | no_license | def square(x):
return x ** 2
def cube(x):
return x ** 3 | true |
05fb31a94abc9c08b30388b51762f1c634fc4f8e | ikaf4eg/Project1 | /module_03/01_ifelse.py | UTF-8 | 3,090 | 4.34375 | 4 | [] | no_license | # Логические операторы в Python:
# < меньше - проверяет значение слева меньше значения справа?
# > больше ли значение слева, чем справа?
# == Равны ли значения слева и справа?
# != Отличаются ли значения слева и справа?
# <= Возвращает True, если значение слева меньше либо равно значению справа. Иначе — False
# >= Воз... | true |
6e10dea7192bcfbde7492ea730fcbfb0fd20069b | davidcse/ForumServer | /ForumClient.py | UTF-8 | 33,456 | 2.75 | 3 | [] | no_license | import socket
import json
from os import path
from sys import argv
import traceback
import time
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
#--------------------#
# GLOBAL DATA #
#--------------------#
SERVER = "127.0.0.1"
PORT = 60000
CLIENT_DATA_ADDR = "./ForumClient... | true |
311c12f298e942808636e7512abe0cd0573baf5b | mkrum/ratio | /embeddings.py | UTF-8 | 1,330 | 2.703125 | 3 | [] | no_license | import sys
import string
import glob
import os
import gensim
data_path = 'data/'
def load_embedding(tasknumber, language):
return gensim.models.Word2Vec.load('embeddings/{}/qa{}'.format(language, tasknumber))
def vocab_size(tasknumber, language):
model = gensim.models.Word2Vec.load('embeddings/{}/qa{}'.forma... | true |
a5d2e53734265eb695daf8e68583e9340fe5efa3 | Jackiebarman/Semester6 | /ias/IAS_LAB/IAS_lab3/181IT211_IT352_P3b.py | UTF-8 | 837 | 2.734375 | 3 | [] | no_license | from scapy.all import *
def main():
ip_src=input("Enter the Source IP address : ")
ip_dest=input("Enter the Destination IP address : ")
port_src=int(input("Enter the Source Port number : "))
port_dest=int(input("Enter the Destination Port number : "))
type_prtcl=input("Enter the protocol (TCP or UDP) : ")
func=i... | true |
8a3053c01228f9ff003f7303fb1c52caa86f2d47 | lkingsford/thechase | /code/game_tile.py | UTF-8 | 856 | 3.75 | 4 | [
"MIT",
"CC-BY-3.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | class GameTile:
""" A tile on a GameMap """
def __init__(self,
floor_tile,
wall_tile = None,
walkable = True,
on_walk_event = None):
""" Create a new game tile
Keyword arguments:
floor_tile - Which floor asset to u... | true |
0cdd797ed46f088a007964a3edf3c0c6a98308bf | digipodium/string-and-string-functions-akhil2761222 | /solution_23.py | UTF-8 | 133 | 3.5 | 4 | [] | no_license | my_string = input('please enter your string: ')
check = my_string.find("fyi")
if check != -1:
print('string contains "fyi"')
| true |
8a70bed5f14e55654a79c514aeacc4347c6638c6 | manchicken/gist_per_day | /trees_and_graphs/simple_tree_compare.py | UTF-8 | 1,248 | 3.78125 | 4 | [
"Unlicense"
] | permissive | #!/usr/bin/env python
class TreeNode:
def __init__(self, parent, data):
self._children = []
self.parent = parent
self.data = data
def add_child(self, node):
node.parent = self
self._children.append(node)
def compare_similar(self, node):
if len(self._children) != len(node._children):... | true |
248acb87650fd6ce5af08d5716cfa7bb77f32a38 | jianhui-ben/leetcode_python | /1138. Alphabet Board Path.py | UTF-8 | 2,429 | 4.46875 | 4 | [] | no_license | #1138. Alphabet Board Path
#On an alphabet board, we start at position (0, 0), corresponding to character board[0][0].
#Here, board = ["abcde", "fghij", "klmno", "pqrst", "uvwxy", "z"], as shown in the diagram below.
#We may make the following moves:
#'U' moves our position up one row, if the position exists on th... | true |
e7c3390d011c28be77cb25cbeb6a7eb322a94b2f | NunoSantos98/com404 | /TCA3/q6.py | UTF-8 | 790 | 4.125 | 4 | [] | no_license | def is_league_united(hero1,hero2):
if((hero1=="Superman") and (hero2=="Wonder Woman")):
return True
elif ((hero1=="Wonder Woman") and (hero2=="Superman")):
return True
else:
return False
def decide_plan(hero1,hero2):
if(is_league_united(hero1,hero2)==True):
return "Time ... | true |
7174507ec481971f2d2cf3f03bb6c36b57b23ffa | gregory2000/pycharm_projects | /ML/nn/backprop.py | UTF-8 | 717 | 2.9375 | 3 | [] | no_license | import random
class Node:
def __init__(self):
self.lastOutput = None
self.lastInput = None
self.error = None
self.outgoingEdges = []
self.incomingEdges = []
class Edge:
def __init__(self, source, target):
self.weight = random.uniform(0,1)
self.source = source
sel... | true |
d26ec92bbd28e94324f88804abfbb44d8b50ad61 | witzou/git-test | /data_analysis_excel.py | UTF-8 | 640 | 2.65625 | 3 | [] | no_license | import pandas as pd
data = pd.read_excel('E:\\PythonTestCode\\public opinion.xlsx', sheetname='public opinion', usecols= ['电商平台', '品牌', '评论'])
print(data.head())
data1 = data.iloc[1:100, :]
data2 = data.iloc[101:400, :]
# data1.to_excel('E:\\PythonTestCode\\public opinion_result.xlsx', sheet_name = 'data1')
# data1.to... | true |
6474bc402a3797f83b782c08ed9ff17e2528dc2a | czinczewski/Bomberman_Game | /objects.py | UTF-8 | 14,909 | 2.953125 | 3 | [] | no_license | import numpy as np
import math
from PyQt5.QtCore import *
from PyQt5.QtGui import *
# -----------------------------------------------
class Position:
def __init__(self, x, y):
self.x = x
self.y = y
def set_x(self, x):
self.x = x
def set_y(self, y):
self.y = y
def get... | true |
08292fb7c6d777895ffcc8ab48d116680303749d | konicaRu/python_task | /Football.py | UTF-8 | 2,809 | 3.515625 | 4 | [] | no_license | import copy
def Football(F, N):
count_lev1 = -1 #счетчик второго массива
count_lev2 = 0
check_F = sorted(F)#создаем сортированную копию списка как эталон для сравнения
arr_tmp = copy.copy(F)#создаем копию списка для перестановки
for i in range(len(F) - 1): # двигаем первий диапазон
co... | true |
325fa80a46395a17756bc9849bd24a23ecf6e991 | rajputchintan22/Algorithms | /Tree/Fixing Two nodes of a BST.py | UTF-8 | 3,473 | 3.578125 | 4 | [] | no_license | # User function Template for python3
def myMapper(root, hash, ans):
if root.left:
myMapper(root.left, hash, ans)
hash[root.data] = root
ans.append(root.data)
if root.right:
myMapper(root.right, hash, ans)
def correctBST(root):
hash = {}
ans = []
ans2 = []
myMapper(root,... | true |
b2495b77bcabc86fd95ae250574d7e40cdfc56c5 | IlPakoZ/Uniroma1-Informatica | /Fondamenti di Programmazione 1° semestre/Programmi Python/Lezione6/grader.py | UTF-8 | 1,542 | 3.015625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 16 00:21:37 2019
@author: angelo
"""
from conta_parole import conta_parole
from termcolor import colored
test_list = {("a e i o u", 1) : 5,
("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut... | true |
c5d3a4f97f65fad010f54b5ebdfeffa5ebf2e187 | SusiJo/master_project | /python_scripts/parseFeatureCounts.py | UTF-8 | 4,606 | 2.9375 | 3 | [] | no_license | # This is a script to parse multiple files from featureCounts to perform batch correction
import click
import logging
import time
import sys
import pandas as pd
from pathlib import Path
import fileUtils.file_handling as fh
# Create logger
logger = logging.getLogger('FeatureCounts table creator')
# Create console hand... | true |
7fbc01cd12d0bf7941075fcfdd18f68c5f60e697 | MarianDanaila/Competitive-Programming | /Kick Start Google/Round C 2021/Smaller Strings.py | UTF-8 | 601 | 3.0625 | 3 | [] | no_license | from math import ceil
modulo = 10 ** 9 + 7
tests = int(input())
for t in range(1, tests + 1):
n, k = [int(s) for s in input().split(" ")]
s = input()
# check last palindrome +/- 1
ans = 0
for i in range(ceil(n / 2)):
power = (n - 1) // 2 - i
ans += (ord(s[i]) - 97) * (pow(k, power, m... | true |
50cd906bc593401bebd9bcdcfa11978c47cb5114 | xueyangfu/tensorflow-learning | /opencv/gui/base-drawing.py | UTF-8 | 938 | 3.140625 | 3 | [] | no_license | #-*- coding: utf-8 -*-
# OpenCV基础绘图
import cv2 as cv
import numpy as np
# 创建一张RGB图片,大小为512x512
img = np.zeros((512,512,3),np.uint8)
# 绘制直线,起点(0,0),终点(511,511),颜色BGR(255,0,0),线宽为3
cv.line(img,(0,0),(511,511),(255,0,0),3)
cv.imshow("img-line",img)
# 绘制矩形
cv.rectangle(img,(384,0),(510,128),(0,255,0),3)
cv.imshow("img... | true |
27459ffe271a55bbc7efd5fcf2ed98d37255c1b0 | baocogn/self-learning | /big_o_coding/Green_06/day_13_quiz_3.py | UTF-8 | 257 | 2.921875 | 3 | [] | no_license | n, x = map(int(input().split()))
numbers = list(map(int, input().split()))
count = 0
def index(a):
for i in range (len(numbers)):
if numbers[i] != x:
count += 1
else:
return count
return count
print() | true |
8c0bc416738fa0a0552bd6bb77e00c68b5406d6a | EugenWa/simgan | /Model/Modules/Generators1D/Generator_Basic.py | UTF-8 | 2,997 | 2.71875 | 3 | [] | no_license | # - keras -
import keras
from keras.layers import BatchNormalization, Input, Conv2DTranspose, LeakyReLU, Add, Lambda, MaxPooling1D, \
UpSampling1D, Concatenate, Dropout, Conv1D
from keras.models import Model, load_model
import numpy as np
CUDA_VISIBLE_DEVICES=0
def build_basic_encoder(encoder_input, e_filters=[3,... | true |
e4179126e4dabaf3cf7188222d434ae047f733c6 | nikerzetic/Project_Euler | /Digit fifth powers.py | UTF-8 | 575 | 4.21875 | 4 | [] | no_license | """
Surprisingly there are only three numbers that can be written as the sum of fourth powers of their digits:
1634 = 14 + 64 + 34 + 44
8208 = 84 + 24 + 04 + 84
9474 = 94 + 44 + 74 + 44
As 1 = 14 is not a sum it is not included.
The sum of these numbers is 1634 + 8208 + 9474 = 19316.
Find the sum of a... | true |
dda994c28d48f3af2ce8d9adb30ad5e19a8a812d | ergowherm/Python | /Nested if.py | UTF-8 | 382 | 3.96875 | 4 | [] | no_license | # Nested If statements
#
num = int (input ("Enter Number:")
if num%2==0:
if num%3==0:
print ("Divisible by 3 and 2")
else:
print ("divisible by 2 not divisible by 3")
else:
print ("divisible by 2 not divisible by 3")
else:
if num%3==0:
print ("divisible by 3 not divisible by 2")... | true |
047cda57ecf6e40d459c34985e8db3b5ca47fbae | Danieldev28/Riddle_twister | /run.py | UTF-8 | 703 | 2.984375 | 3 | [] | no_license | import os
from flask import Flask, render_template , request
# import random
app = Flask(__name__)
@app.route("/", methods= ["POST", "GET"])
def index():
if request.method== "POST":
print(request.form)
return render_template("index.html")
# play_game = True
array = ['hearts', 'spades', 'clubs', 'd... | true |
eb59b50591612cc354acad2340c183a587656a7f | mayartmal/python_course | /control_1_sum_in_for_loop.py | UTF-8 | 118 | 3.609375 | 4 | [] | no_license | n = int(input())
sum = 0
for i in range(0, n):
your_number = input()
sum = sum + int(your_number)
print(sum)
| true |
49275bb9464c534d78a4e989af78df5923387740 | vishwesh-D-kumar/codeforces_submissions | /670/d2/68641174.py | UTF-8 | 292 | 2.515625 | 3 | [] | no_license | def I(): return(list(map(int,input().split())))
n,k=I()
a=I()
b=I()
l=0
# l=104
r=2*(10**9)+1
# r=106
# sumi=sum(a)
# summ=sum(b)
# print(sumi,summ)
while(l<r-1):
# print(l,r)
m=(l+r)//2
s=0
for i in range(n):
s+=max(m*a[i]-b[i],0)
# print(s)
if s>k:
r=m
else:
l=m
print(l)
| true |
6d5f91e0fcc8ed4b9f486e7d1e71d60570efe50c | andypayne/mldc | /spacy.py | UTF-8 | 510 | 2.578125 | 3 | [] | no_license | import spacy
nlp = spacy.load('en')
nlp.entity
# => spacy.pipeline.EntityRecognizer
doc = nlp("""Berlin is the capital of Germany; and the residence of Chancellor Angela Merkel.""")
doc.ents
# => (Berlin, Germany, Angela Merkel)
print(doc.ents[0], doc.ents[0].label_)
# => Berlin GPE
##############################... | true |
b5f23be18fca510504102b454e1d92007f3ff7eb | GyanuAB/DA10_Corona_Analysis | /Corona_data_analysis_Jan_to_Aug_2020.py | UTF-8 | 5,554 | 3.34375 | 3 | [] | no_license | #!/usr/bin/env python
# coding: utf-8
# In[267]:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
get_ipython().run_line_magic('matplotlib', 'inline')
import seaborn as sns
# In[268]:
corona_data = pd.read_csv("Corona_data_Jan_to_Aug_2020.csv")
# In[269]:
corona_data.T
# In[301]:
c... | true |
072184c56cf86425933805553879d89d6b05fb31 | FelipeLessa294/Trabalho3_FuP | /trabalho3.py | UTF-8 | 2,985 | 3.8125 | 4 | [] | no_license | #Você precisa implementar as seguintes funções:
def carrega_arquivo(nome_arquivo: str):
na=nome_arquivo.splitlines()
na[0]
#Primeira linha do arquivo de treino: Nome e Sobrenome
#Segunda linha: Data do treino formato será [dia] - [mês] - [ano]
#linha opcional de peso, formato Peso: [peso]
... | true |
4e8524b7db87c24c443c1a9018bdb20f8ed54b3f | thecrossed/CS224NFinalProject | /keras_ML_lstm.py | UTF-8 | 1,159 | 2.609375 | 3 | [] | no_license | from keras.models import Sequential
from keras.layers import *
import numpy as np
from svm import getLSTMMultiData
print "Getting Data..."
X_train, y_train, X_dev, y_dev, X_test, y_test, maxLength, embeddingLength = getLSTMMultiData()
print "Building Model..."
data_dim = embeddingLength
timesteps = maxLength
num_c... | true |
58833fea3d8bd9fc650c853396549dcc6b68f933 | ahmadreza-smdi/ms-shop | /.venv/lib/python3.7/site-packages/pylint/test/functional/yield_inside_async_function.py | UTF-8 | 359 | 2.78125 | 3 | [
"MIT"
] | permissive | """Test that `yield` or `yield from` can't be used inside an async function."""
# pylint: disable=missing-docstring, unused-variable
async def good_coro():
def _inner():
yield 42
yield from [1, 2, 3]
async def bad_coro():
yield 42 # [yield-inside-async-function]
yield from [1, ... | true |
ac995369ec6a302b39467dddbd4cc865438cb6d7 | Boundouq/CNN_Project | /Program/Python/convolution.py | UTF-8 | 4,609 | 2.578125 | 3 | [] | no_license | #####################################################################################
### CONVOLUTION ###
#####################################################################################
# The number of the picture that we will normalize
#IMAGE_NUM... | true |
993aa5d6ce52c97436d340ba8b76e2c2c05f37b8 | ysachinj99/PythonFile | /Registeration Form.py | UTF-8 | 1,289 | 2.8125 | 3 | [] | no_license | from tkinter import *
root = Tk()
root.geometry('500x500')
root.title("Registration Form")
label_0 = Label(root, text="Registration form",width=20,font=("bold", 20))
label_0.place(x=90,y=53)
label_1 = Label(root, text="First Name",width=20,font=("bold", 10))
label_1.place(x=80,y=130)
entry_1 = Entry(r... | true |
d308d27ec5be0ba564f69c5739751c2ba44608b5 | elonoraartango/Practicals | /prac_02/numbers_B.py | UTF-8 | 395 | 3.953125 | 4 | [] | no_license | ###THE BELOW PROGRAM WILL ALLOW ANY AMOUNT OF NUMBERS TO BE ENTERED AND THE SUM OF ALL NUMBERS ARE PRINTED###
infile = open('numbersaa.txt', 'r') #name of file that numbers have been read from
total = 0
for digit in infile:
number = int(digit)
total += number #adding totals and sum of numbers
print(total) #... | true |
edf9a044a68eb67619da8d04d9cc5df2de6ee28b | iamrajee/AI_lab | /ailab_k/week1/bunny_in_1D_sea.py | UTF-8 | 4,732 | 4.0625 | 4 | [] | no_license | #!/usr/bin/env python3
# Kaushal Kishore (bithack)
# 111601008
# Question No. 2a
# Bunny in the Ocean.
# Bunny is the Agent.
# How did Bunny reached to the middle of the Ocean? Only he knows.
# We won't let bunny die.
# Let's save the bunny.
# The logic is straightforward.
# Initial Step: Bunny moves 1 unit distance... | true |
b3f8345e4853c487fb969098b3cbc12b0db9e9aa | Gary2018X/data_processing_primer | /E8-22.py | UTF-8 | 563 | 3.265625 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# author:Gary
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
# ********典型图制作:3D图:3D散点图******#
np.random.seed(0)
X = np.random.randn(1000)
Y = np.random.randn(1000)
Z = np.random.randn(1000)
# 生成Figure对象
fig = plt.figure(figsize=(6, 6))
# 生成子图ax
ax = ... | true |
40ca6b89d54486e6f01608ba7c5129e56ee0d405 | mapproxy/mapproxy-homepage | /homepage/blog.py | UTF-8 | 2,069 | 2.78125 | 3 | [] | no_license | import glob
import os
import re
import io
import markdown
from pytz import timezone
localtz = timezone('Europe/Berlin')
from datetime import datetime
import logging
log = logging.getLogger(__name__)
def make_slug(title):
return re.sub('[^a-z.0-9]', '-', title.lower())
def parse_blog_entries(blog_dir):
blog... | true |
c885c1faef130004487fcfa6d741efd1bf45c1e7 | BotOreo/Python-Files | /3D_K_Means.py | UTF-8 | 3,125 | 2.53125 | 3 | [] | no_license | import pandas as pd
from sklearn.cluster import KMeans
import re
import os
from sklearn.preprocessing import Imputer
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from sklearn.decomposition import PCA
os.chdir('C:/Users/muham/Documents/CSC 3303_Big Data Analytics/Project/K-Means-clus... | true |
2daafd2bfcd98fe0ae0cad00a937fd1a0eaad32c | jrhelbert/CovidDataAutomation | /regenCSVorGeoJson.py | UTF-8 | 2,087 | 2.8125 | 3 | [] | no_license | # 07-01 - 08-05
#
import os
import csv
import json
import stripData
import glob
import re
months = [7, 8]
days = [1,5]
csvHeaders = ["EventResidentCounty","Individuals Tested","Individuals Positive","Total Recovered","Total Deaths"]
jsonHeaders = ["Name","Tested","Confirmed","Recovered","Deaths"]
def... | true |
595272eb222281a19d07c342f3d23a4eb1c8dea3 | wwyys/echarts | /echarts/python/朴素贝叶斯。词向量/上课资料.py | UTF-8 | 2,003 | 3.203125 | 3 | [] | no_license | def loadDataSet():
postingList=[['我','狗','有','flea','问题','帮助','请'],
['maybe','not','take','him','to','dog','park','stupid'],
['my','dalmation','is','so','cute','I','love','him'],
['stop','posting','stupid','worthless','garbage'],
['mr','licks','ate... | true |
da45fb508c842588ad5008c9ef08359e18c4cb6f | Kawser-nerd/CLCDSA | /Source Codes/AtCoder/abc084/B/4980944.py | UTF-8 | 246 | 3.125 | 3 | [] | no_license | n,m=map(int,input().split())
s=input()
flag=True
if s[n:n+1]!='-':
flag=False
for i in range(n):
if s[i]=='-':
flag=False
for i in range(n+1,len(s)):
if s[i]=='-':
flag=False
if flag:
print('Yes')
else:
print('No') | true |
4764b8a66f7026c930323ef7c855c9b5fe4c8328 | ryanvarley/code-cov-demo | /dataframe.py | UTF-8 | 1,008 | 3.546875 | 4 | [] | no_license | import csv
class DataList(object):
def __init__(self, data):
# Just a list of data for now
self.data = data
def head(self, n=5):
return self.data[:n]
def tail(self, n=5):
return self.data[-n:]
def merge(self, df, how='outer'):
strategies = {
'inn... | true |
674c464b3c932cfaa08cb95bc8af060d393fa576 | ik2y/recode-beginner-python | /materials/week-3/src/takeHomeChallenge.py | UTF-8 | 520 | 4.1875 | 4 | [] | no_license | # calculate the volume of rectangular block and output to screen
# width is 10
# height is 5
# length is 25
# calculate area of circle
# radius is 5
pi = 3.14159
radius = 17
radiusSquared = radius * radius
areaOfCircle = pi * radiusSquared
print("The area of a circle with radius 17 is " + str(areaOfCircle))
# calcula... | true |
5e40e9af19e7016b49c3fa6cd555ccd44bbb5ba4 | lancopku/SACT | /models/rnn.py | UTF-8 | 4,901 | 2.515625 | 3 | [] | no_license | import torch
import torch.nn as nn
from torch.nn.utils.rnn import pack_padded_sequence as pack
from torch.nn.utils.rnn import pad_packed_sequence as unpack
import models
import math
import numpy as np
class rnn_encoder(nn.Module):
def __init__(self, config, embedding=None):
super(rnn_encoder, self).__ini... | true |
27a492c127bc063a448fdad012b2d0971420a25a | chintak/scikit-image | /doc/examples/plot_regional_maxima.py | UTF-8 | 3,316 | 3.59375 | 4 | [
"BSD-3-Clause"
] | permissive | """
=========================
Filtering regional maxima
=========================
Here, we use morphological reconstruction to create a background image, which
we can subtract from the original image to isolate bright features (regional
maxima).
First we try reconstruction by dilation starting at the edges of the ima... | true |
f061870089c9ee033a268b6bf87e7cc47b09a809 | yuueuni/algorithm | /swea/SWEA_D2/5097/5097.py | UTF-8 | 296 | 2.984375 | 3 | [] | no_license | import sys
sys.stdin = open('input.txt')
T = int(input())
for tc in range(1, T+1):
n, m = map(int, input().split())
data = list(map(int, input().split()))
cnt = m % n
while cnt:
temp = data.pop(0)
data.append(temp)
cnt -= 1
print(f'#{tc} {data[0]}') | true |
9743e1c515d660889213d126b9a8d140a342f7ac | kashua14/my_portfolio | /Others/SoC_weekly/soc-wk2-cert-Jessica-Sanchez/ex2.py | UTF-8 | 2,674 | 2.921875 | 3 | [] | no_license | #C:\Users\Public\Online_Courses\SOC\WK2\wk2_HW
#ex2.py
# W2.D2.12 Continent Counter Test
# Write test coverage in unittest and/or trace for Continent Counter.
def create_w():
world= [
['o','X','o','o','o','o','o','o','o','o','o'],
['o','X','X','X','X','X','o','o','o','o','o'],
['o','X','X','X','X','X','o',... | true |
a0c969c4848f7f597d0c5f6508df63fcb758276f | Shriya2409/project103 | /charts/project 103.py | UTF-8 | 153 | 2.75 | 3 | [] | no_license | import pandas as pd
import plotly_express as px
df=pd.read_csv("covid_data.csv")
fig=px.line(df, x='date', y='cases', color='country')
fig.show()
| true |
1f0d52cef612f7002cf95855de1ec995a44727fb | owlvey/archon | /engine/core/SquadEntity.py | UTF-8 | 949 | 3.078125 | 3 | [
"Apache-2.0"
] | permissive | from typing import List
import pandas as pd
class SquadEntity:
def __init__(self) -> None:
self.squad = None
self.description = None
self.members = list()
self.features = list()
def load_members(self, items):
temp = self.members
self.members = list()
... | true |
e03de54335f30bee47a17f313e5b8b52a8165180 | toliko-coding/My-Python-codes | /תרגול/Lab12-20210904/Exception_exersices_solution.py | UTF-8 | 830 | 3.65625 | 4 | [] | no_license |
from operator import getitem
def make_rat(n, d):
return (n, d)
def numer(x):
return getitem(x, 0)
def denom(x):
return getitem(x, 1)
def make(x):
try:
result = numer(x)/denom(x)
except ZeroDivisionError:
return "Attempted to divide by zero"
... | true |
845b859228ea5a67eb4afff49b20af6a06ed634a | Atishay990/cp-contests | /bitSetGo-v2.0/A-Snakes-in-Sabar-Again/tc_gen.py | UTF-8 | 3,778 | 2.859375 | 3 | [] | no_license | '''
Aashutosh Rathi
https://github.com/aashutoshrathi/
Testcase Generator for HackerRank
'''
from __future__ import print_function
import os
import random
import shutil
import sys
import timeit
import zipfile
import math
from lang_compiler import LANGS
if sys.version[0] == '3':
INPUT = input
XRange... | true |
c95ba3d3f3dcb6921b9a2fcc257ab4cd3607214d | available-for-recruit/python-devtest | /part2/reverse_flask_herd/project/reverse_flask.py | UTF-8 | 413 | 2.625 | 3 | [] | no_license | from flask import Flask, render_template, request
app = Flask(__name__)
app.config['DEBUG'] = False
@app.route('/')
def get_string():
return render_template('index.html')
@app.route('/reverse_string', methods=['POST'])
def reverse_string():
return render_template(
'result.html',
original_s... | true |
e016434916474e29eceeb8add954a52099197d5e | PhantomPickle/PHYS476 | /Github/476_Lab3_AlexPickAlaus.py | UTF-8 | 3,524 | 2.875 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Apr 18 23:01:09 2020
@author: alex
"""
import torch
import numpy as np
import torch.nn.functional as func
#torch.cuda.set_device(0)
torch.cuda.set_device(0)
train_data = np.genfromtxt('mnist_train.csv', delimiter=',')
test_data = np.genfromtxt('mnist... | true |
b6268e2c6d99cd85a1f7088df126f87272ba0bdf | HDking/NYCsubwayDataset | /introDS/gradientDescent2.py | UTF-8 | 1,309 | 3.1875 | 3 | [] | no_license | import numpy as np
import pandas
from sklearn.linear_model import SGDRegressor
def normalize_featues(features):
means = np.mean(features, axis=0)
std_dev = np.std(features, axis=0)
normalized_features = (features-means)/std_devs
return means, std_devs, normalized_features
def recover_params(means, std_devs, nor... | true |
799d9dcb70b64d4c5af1904caa9232952de85d7c | MrHamdulay/csc3-capstone | /examples/data/Assignment_9/mphmam013/question2.py | UTF-8 | 2,272 | 3.515625 | 4 | [] | no_license | """Mphuthi Mamorena
question2
assignment 9"""
filename=input("Enter the input filename:\n")
outfilename=input("Enter the output filename:\n")
width=eval(input("Enter the line width:\n"))
def linesprint(filename, width, outfilename):
v = ""
u = 0
v_formatted = ""
spaces = 0
f ... | true |
d564653bb47483f0d2481d630c19605becdb2737 | Nusmailov/BFDjango | /Week1/Informatics/3/While/E.py | UTF-8 | 133 | 2.96875 | 3 | [] | no_license | import functools
import math
cnt = 0
sum = 0
n = int(input())
t = 1
while t < n:
t *= 2
cnt += 1
print(cnt)
#c = str(a)[::-1] | true |
e9e9f610c1fb670b49dab5eaf52ab388485196ec | lopez96lau/docx2cu | /source/frecuencias.py | UTF-8 | 2,172 | 3.984375 | 4 | [] | no_license | # Dada una lista de palabras, devuelve un diccionario de pares de palabra-frecuencia
def listaFrecs(listaPalabras):
frecuenciaPalab = [listaPalabras.count(p) for p in listaPalabras]
return dict(list(zip(listaPalabras,frecuenciaPalab)))
# Ordena un diccionario de pares palabra-frecuencia en orden de frecuencia ... | true |
cf9f53adf795ce5b18293df8e016073a44b9ce7e | chockleyc/proglan | /eval.py | UTF-8 | 6,433 | 2.703125 | 3 | [] | no_license | import env
import lex
class evaluator:
def __init__(self):
return
def Eval(self, tree, envi):
if tree.datatype == "STATEMENTLIST":
return self.evalStatementList(tree, envi)
elif tree.datatype == "STATEMENT":
return self.evalStatement(tree, envi)
elif tre... | true |
b0ab1c76a7e72301fa371e154ed21b024de9d8ca | pcward/code_examples | /monthly_forecast_etl_v2.2.py | UTF-8 | 3,630 | 2.515625 | 3 | [] | no_license | ## Created by: Chris Ward
## chris.ward@clearlink.com
##
## Last edit: 2013-03-14
##
## Version: 2.2
## Imports forecast data to the Forecasts SQL table from a CSV file
## CSV file format:
## columns: yr, wk, brand, channel, forecast (must be WEEKLY values)
## To invoke the script, open a command line and iss... | true |
05ff118fb272a4155c26dcf261e2833c564e15a4 | abbeyliam/basicpythoninmaya | /basicpythonmayatolearn.py | WINDOWS-1252 | 26,820 | 3.765625 | 4 | [] | no_license | Note:
Show results = Drag all code and highlight the line you want to run, Press Ctrl + Enter
Zoom screen = Ctrl + e
Str = alphabet (string)
Int = number (dont have decimal)
Flot = number (have decimal)
myX = 10 # myX equal to 10
myY = 20 :#myY equal to 20
myXY = myX * myY
print (The result is + s... | true |
09ff2368b5e2cdae412eef299a8bc370fd329575 | Kagiso-Future-Media/kagiso_image | /kagiso_image/exceptions.py | UTF-8 | 416 | 3.078125 | 3 | [] | no_license | from .constants import MIN_IMAGE_HEIGHT, MIN_IMAGE_WIDTH
class ImageTooSmall(Exception):
def __init__(self, image):
self.image = image
self.message = ('{0} is too small ({1} x {2}).'
'It should be a minimum of {3} x {4}').format(
image.file, ima... | true |
d9c7d2c356ea1f6ed80261f7518cb830699f5723 | mrdhiraj/trybokeh | /interactive_Selection.py | UTF-8 | 398 | 2.90625 | 3 | [] | no_license | # Create a figure with the "box_select" tool: p
p = figure(x_axis_label='Year', y_axis_label='Time',tools=['box_select'])
# Add circle glyphs to the figure p with the selected and non-selected properties
p.circle(x='Year',y='Time', selection_color='red',nonselection_alpha=0.1 ,source =source)
# Specify the name of th... | true |
fb0afb8c1498c9a24d42638fce22785a30266fb7 | dhyanpatel1405/c97 | /main.py | UTF-8 | 276 | 3.78125 | 4 | [] | no_license | import random
print('Number_guessing_game')
number=random.randint(1,9)
chances=0
print('Guess_a_number')
while chances<5:
guess=int(input('Enter_your_guess'))
if guess==number:
print('U won WOO')
break
else:
print('U lose LOL')
| true |
e1f1dd1d3d74669abe6a8ca53cf3a0b1ccd093c7 | mpigelati/B_Python_work | /class/Z-List-Dupli-proj/1-list-duplicates.py | UTF-8 | 942 | 3.0625 | 3 | [] | no_license | '''
student = ["bhagavan", "Bhagavan Prasad", "1000", "1001", "99020 96750", " ", "Bommanahalli", " ", "enabled", ""]
for details in student:
print details
'''
temp_list = []
students = [
["bhagavan", "Bhagavan Prasad", "1000", "1001", "99020 96750", "", "Bommanahalli", "", "enabled"],
["sai", "Sa... | true |
9b43d547dbf5aa54ce09e887fe14be219112c89a | oasys-kit/SR-xraylib | /srxraylib/metrology/profiles_simulation.py | UTF-8 | 30,258 | 2.90625 | 3 | [] | no_license | """
This is a collection of functions to simulate profiles that can be used for describing surface errors in optical surfaces
Note that all the functions are dimensionless: therefore use always the same unit in horizontal, vertical, and RMS inputs. Angles are in rad.
Functions:
* combine_two_transversal_profiles(... | true |
d39a9f8f51ea8cc7afc7fb435d63a56d421e70b9 | wardaddy/project-euler | /pe_prob2.py | UTF-8 | 215 | 3.421875 | 3 | [] | no_license | #sum is a reserved keyword
result = 2
a1 = 1
a2 = 2
a3 = 0
while (True):
a3 = a1 + a2
if(a3 > 4000000):
break
if(a3%2 == 0):
result = result + a3
a1 = a2
a2 = a3
print(result) | true |
1174eda0fd515355f4aba6b7b926c7cdd5e94722 | omerb01/Google-HashCode2019-Hackathon | /parser.py | UTF-8 | 518 | 3.015625 | 3 | [] | no_license | path = 'a_example.txt'
def parse_txt(path, func):
pictures = []
lines = [line.rstrip('\n') for line in open(path)]
num_of_pictures = lines[0].split(' ')
for line in lines[1:]:
pictures.append(func(line))
return num_of_pictures, pictures
def line_manipulation(line: str):
line_split = ... | true |
d7db7889a17de9ed15131ea9eae2a821998183b9 | sunitha-rs/Fire-Sensor-Project | /Image_Write/Image_Write.py | UTF-8 | 325 | 2.640625 | 3 | [] | no_license | import cv2
image = cv2.imread("Waterfalls.jfif")
window_name = "Image_Write"
font = cv2.FONT_HERSHEY_SIMPLEX
text = "Joga Falls"
org = (50,50)
fontScale = 1
color = (255,0,0)
thickness = 2
image = cv2.putText(image, text, org, font, fontScale,color, thickness, cv2.LINE_AA)
cv2.imwrite("output.jpg", image)
cv2.wa... | true |
e55640b70ac818b3c3a4866f7dd12e33d2ebd06c | Willb22/testpo | /scrapingwikipedia.py | UTF-8 | 1,074 | 2.9375 | 3 | [] | no_license | from bs4 import BeautifulSoup
import requests
response = requests.get('https://en.wikipedia.org/wiki/List_of_best-selling_fiction_authors')
if response.ok:
soup = BeautifulSoup(response.text, "html.parser")
table = soup.find("table", {"class" : "wikitable"})
tbody = table.find("tbody")
trs = tbody.find... | true |
362cf49669e2d536312a68dd262f0f64177b0efe | 1702609/Hangman | /GameEngine.py | UTF-8 | 1,762 | 3.703125 | 4 | [] | no_license | import random
class GameEngine:
word = ""
wordArray = []
dashArray = []
failNo = 0
gameWin = False
words = 'short cold hot tall car'.split()
def __init__(self):
self.word = self.pickaWord()
for ind in self.word: # converts words to string list
self.wordArray.ap... | true |
b08b43e2ba1f8df7241c12054ccacd5c461469db | CrashNosok/del | /26.05.py | UTF-8 | 5,163 | 3.25 | 3 | [] | no_license | from tkinter import *
def foo(event):
Toplevel(root)
root = Tk()
# Рамка (Frame)
fra1 = Frame(root, width=500, height=100, bg='darkred', bd=2)
# bd - boderwidth - ширина рамки
fra2 = Frame(root, width=300, height=200, bg='green', bd=20)
fra3 = Frame(root, width=500, height=150, bg='darkblue', bd=5... | true |
69d67195daf33fcd62a7f5220ebf32ca020311b2 | luuuyi/logistic_regression | /LR.py | UTF-8 | 4,349 | 2.890625 | 3 | [] | no_license | from numpy import *
import sys
def loadDatasFromFile(file):
fd = open(file)
lines = fd.readlines()
datas = []
labels = []
for line in lines:
tmp_list = line.strip().split('\t')
datas.append([1.0,float(tmp_list[0]),float(tmp_list[1])])
labels.append(float(tmp_list[-1]))
r... | true |
a1159912333c3fa8270b7c35f375f2b2e21f6a44 | constantintcacenco/Comparison_graph | /test_graph.py | UTF-8 | 2,529 | 3.0625 | 3 | [] | no_license | #!/usr/bin/env python3
import matplotlib.pyplot as plt
import networkx as nx
import random
import time
WEIGHT = 0.7
G = nx.Graph()
G.add_node('a',pos=(2,5))
G.add_node('b',pos=(4,5))
G.add_node('c',pos=(3,3))
G.add_node('d',pos=(1,3))
G.add_node('e',pos=(4,2))
G.add_node('f',pos=(2,1))
G.add_node('... | true |
67296a3d14b6b8ae663d14d19488b1221d4ec7e4 | Am1t17/encrypt_audio | /my_function.py | UTF-8 | 2,243 | 2.703125 | 3 | [] | no_license | from scipy.io.wavfile import read as wavread
import numpy as np
import sys
my_secret = [1,5,2,6,12,3,7,1,2,8]
def to_bit(data):
"""
:param data: audio
:return: list of 2 last bits for audio
"""
l = []
for i in range(len(data)):
l.append(data[i] & 3)
return l
def reset_bit(data,... | true |
3366235b1c92676e7cdcf9e01468657b81a64fca | pytoolsip/common | /ui/label/TitleSketchText.py | UTF-8 | 5,774 | 2.578125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
# @Author: JimDreamHeart
# @Date: 2018-09-08 17:02:19
# @Last Modified by: JimDreamHeart
# @Last Modified time: 2019-01-12 16:50:34
import wx;
class TitleSketchText(wx.Panel):
def __init__(self, parent, id = -1, params = {}):
self.initParams(params);
super(TitleSketchText, self).__ini... | true |
05539128ef3b02815bb8ff84f838243ae5ed0995 | Nashid-Noor/May-Leet-Code-Challenge | /Week-1/Day_6_Majority_Element.py | UTF-8 | 265 | 2.875 | 3 | [] | no_license | class Solution:
def majorityElement(self, nums: List[int]) -> int:
s=set(nums)
m=0
for i in s:
if nums.count(i)>m:
m=nums.count(i)
highest=i
return highest
| true |
6eb75c5f9bb839bf91e9cb2eee11446d20f82f04 | everthefullstack/WGPark-v2 | /controller/carro.py | UTF-8 | 2,312 | 2.875 | 3 | [] | no_license | from flask_restful import Resource, reqparse, ResponseBase
from model.carro import CarroModel
argumentos = reqparse.RequestParser()
argumentos.add_argument('placa', type=str, required=True, help="Campo 'placa' não pode ser nulo.")
argumentos.add_argument('modelo', type=str, required=True, help="Campo 'modelo' não pode... | true |
059f3ea3980a96b5ac6b7a2f0240145fd6a6fa6a | pageotyann/Code | /SCRIPT/python/VectorTools/AddFieldID.py | UTF-8 | 1,551 | 2.578125 | 3 | [] | no_license | #!/usr/bin/python
from osgeo import ogr
import sys, os
import argparse
def addFieldID(filein):
source = ogr.Open(filein, 1)
layer = source.GetLayer()
layer_defn = layer.GetLayerDefn()
field_names = [layer_defn.GetFieldDefn(i).GetName() for i in range(layer_defn.GetFieldCount())]
if 'ID' in field_names or 'id' i... | true |
6b5e1edb6586d252087bc07ee5375c6b37cc349a | Kamilgeek/galgorithms | /lesson 3/task_6.py | UTF-8 | 828 | 3.5 | 4 | [] | no_license | import random
SIZE = 10
MIN_ITEM = 1
MAX_ITEM = 10
array = [random.randint(MIN_ITEM, MAX_ITEM) for _ in range(SIZE)]
print(array)
min_ = float("inf")
max_ = 0
indmin = 0
indmax = 0
ind = 0
ind2 = -1
for i in array:
ind += 1
if i > max_:
indmax = ind - 1
max_ = i
if i < min_:
indmin... | true |