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
81d7a09b02eed033d77acc7eaff12b67f144a495
sau22rane/TY-Grp_43
/sem1/DAOA/CP/Comparision.py
UTF-8
1,879
3.0625
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt import matplotlib.patches as mpatches plt.rcParams["figure.figsize"] = (10,6) fox_data = [] cannon_data = [] simple_matrix_data = [] order = [] i = 4 with open('fox_data.txt','r') as file: for line in file: j = 0 sum = 0 for word in line.spl...
true
13ab77a55e537181dddd9228ff4a208cea97d80b
urbanairship/padlocker-client
/padlocker_client/pid.py
UTF-8
1,814
2.71875
3
[]
no_license
# # Copyright 2013 Urban Airship # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed t...
true
36f817dcbb0505cd147c3eee6e9319323bcc6548
pbs-lzy/Travelling-Route-Generation-System
/TravelPlace/Crawler/CrawlerCity.py
UTF-8
1,400
2.6875
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- import requests import csv from requests import RequestException from pyquery import PyQuery as pq headers = { 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:67.0) Gecko/20100101 Firefox/67.0'} def get_pages_from(): # 共185页 urls = ['https://you.ctrip.com/countrysi...
true
570c5807fedfd52c8a5bba5c2a41d035210a5512
kartikjagdale/PartTimePythonScripts
/Python PGM/patter.py
UTF-8
486
3.6875
4
[]
no_license
#Searching for Patterns | Set 1 (Naive Pattern Searching) def search(pat, txt): print "In search fun" M = len(pat) N = len(txt) for i in range(0,N-M): #print "value of I is ",i j = 0 while(j<M): if(txt[i+j]!=pat[j]): break; j+=1 ...
true
674e0fc8bd7fe3a65471801456be84de1b698ed3
Johnzjy/wakuang
/tmp/format.py
UTF-8
944
3.71875
4
[ "MIT" ]
permissive
def format_sizeof(number, suffix='', divisor=1000): """ Formats a number (greater than unity) with SI Order of Magnitude prefixes. Parameters ---------- num : float Number ( >= 1) to format. suffix : str, optional Post-postfix [default: ''] divisor : float, optionl ...
true
0283361f0d16cd4212ab1f2f53baf42c318c6ce0
zuc0n/phamthanhcong-fundamental-c4e23
/Session3/Homework/bai1.py
UTF-8
298
2.96875
3
[]
no_license
print('Hi there, this is superuser gateway') name = 'c4e' matkhau = 'codethechange' user = input('Username: ') mk = input('Password: ') if user != name: print("You'r not superuser") else: if mk != matkhau: print('Password is incorrect') else: print('Welcome, c4e')
true
8c878b2b6dfc622d33f32e4c89a8a7af48c85abc
spdkh/quera
/pupak.py
UTF-8
322
3.203125
3
[]
no_license
import math a, b , x = map(int, input().split()) def m(a): l = [1] for i in range(2, a + 1): if a % i == 0: l.append(i) return l c = 0 if a + b <= x: c = len(m(a)) * len(m(b)) else: for i in m(a): for j in m(b): if i + j <= x: c += 1 print(c...
true
68bf2dfbffa558b44655283992c9511518836c1f
roshansantolia/python-fun-projects
/blackjack.py
UTF-8
2,287
3.953125
4
[]
no_license
print(""" +----------------------------+ | Blackjack Project | +----------------------------+ """) import random cards = [11,2,3,4,5,6,7,8,9,10,10,10,10,10] def blackjack_game(): user_hand = [] comp_hand = [] game_over = False def deal_card(): card = random.choice(cards) re...
true
f3ffdc8bc0f2c1e8d60582251a346ff2826a363e
dannasman/gameoflife
/main.py
UTF-8
2,451
3.234375
3
[]
no_license
from GameOfLife import Grid import pygame window_height = 680 window_width = 1280 window = pygame.display.set_mode((window_width, window_height)) def main(): pygame.init() clock = pygame.time.Clock() time = pygame.USEREVENT + 1 pygame.time.set_timer(time, 100) grid = Grid(window_width//10, win...
true
f2412943d65f50643e0c831de80ed888048d2395
Ziadabdelsalam/Police-Assistant
/RUN.py
UTF-8
2,874
2.59375
3
[]
no_license
# from Accident_Detection import * # from Fire_Detection import * import cv2 from Car_Plate_Detection import * from Get_Plate_Characters import * from Recognize_Faces import * from Mask_Detection import * from Accident_Detection import * from Fire_Detection import * from Check_Stolen_Plates import * Detect_...
true
33506c6dfbbed81892f9935e6c0de9b51d8f0194
JorianChu/csp
/CSP202006-1.py
UTF-8
1,245
3.15625
3
[]
no_license
#encoding = utf-8 """ @version:0.1 @author: jorian @time: 2020/8/1 8:52 """ n,m = map(int,input().split()) points = [] for i in range(n): x,y,class_point = input().split() x,y = int(x),int(y) point = [x,y,class_point] points.append(point) for j in range(m): theta_0,theta_1,theta_2 = map(int,inpu...
true
392cc8009a0c72ed56944fb52a3b4b667e11358c
qiaoy9377/python-base
/第二天作业/2.求100以内能被3整除的数.py
UTF-8
416
4.03125
4
[]
no_license
#while循环 #循环变量-数据 num = 0 list1 = [] #循环判断-判断数据是否在100以内 while num <= 100: #循环体 if num % 3 == 0: list1.append(num) #循环变量发生变化 num += 1 print(list1) #for循环 list2 = [] for num in range(101): if num % 3 == 0: list2.append(num) print(list2) #推导式 list3 = [num for num in range(101) if num ...
true
36a216d2c65150a0876865b549289cd3cca1f7ec
anjanathulithadikoppula/hotel-bill-calculator-using-python
/hotel bill calculator.py
UTF-8
738
4.0625
4
[]
no_license
print("welcome to my first code, here you can calculate bill of your food with tip addon!! happy food!!") currency = input("\nenter the currency you are using:-") bill_amount = input("\nenter the bill amount:-") bill=float(bill_amount) people = input("\nenter how many people are going to share the bill to pay:-")...
true
4c8e51974d8b5e8c76af396cdfc46f0f6f2618b8
meghanagottapu/Leetcode-Solutions
/leetcode_py/Maximum Gap.py
UTF-8
2,390
3.0625
3
[]
no_license
import sys class Solution: # @param {integer[]} nums # @return {integer} def maximumGap(self, nums): if len(nums) < 2: return 0 bucketmin = [sys.maxint] * (len(nums) - 1) bucketmax = [-sys.maxint] * (len(nums) - 1) start = min(nums) dis = (max(nums) - st...
true
5751545be29e3c1f6f6c00002a6356ae0cf00ca8
whgaara/ccf-pytorch-bert-ner
/roberta/layers/RobertaEmbeddings.py
UTF-8
2,717
2.703125
3
[]
no_license
# import torch # import torch.nn as nn # # from pretrain_config import * # # # class RobertaEmbeddings(nn.Module): # def __init__(self, vocab_size, max_len, hidden_size, dropout_prob=0.1): # super(RobertaEmbeddings, self).__init__() # self.max_len = max_len # self.token_embeddings = nn.Embed...
true
b12436c69cf9f5d57674a2543301d1160fd8dc46
jeroenpeeters/document-as-code
/python/domain/audit/model/audit_report.py
UTF-8
4,006
3.046875
3
[ "Apache-2.0" ]
permissive
""" audit report - reports results of an audit """ from domain import base from . import audit_evidence from . import audit_programme class AuditFinding(base.Base): """ An audit finding """ title = None description = None risk = None recommendation = None audit_items = None evide...
true
ba717b3c4c398f28cee02803838301117614d649
nicster/bikesharingML
/predictor.py
UTF-8
1,972
3.1875
3
[]
no_license
import sys import randomForest as rfc import svm class Predictor(object): def __init__(self): self.concept = sys.argv[1] if len(sys.argv) > 2: self.p_flag = sys.argv[2] def svm(self): svr = svm.SVM("train.csv") clf = svr.train_with_features([0, 1]) print ...
true
ad3a9d7118b386251237e77e483b3c53b20de0c9
icarus523/hash_my_directory
/hash_my_directory.py
UTF-8
5,902
2.6875
3
[ "MIT" ]
permissive
import getpass import logging import os import time import hashlib import hmac from tkinter import * from tkinter import filedialog from datetime import datetime ## Change this only ## HASHING_ALGORITHMS = ['sha256'] # choose/add (as a list) from below ACCEPTABLE_ALGORITHMS = ['sha3_512', 'sha512', 'sha3...
true
2229e1d7ce74f7ec8e8ae707f0a8652b510e7085
us-upal/modern-python3-bootcamp
/Build-in function/zip.py
UTF-8
425
3.234375
3
[]
no_license
# num=zip([1,2,3],['one','two','three']) # print(dict(num)) # #{1: 'one', 2: 'two', 3: 'three'} # print(list(num)) # # [(1, 'one'), (2, 'two'), (3, 'three')] num2=[(1, 'one'), (2, 'two'), (3, 'three')] print(list(zip(*num2))) #[(1, 2, 3), ('one', 'two', 'three')] mid=[90,80,70] final=[91,81,71] stude...
true
4950644af79aabafa4f8ebe991fdf2a086f0247b
seekever/VideoSummary
/video_summary/controller/windows_controller.py
UTF-8
5,261
2.6875
3
[ "MIT" ]
permissive
"""The window controller for the app.""" import logging import sys from PyQt5.QtWidgets import QApplication from video_summary.context.general_context import GeneralContext, ResumeMode from video_summary.models.general_options_model import GeneralOptions from video_summary.models.main_window_model import MainWindow ...
true
0bd6555fcae84aac727026da133e83bb9579b7c6
msk20msk20/Python
/20191002_31.py
UTF-8
78
3.578125
4
[]
no_license
for x in range (1,100) : if (x%3 == 0 and x%7 ==0) : print (x)
true
4f333f5a9baa3b4758b7ce52714e1e64d92a3810
LennyBoyatzis/compsci
/problems/binary_tree_superbalanced.py
UTF-8
527
3.84375
4
[]
no_license
def is_balanced(tree_root) -> bool: """Checks to see if the difference in depth of any two leaf nodes is no greater than one Args: tree_root: tree root to start searching within Returns: bool to describe if tree is superbalanced or not """ # Apply depth first search parent = tree_r...
true
d12d7a92f1106e30f3da8e818e454c062fe430e3
daniel-reich/ubiquitous-fiesta
/WH8AfHodqyj4gSB8K_20.py
UTF-8
1,028
3.53125
4
[]
no_license
import re def is_authentic_skewer(s): vowels = 'aeiouAEIOU' ​ # First and Last character MUST NOT be vowel if s[0] in vowels or s[-1] in vowels: return False ​ # If no alpha OR no symbols, we need to return False if not re.search('[a-zA-Z]', s) or not re.search('[^a-zA-Z]', s): retu...
true
c1557ec8be1c620047b9f6159d16c964b167c7ab
g147/cryptopals
/set1/challenge07.py
UTF-8
414
3.3125
3
[]
no_license
# AES in ECB mode from base64 import b64decode from Crypto.Cipher import AES def aes_ecb_decrypt(key, encrypted): cipher = AES.new(key, AES.MODE_ECB) decrypted = cipher.decrypt(encrypted).decode() return decrypted def main(): key = b'YELLOW SUBMARINE' encrypted = b64decode(open('data/challenge07....
true
7188b5e4a3a420bfa24d0a777fa3ba9dc76e95d7
growiat/intro-data-capstone-biodiversity
/Submission Folder/script3.py
UTF-8
855
2.84375
3
[]
no_license
import codecademylib import pandas as pd from matplotlib import pyplot as plt species = pd.read_csv('species_info.csv') species['is_sheep'] = species.common_names.apply(lambda x: 'Sheep' in x) sheep_species = species[(species.is_sheep) & (species.category == 'Mammal')] observations = pd.read_csv('observations.csv') ...
true
f37db133f7089b08295302e3b087d91fdec3d543
souzaaugusto/ExerciciosPython
/tipo_de_triangulo.py
UTF-8
1,129
3.734375
4
[]
no_license
#FORMAÇÃO DOS TIPOS DE TRIANGULOS FEITA NO CURSO DE PYTHON DO PROF GUSTAVO GUANABARA #---------Escolha dos comprimentos das retas: r1 = float(input('Comprimento da reta 1: ')) r2 = float(input('Comprimento da reta 2: ')) r3 = float(input('Comprimento da reta 3: ')) #---------Resultado: if r1 < r2 + r3 and r2 < r1 + r...
true
505918a83b942af7321535c0cb227e4a480b9ff1
Kiliyo/aichi1
/scrape_wikipedia/parse_species.py
UTF-8
980
2.640625
3
[]
no_license
#Data downloaded from Catalogue of life: http://www.catalogueoflife.org/DCA_Export/archive.php f = open('D://Documents and Settings/mcooper/Desktop/2017-09-29-archive-complete/taxa.txt') import pandas as pd out = pd.read_csv('D://Documents and Settings/mcooper/Desktop/2017-09-29-archive-complete/taxa.txt', sep='\t') ...
true
672b8b8e16de9dbf7c2d6b7adb34c454738392af
vijaymaddukuri/python_repo
/automation_framework/utils/GetConfigurations.py
UTF-8
3,430
2.703125
3
[]
no_license
import yaml from os.path import dirname, abspath from utils.SSHUtils import SSHUtil from conf.restConstants import MWS, BWS, TAS current_dir = dirname(dirname(abspath(__file__))) yaml_path = '{}/{}/'.format(current_dir, 'conf') class GetConfigurations: """ Fetches Config Files from all Services and keep them...
true
b10e3cb4aed5faf23f6e801dd3797ce175fdaa3f
khunspoonzi/yank
/yank/yanker_display_mixin.py
UTF-8
16,361
2.84375
3
[ "MIT" ]
permissive
# ┌────────────────────────────────────────────────────────────────────────────────────┐ # │ GENERAL IMPORTS │ # └────────────────────────────────────────────────────────────────────────────────────┘ import re # ┌──────────────────────────────────────...
true
8d4988e0f37657582021d8567a74bd34b72e1e66
torivelasquez/DataMining
/homework1/dataset.py
UTF-8
4,755
3.296875
3
[]
no_license
#Assignment based on MAGIC Gamma Telescope Data Set ( http://archive.ics.uci.edu/ml/datasets/MAGIC+Gamma+Telescope ) """ Student: Sung Bae Class: Data Mining (csci 4502) Date: 01/26/2016 """ import argparse import math import random import matplotlib.pyplot as plt class DataSet: """ Class to store the MAGIC ...
true
d22df72332289b9415bd04bf8fd07b0417b7de0d
rafaelaraujobsb/clima-tempo
/scrapper/scrapper_clima_tempo/modulos/utils.py
UTF-8
501
2.640625
3
[]
no_license
def parse_openapi(respostas: dict) -> dict: return {status: {"content": {"application/json": {"example": resposta.dict()}}, "model": resposta.__class__} for status, resposta in respostas.items()} def montar_paginacao(*, resultado: list, anterior: int, quantidade: int, chave_proximo: str = None) -> dic...
true
457d7973a3e595e9092d9f1aa83c0db3918242c7
scottwedge/LilFloSystem
/flo_telepresence/src/display-cv.py
UTF-8
1,782
2.6875
3
[]
no_license
#!/usr/bin/env python """A module to display the robot screen using opencv""" import rospy import sys from sensor_msgs.msg import Image as smImage from cv_bridge import CvBridge, CvBridgeError import numpy as np import cv2 import Queue # Screen is 800x480 class RobotScreen(object): def __init__(self): ...
true
a01303316c3cfa43e51f0cca6f3e0fe8d26f65bd
HandsOnTheVim/AlgorithmStudy
/2021_05_02/yuhwanwoo/2748.py
UTF-8
110
3.171875
3
[]
no_license
pibo=[0,1] pibo+=[0]*90 for i in range(2,92): pibo[i]=pibo[i-1]+pibo[i-2] n=int(input()) print(pibo[n])
true
67301eb3e1c6de0a85ff172beb77cb298a909d8d
naveenagarwal/python-data-structures
/linked_list/unordered_linked_list.py
UTF-8
1,233
4.03125
4
[]
no_license
class Node(object): """docstring for Node""" def __init__(self, data, next_node=None): self.data = data self.next = next_node class UnorderedLinkedList(object): """docstring for LinkedList""" def __init__(self): self.size = 0 self.base = None def add(self, data): node = Node(data, self...
true
ae8fda4500442bed1fd785a5daaa535418214634
yjh8806/python-2019-July
/13일/15.함수/14.문제.py
UTF-8
655
3.34375
3
[]
no_license
def data_unit(d, u): ex = ["T","G","M","K"] if u not in ex: print("잘못된 입력입니다.") return -1 #잘못된 입력시 -1을 반환 elif u == "T": return d * 1024 * 1024 * 1024 * 1024 elif u == "G": return d * 1024 * 1024 * 1024 elif u == "M": return d * 1024 * 1024 elif...
true
181fb4287ad0e88d575441166bf837f0c9988176
tuanfadbg/Khoa_luan
/bag_of_word/neural_network/test_tang_1_2.py
UTF-8
3,827
2.59375
3
[]
no_license
import csv import random import keras import pandas as pd import numpy as np from sklearn.feature_extraction.text import TfidfTransformer from sklearn.feature_extraction.text import CountVectorizer from sklearn.linear_model import LogisticRegression from sklearn.metrics import classification_report from sklearn.model_...
true
79a2281748d64733dfcbfe167c04458882dd7392
sarahblue66/Coding-Projects
/crime data/report.py
UTF-8
4,476
3.015625
3
[]
no_license
# Tianyi Lan # # Challenge2: crime-data # import psycopg2, sys from tabulate import tabulate import matplotlib.pyplot as plt from matplotlib.dates import DateFormatter conn = psycopg2.connect(host="localhost", database="tianyi_lan", user="tianyi_lan", password="LanTY661231") cur = conn.cursor(...
true
73faa975fd2f0836633cdf3dca628ee4de5da1bb
luizgustavodarossi/Pyhton
/ex076.py
UTF-8
401
3.1875
3
[]
no_license
listagem = ('Lápis', 1.75, 'Borracha', 2, 'Caderno', 15.9, 'Estojo', 25, 'Transferidor', 4.2, 'Compasso', 9.99, 'Mochilha', 120.32, 'Canetas', 21.3, 'livro', 34.9) print('-' * 35) print(f'{"Listagem de Preços":^35}') print('-' * 35) for pos in range(0, len(listagem)): if pos % 2 == 0: print(f'{listage...
true
28c0f5e2ac74307b31353edcb241d6305b721e4a
AIR-Center/Skin-Cancer-Traditional-Classifier
/ensemble.py
UTF-8
2,070
2.6875
3
[]
no_license
import pandas as pd import numpy as np from sklearn.model_selection import train_test_split, GridSearchCV from sklearn.neighbors import KNeighborsClassifier from sklearn.ensemble import RandomForestClassifier, VotingClassifier from sklearn.linear_model import LogisticRegression from sklearn.naive_bayes import Ga...
true
fc19325dfd5fc7b2a01337b8751579e38d149cc1
YashasviMantha/NLP
/FFN/Matrix.py
UTF-8
399
3.0625
3
[]
no_license
# Config Statements from _DUMP import me me.mark("D") print("Start -- Debug Stat\n") # class declarition class matrix: def __init__(self, Lrows = 3, Lcols = 3): self.rows = Lrows self.cols = Lcols self.Matrix = [[0 for x in range(self.rows)] for y in range(self.cols)] print(self...
true
ef654d3249b46c34480e2952edcd92add7c8fe76
threadly/python-threadly
/threadly/Structures.py
UTF-8
4,136
3.28125
3
[ "Unlicense" ]
permissive
""" Data strutures used in threadly. """ from threading import Condition class SortedLockingList(object): """ This is a sortedList implementation for multiThreads. One main goal is to make adds as cheap as possible. """ def __init__(self): self.slist = list() self.uslist = list() ...
true
f30870a736564f175231652009033d23b50e4c25
WeipengTang/coop-fall-2020-challenge
/solution_python.py
UTF-8
1,211
3.421875
3
[]
no_license
class EventSourcer(): # Do not change the signature of any functions def __init__(self): self.value = 0 self.histroy = [] self.currentIndex = -1 def add(self, num: int): self.value += num self.histroy.append(num) self.update_index(1) def subtrac...
true
9354d83e606e14a765d8d2c3317d27d749b124fc
JnanaRM/ga-learner-dsmp-repo
/Making-Inference-from-Data/code.py
UTF-8
2,754
2.859375
3
[ "MIT" ]
permissive
# -------------- import pandas as pd import scipy.stats as stats import math import numpy as np import warnings warnings.filterwarnings('ignore') #Sample_Size sample_size=2000 #Z_Critical Score z_critical = stats.norm.ppf(q = 0.95) # path [File location variable] data = pd.read_csv(path) #C...
true
5dd956ac7cb384d88709dc23f759620248aa9ef7
hisland/my-learn
/python3/python3.6.2-doc/section5-data-structure/02.list.pop.py
UTF-8
88
3.203125
3
[]
no_license
list = [1,2,3, 2, 3, 1] print(list) list.pop() print(list) list.pop(0) print(list)
true
207ea5095f6c7440842d27ee67ff504e4743ffef
isabella232/pots
/src/traffic_planner.py
UTF-8
5,652
3.140625
3
[ "MIT" ]
permissive
""" MILP solver for the network interdiction problem against traffic routing apps. """ # Units of time: hours # Units of distance: miles import attr from datetime import datetime from ortools.linear_solver import pywraplp # Solution tolerance. TOLERANCE = 0.001 # Minimum possible speed limit in mph. MIN_SPEED_LIM =...
true
4f25bd373741ca11e270eb9d046c0e927dc1fd67
ljwwwiop/python_share
/Opencv3/data1/31/demo.py
UTF-8
1,918
3.21875
3
[]
no_license
''' 直方图应用 均衡化 自动调整对比度 图像增强的手段 一般都是Gray灰度处理 直方图只认识gray 直方图对比 判断图片相似性 巴氏距离 相关性 卡方 ''' import cv2 as cv import numpy as np # 均衡化两种方法 增强对比度的 适合较黑色的 def equalHist_demo(img): gray = cv.cvtColor(img,cv.COLOR_BGR2GRAY) dst = cv.equalizeHist(gray) cv.imshow("dst",dst) # 自然处理直方图 不会过分处理 局部的 def cla...
true
d69034209fdb736f087e7de15a51a32642504024
brendanjmeade/bem2d
/integrals/kernels.py
UTF-8
7,056
3.140625
3
[]
no_license
import numpy as np import matplotlib.pyplot as plt def kernel_and_derivatives(x, y, a, mu, nu): """ From Starfield and Crouch, pages 49 and 82 """ f = ( -1 / (4 * np.pi * (1 - nu)) * ( y * (np.arctan2(y, (x - a)) - np.arctan2(y, (x + a))) - (x - a) * np.log(np.s...
true
676d8456ae6e98e391c2e4cd5b8ecea8c4bf327b
siddhusalvi/python-data-structure
/tuple/check_item_tuple.py
UTF-8
334
4.4375
4
[]
no_license
""" 6. Write a Python program to check whether an element exists within a tuple. """ def check_item(given_tuple, ele): for x in given_tuple: if x == ele: return True return False tuple1 = ("apple", "banana", "cherry", "orange", "kiwi", "melon", "mango") word = "mango" print(check_item(t...
true
81b1eb823d3c95365a2694515ee57072f4d89d97
AliEbrahimpour/twitter-nlp
/twitter-step-6.py
UTF-8
467
2.84375
3
[]
no_license
import codecs n=input("enter word: ") print(n) line="" t="" with codecs.open("step5/inverted-index.txt", 'r', encoding="utf-8") as f: for text in f.readlines(): for i in range(0, len(text)): line += text[i] print(str(i)+line) for word in line.split(":"): ...
true
17c6f976c33865fb7c612423de25ba1033f8b63e
amireldor/Insect-Of-Terror
/insect/game/models.py
UTF-8
614
3.296875
3
[]
no_license
import util class Model(object): def update(self, dt): pass class Actor(Model): """An actor is someone on the screen that can move and rotate""" def __init__(self): self.position = [0, 0] self.rotation = 0 def set_position(self, new_pos): for i in xrange(len(new_pos))...
true
7aecf5ae77d34dd5711f94e4d44949aa8c356143
salmanul-fares/py-automation
/1-simple/3-lists.py
UTF-8
415
3.59375
4
[]
no_license
# TODO: sample list program print(['x','y',35,56.89][::-1]*4) #for c in "Salman":#or any array #print(c) #in and not in ops cat=['fat', 'black', 'loud'] size, color, dispo = cat #print(size + color + dispo) cat.append('sala') #cat = cat + ['sala'] cat.remove('fat') # '-' not supported #other like sort #tuplle a...
true
672c95d1be8b7419301249a41e46006cca651d8b
swordsbird/deepnlpvis
/interpreter/dataset.py
UTF-8
11,676
2.765625
3
[]
no_license
from pytorch_pretrained_bert import BertTokenizer import random max_length = 64 def CoLA_processor(path_to_dataset): all_content = open(path_to_dataset,'r',encoding='utf8').readlines() dataset = [] label_dict = {'0':0,'1':1} for idx,line in enumerate(all_content): line = line.strip().split('\...
true
8e1836c2107771a0f92879db933baf19bbbd02e6
TitusWeikamaR/audioproject
/agc/stft.py
UTF-8
3,783
3.34375
3
[]
no_license
import numpy as np def stft(x, frame_size, hop_size=None, window=None, N=None, only_positive_freqs=True): """ Compute the Short-Time Fourier Transform (STFT) of a signal x. x: signal (for now, only mono is supported) frame_size: in samples hop_size: in samples (default 25% of frame siz...
true
4926d9a5d16755569cd38bedda52c622e4f45d0a
prashantacharya/oss-leaderboard
/leaderboard/utils/intermediate_score_table.py
UTF-8
6,099
2.9375
3
[ "MIT" ]
permissive
""" Create Intermediate Score Table from the received data. """ from typing import Tuple import pandas as pd from leaderboard.constants import contribTypes def get_intermediate_score_table(intermediate_table_df: pd.DataFrame) -> pd.DataFrame: """ Returns contribution counts of all sub types for all users. Arg...
true
d6e8c9e76dbb439f931268985c194c0a002af146
rikumiura/pyCodes
/mlPrediction/toTxt_sakura.py
UTF-8
1,437
2.84375
3
[]
no_license
import matplotlib.pyplot as plt import numpy as np import csv import glob import os # 1月はじまり daysInMonth = np.array([31,28,31,30,31,30,31,31,30,31,30,31]) placeRow = 65 # 65.. Tokyo placeRows = [65, 64, 67, 42, 44, 53, 54, 57, 59, 60, 61] placeNames = ["tokyo", "shizuoka", "...
true
cd629f75c77caf364d6523e7b243f86234698dd5
jorgewribeiro/manuela-visual-inspection
/cam/client.py
UTF-8
8,151
2.671875
3
[ "MIT" ]
permissive
import sys import time import cv2 import os import argparse import json import datetime import numpy as np from PIL import Image from kafka import KafkaProducer from random import shuffle import base64 from cloudevents.http import CloudEvent, to_structured import requests import uuid import logging # # Globals # w...
true
90e04a731d3b2c8c5afdf2ae1b93067ccf895fe4
electusmatari/legacy
/eveutil1/bin/bcreport
UTF-8
6,353
2.875
3
[]
no_license
#!/usr/bin/env python # Simple reporter of battleclinic kills import csv import datetime import optparse import StringIO from lib import evedb db = evedb.connect() def main(): parser = optparse.OptionParser(usage="%prog <file>", version="%prog 0.1") (options, args) = parse...
true
7d7b0540e312efea38e640acbca0cca02b378263
30nt/IntroPython_16_07_21
/lesson11_csv.py
UTF-8
1,439
3.296875
3
[]
no_license
# csv import csv from lesson10 import add_suffix_to_filename def read_csv(filename): with open(filename, "r") as csv_file: data = [] reader = csv.reader(csv_file, delimiter=";") for row in reader: data.append(row) return data def write_csv(filename, data): with open(f...
true
6fc49a7abed9937c465c41c9abfe3669725d5fbc
SuperBGLazer/Admin_Bot
/Command.py
UTF-8
350
2.71875
3
[]
no_license
class Command: pass def __init__(self, command, message): """ :type command: str :type message str """ self.command = command self.message = message def check_message(self, command): return self.command == command c = Command("^test", "test") comm...
true
823b868670277543694d17abd40f878d17b20f19
mopsalarm/pr0gramm-metrics
/main.py
UTF-8
1,472
2.53125
3
[]
no_license
#!/usr/bin/env python3 import random import time from contextlib import contextmanager import datadog import requests print("Initializing datadog") datadog.initialize() print("Starting datadog stats") stats = datadog.ThreadStats() stats.start() def metric_name(name): return "ext.pr0gramm.request." + name @co...
true
4775d5d8771eb0941532231834e8e3658a019c25
JannaKim/PS
/sort/11004.py
UTF-8
140
2.53125
3
[]
no_license
import sys; input= lambda: sys.stdin.readline().rstrip() n,k= map(int, input().split()) L=[*map(int, input().split())] print(sorted(L)[k-1])
true
f5fbaefc14a20c2aae67f5a5b4021dfd5caed34e
wxz321123/lalalalalalala
/load_data.py
UTF-8
2,636
2.828125
3
[]
no_license
import pandas as pd from entity.Order import Order from entity.Vehicle import Vehicle def load_node_info(path): print('loading node information') df = pd.read_csv(path) warehouse = None orders = [] charging = [] for idx in df.index: row = df.loc[idx] order = Order(id=row['ID']...
true
3d46b7059a8ae7839d6e892f37cd30a0f133033f
yizhe/PythonProject
/Lagrange.py
UTF-8
2,489
3.265625
3
[]
no_license
from numpy import * from scipy.misc import derivative from scipy.optimize import fsolve import pylab def build_func(string): """build a function from string. The string should be recoganizable for eval with variable names x[0], x[1], x[2]... """ def res_fun(val): x = [] for number in...
true
6b34ba9a72c58bd123757e03762ea2923bc0cdaa
daniel-reich/ubiquitous-fiesta
/PCtTk9RRPPKXCxnAx_16.py
UTF-8
283
3.375
3
[]
no_license
def modulo(x, y): if x - y == 0: return 0 elif abs(x) < abs(y): return x is_x_negative = x < 0 is_y_negative = y < 0 if ((is_x_negative and not is_y_negative) or (not is_x_negative and is_y_negative) ): return modulo(x + y, y) return modulo(x - y, y)
true
1378fdf8341695b38b6aa28f8b8f0732f8e88688
kevintham/dbot
/dbot/cogs/dice.py
UTF-8
529
3.109375
3
[ "MIT" ]
permissive
import random from discord.ext import commands from discord.ext.commands import Cog class Dice(Cog): def __init__(self, bot): self.bot = bot @commands.command(name='roll_dice') async def roll(self, ctx, number_of_dice: int, number_of_sides: int): """Simulates rolling a dice.""" ...
true
038961302df13a10386d676dcd1e26b614cad731
wagnerrds0/TDS-PEC-2021.2
/SEM 03/Aula 02/5_bonificacao.py
UTF-8
281
3.84375
4
[]
no_license
#Entrada tempo_servico = float(input("Digite o tempo de serviço: ")) bonus_anual = float(input("Digite o valor do bônus em R$: ")) #Processamento bonificacao = tempo_servico * bonus_anual #Saída print("O valor da bonificação anual é de R$: " "%.2f" % bonificacao)
true
0cced403ca28f2293580dc6c35bd59764614ea34
astralum/cipher
/caesar.py
UTF-8
1,005
3.859375
4
[]
no_license
alphabet = "abcdefghijklmnopqrstuvwxyz" message = input("What is your message? English alphabets only.\n> ") num = int(input("\nBy how many spaces to the right? Integers only.\n> ")) def code(message, num): coded = "" lowercase = message.lower() for i in range(0,len(message)): if message[i] == " ...
true
3e2e42dfbfb2d16f2e406836b46fdd0bfc928ae5
ryanjeric/python_playground
/terms/UNITTEST/test_calc.py
UTF-8
1,410
3.359375
3
[]
no_license
# https://www.youtube.com/watch?v=6tNS--WetLI by Corey Schafer import unittest import calc class TestCalc(unittest.TestCase): # always prefix with "text_" @classmethod def setUpClass(cls): print('setup class') @classmethod def tearDownClass(cls): print('teardownClass') def se...
true
a6756ab64e5ed780b66206758805b8441f17f8cf
kvzhao/tensorflow-practices
/simple_seq2seq.py
UTF-8
4,355
2.625
3
[]
no_license
''' this code is refered to a great tutorial https://github.com/ematvey/tensorflow-seq2seq-tutorials/blob/master/1-seq2seq.ipynb ''' from __future__ import division import numpy as np import tensorflow as tf import simple_seq2seq_helpers as helpers sess = tf.Session() PAD = 0 EOS = 1 vocab_size = 10 embedd...
true
3ebee7126f84e37c4db275b548c4b429825b4eac
ms-kim520/GetWhatIWant
/extract_from_headline.py
UTF-8
3,174
2.765625
3
[]
no_license
import pandas as pd import re from geopy.geocoders import Nominatim host='nominatim.openstreetmap.org' geolocater=Nominatim(domain=host, timeout=8, user_agent="ms.kim1") from tqdm import tqdm ### Extract from title : where, why, what #제목으로부터 어느 질병, 장소 추출, 이외로도 감염원(혹은 대상--> 내용으로) 추출 가능 def extract_from_front...
true
ecb269f97cd3f25a778802949a8f715959788375
PinguinoIDE/pinguino-libraries
/examples/09.Interfacing/Python/sinusoid.py
UTF-8
3,095
3.328125
3
[]
no_license
#! /usr/bin/python # -*- coding: utf-8 -*- # ---------------------------------------------------------------------- # File: sinusoid.py # # Get 2 sine waves coordinates from a Pinguino through the USB port # Display the points with the Matplotlib Python module. # # 03/01/2017 - Regis Blanchot (rblanchot@gmail.com) - ...
true
e1c8d23a308d054cb02aa20416e491d9f6910388
BhavyaShah1234/MyWholeImageProcessingFolder
/Drawing Line.py
UTF-8
389
3.15625
3
[]
no_license
import cv2 import numpy as np image = np.zeros((512, 512, 3), np.uint8) # ARGUMENTS OF LINE ARE IMAGE,(STARTING COORDINATES), (ENDING COORDINATES), (COLOR), THICKNESS cv2.line(image, (0, 0), (300, 250), (0, 255, 0), 7) cv2.line(image, (512, 0), (300, 250), (0, 0, 255), 10) cv2.line(image, (300, 512), (300, 250)...
true
d48c7b5a9a91bc25a4648cc356328e4c264a6095
806334175/pystudy
/10_并发编程/01_多进程/01_multiprocessing模块介绍.py
UTF-8
886
2.71875
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2019/9/26 上午10:20 # @Author : Ryu # @Site : # @File : 01_multiprocessing模块介绍.py # @Software: PyCharm # python中的多线程无法利用多核优势,如果想要充分地使用多核CPU的资源(os.cpu_count()查看),在python中大部分情况需要使用多进程。Python提供了multiprocessing。 # multiprocessing模块用来开启子进程,并在子进程中执行我们定制的任...
true
69f5238245b3016c16ed3dea73e03f3ecc5bb8d5
alejamorenovallejo/retos-phyton
/Ejercicio/Clases/operadores.py
UTF-8
1,351
4.75
5
[]
no_license
num1 = int(input("Digita el primer número: ")) num2 = int(input("Digita el segundo número: ")) #Suma suma = num1 + num2 print("La suma de", num1, "y", num2, "es igual a", suma) #Sumar un valor a una variable y guardar en la misma variable #Primera forma suma = suma + 5 print("Al resultado le sumo 5 y obtengo", suma) ...
true
de6f308c8560f9950ce07be6ec162906a2cbfc16
XrossFox/maquina-de-aspectos
/preprocesador/unit_tests/test_limpiador_de_texto.py
UTF-8
5,311
3.5
4
[ "MIT" ]
permissive
import os import sys sys.path.append('../') import unittest import limpiador_de_texto as lim class TestLimpiezaDeTexto(unittest.TestCase): """Pruebas para el modulo limpieza_de_texto.py""" def setUp(self): self.l = lim.LimpiadorDeTexto(os.getcwd()+"/../stopwords.txt") def test_remocion_...
true
4742291e44ee74f0f8575653291690c613619804
BebawyMonica/APU_CS430-PacMan
/multiAgents.py
UTF-8
14,482
3.3125
3
[]
no_license
# multiAgents.py # -------------- # Licensing Information: You are free to use or extend these projects for # educational purposes provided that (1) you do not distribute or publish # solutions, (2) you retain this notice, and (3) you provide clear # attribution to UC Berkeley, including a link to http://ai.berkeley.e...
true
fc4f72b9e05c5750ba4a80ddeda2b21842b4dcfd
ramonsilva186/Algoritmo-Programa-o-1
/Roteiro1/Médias.py
UTF-8
1,355
3.546875
4
[]
no_license
tipo=input() if (tipo == "a") or (tipo == "p") or (tipo == "h"): nota1=int(input()) nota2=int(input()) nota3=int(input()) if (tipo == "p"): p1=int(input()) p2=int(input()) p3=int(input()) p=((nota1*p1)+(nota2*p2)+(nota3*p3))/(p1+p2+p3) if (p >= 70) and (...
true
bf8531cb1d15e65bd7a4037f682e3b9ee336d3ab
nickwilson3/containers_nick
/tests/test_unicode.py
UTF-8
8,247
2.765625
3
[ "MIT" ]
permissive
from containers.unicode import NormalizedStr import pytest strings = [ 'César Chávez', # spanish, NFD normalized 'César Chávez', # spanish, NFC normalized 'César Chávez', # spanish, unnormalized ] def test_repr_0...
true
a6e468ee1a0738e76f84b5e8cdcebf17728eebce
Shel-Zaroo/texturizer
/texturizer/simple.py
UTF-8
3,012
3.21875
3
[]
no_license
# -*- coding: utf-8 -*- import pandas as pd import numpy as np import math import os stop_word_list = ["a","able","about","across","after","all","almost","also","am","among","an","and","any","are","as","at","be","because","been","but","by","can","cannot","could","dear","did","do","does","either","else","ever","every"...
true
8deb2171d1ea3ce9ef1b3734f0a5ed6f006119bb
wangdan377/Python_UI
/ZYCami_pytest02/page/webpage.py
UTF-8
13,251
2.734375
3
[]
no_license
# webpage.py from selenium.webdriver.common.action_chains import ActionChains from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support.select import Select from selenium.common.exceptions import TimeoutException, NoSuchElem...
true
9350ecb1132aec57a2f5857b879c5e0e0537cddd
Hibiki1020/classification_attitude_estimator
/pysrc/common/make_datalist_mod.py
UTF-8
443
2.8125
3
[ "MIT" ]
permissive
import csv import os def makeMultiDataList(list_rootpaths, csv_name): #For Multi Directory data_list = [] for list_rootpath in list_rootpaths: csv_path = os.path.join(list_rootpath, csv_name) with open(csv_path) as csv_file: reader = csv.reader(csv_file) for row in read...
true
5b345451350e04121956385a1fa7359ff77920ea
Marzhann/P-Lessons
/_9.py
UTF-8
769
4.4375
4
[]
no_license
# Practice 9 # Guessing game. Let`s have fun import random try: ran_number = random.randint(1,9) n = 1 in_1 = input('Hi there!Let`s play guessing game.I have number in my mind from 1 to 9.Try to guess! p.s. if you wanna quit type exit: ') while in_1 != 'exit': if int(in_1) == ran_number ...
true
f218cf639af89081c29d13ddfa5a0b5e83e78ebd
eBLDR/Misc_Projects
/Notebook/notebook.py
UTF-8
2,507
3.546875
4
[]
no_license
from note import Note class Notebook: """ Represent a collection of notes that can be tagged, modified and searched. """ def __init__(self): """ Initialize a notebook with an empty list. """ self.notes = [] def new_note(self, memo, tags=''): """ Cr...
true
0081e77630cb78010caa82df5d054c8e6df46ed0
t-zetsu/100knock
/chapter4/33.py
UTF-8
1,281
3.203125
3
[]
no_license
# coding: utf-8 parsed_file = "neko.txt.mecab" output_file = "output/33.txt" # 形態素解析済みのテキストを成形 def form_sentences(parsed_file): morphemes = [] with open(parsed_file, mode='r', encoding='utf-8') as f: for line in f: line = line.replace("\n","") if line != "EOS": ...
true
35260fddaca103175b3392098893e5ba82b5d299
cxsong1/lango-tune_NEW
/src/SongRecognition.py
UTF-8
587
2.59375
3
[]
no_license
import json from acrcloud.recognizer import ACRCloudRecognizer def getTitle(filePath): if __name__ == '__main__': config = { 'host':'identify-us-west-2.acrcloud.com', 'access_key':'5b3f425b3e7dd719669f681b3a89193c', 'access_secret':'pZxRsVGVIXXjZ4GPiX4nb7v33sRsTKBX2ejdlO...
true
14638d037a7f36ebfeb409dc00527cb37c2580b8
destructor0/destructor0
/Calculatingtaxchallenge.py
UTF-8
103
3.640625
4
[]
no_license
a = int(input("Cost of meal: ")) tip = float(15/100*a) tax = float(10/100*a) b = tip+tax print(a-b)
true
53b56e83c125663018f00aeb75f4e34c5393fe3b
scmartin/python_utilities
/lammps_reader/lammpstraj.py
UTF-8
3,339
2.515625
3
[]
no_license
import numpy as np import argparse import pandas as pd import timeit def traj_reader(fname): step = 0 atoms = 0 header = [] first = True columntypes = {'q':'float','x':'float','y':'float','z':'float', 'element':'str','vx':'float','vy':'float', 'vz':'float','c_s...
true
21f9de04a0b9e07ae8485bc98383262cc7b6c8a9
Wolvarun9295/BasicPython
/Basic Python Programs/31.SysCommandOP.py
UTF-8
193
3.09375
3
[]
no_license
# Imported subprocess module. import subprocess # Storing the command in returnThis variable. returnThis = subprocess.check_output("ls", shell=True, universal_newlines=True) print(returnThis)
true
73043e18c0146797a0db35ca72bcb45e9b9d6f81
DrewDouglass/GenerateHours
/main.py
UTF-8
295
3.171875
3
[]
no_license
#!python3 import sys def main(): # Example 2019-09-22 date_arg = sys.argv[1] print(f'Generating hours for: {date_arg}') for i in range(24): #2019-09-22 01 #2019-09-22 02 etc print(f'{date_arg} {str(i).zfill(2)}') if __name__ == "__main__": main()
true
d6f14a3882be0fa126b050330138c413e1691f83
modaei/property_management
/properties/api/permissions.py
UTF-8
748
2.578125
3
[]
no_license
from rest_framework.permissions import BasePermission, SAFE_METHODS class IsPropertyOwnerOrReadOnly(BasePermission): """ If the user is the property's owner grant access otherwise, just allow safe methods """ message = "Only the owner can edit/delete this object" def has_object_permission(sel...
true
9f3c2e183394f3b9ab90b4901761fc8403ae097b
Aidan28/pp2_summer_edition
/tsis4/lec6/b.py
UTF-8
121
3.265625
3
[]
no_license
def sum(): a = 0 list = [8, 2, 3, 0, 7] for i in range(len(list)): a = a + list[i] print(a) sum()
true
55936a4a958b8aaa2809809f340fa88daa7f385e
Prashant24759/climate-change
/AnalyseData.py
UTF-8
8,087
2.859375
3
[]
no_license
from itertools import groupby import pandas as pd class Analyse: def __init__(self, path): if path.endswith('csv'): self.df = pd.read_csv(path, encoding="ISO-8859-1") if path.endswith('xls'): self.df = pd.read_excel(path) self.df = self.df[:-4] # self.d...
true
ac28ade89ab2dd3793109045dfdb8d58eb45be52
Bennyboie/crypto-attacks
/test/test_cbc.py
UTF-8
1,974
2.875
3
[ "MIT" ]
permissive
import os import sys from random import randbytes from unittest import TestCase from Crypto.Cipher import AES from Crypto.Util.Padding import pad from Crypto.Util.Padding import unpad path = os.path.dirname(os.path.dirname(os.path.realpath(os.path.abspath(__file__)))) if sys.path[1] != path: sys.path.insert(1, pa...
true
008deb52f6a6ccdf83c5f64dee4982cf62035744
Aszman/Project_Labyrinth
/prim.py
UTF-8
2,654
3.640625
4
[ "MIT" ]
permissive
# Genereting maze with Prim Algorithm from pprint import pprint import random import pygame def hania_prim(s): START_CELL = (0, 0) grid_size = 10 white =(255, 255, 255) black =(0, 0, 0) size = 2 * s - 1 # Create a grid with ones in place of cells/nodes grid = [[0 for _ in range(si...
true
349bf23cc18a78bc44cd14decb64b19049f67ad8
n8sty/dowhy
/tests/causal_estimators/base.py
UTF-8
6,540
2.734375
3
[ "MIT" ]
permissive
import itertools import dowhy.datasets from dowhy import CausalModel class TestEstimator(object): def __init__(self, error_tolerance, Estimator, identifier_method="backdoor"): print("Error tolerance is", error_tolerance) self._error_tolerance = error_tolerance self._Estimator = Estimator ...
true
28235feb4de3215fe4da86979da23e8e238c69df
kkolyan/blender-addons
/CollapseFaces/CollapseFaces.py
UTF-8
3,838
2.53125
3
[ "BSD-3-Clause" ]
permissive
import logging import bmesh import bpy """ Removes each pair of faces of all objects that matches by all vertices. Intended to remove inner faces. """ bl_info = { "name": "CollapseFaces", "blender": (2, 80, 0), # look to register - there is the hack, so it's recognized as compatible by 2.79 too "categor...
true
6f937c22331134e6073365f3dd7b842872fc45cb
elezar/go-faster
/prototype/process_log.py
UTF-8
6,196
2.5625
3
[ "MIT" ]
permissive
import re import argparse import requests import json import numpy as np import datetime import matplotlib matplotlib.use('Agg') import pylab as P item_matcher = re.compile( "^([ \d:/]+) ### Starting:(.*?)^([ \d:/]+) ### Done:$", re.S + re.M) source_matcher = re.compile("Testing from (.*?)\s+\(([\d\.]+...
true
23c2a10366a3e59478b8ae5975c6d4040d14468d
giselasanggaria/Struktur-Data
/Tugas Struktur Data_Gisela Sanggaria_E1E119025/c13.py
UTF-8
162
3.546875
4
[]
no_license
def myReverse(data): # returning a new reversed list return [data[i] for i in range(len(data)-1, -1, -1)] print(myReverse([1, 3, 5, 7, 9, 11, 13]))
true
3dfa82cf701939fefc150936f7669090e007821f
rishidabre/twitter-project-short-term-growth-analysis
/get_twitter_users.py
UTF-8
3,536
2.8125
3
[]
no_license
#!/usr/bin/python import tweepy_setup as ts import json import tweepy import pandas #from codecs import encode import tweets_streamer import operator import time import pickle #print json.dumps(result, sort_keys=True, indent=4, separators=(',', ':')) #u=api.get_user(<some user id>) #print json.dumps(json.loads(u)) #...
true
6caa993c4f6ca7bcf3f0c8cf34f98a5a65411f0f
pathi108/DataSense
/primitive_data_type_identification/primitive_type_checker/string_checker.py
UTF-8
311
2.84375
3
[]
no_license
from data_type_checker import DataTypeChecker import pandas as pd class StringChecker(DataTypeChecker): def __init__(self): self.name="text" def is_data_type(self, column): try: pd.to_numeric(column) return False except ValueError: return True
true