blob_id
large_string
language
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
5cabdcb0e62b2947facad5265249672bbd5e3575
Python
SomaIITMandi/demo1
/subarray_with_sum2.py
UTF-8
504
3.40625
3
[]
no_license
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Wed Jul 24 22:57:48 2019 @author: debashis """ arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] sum2 = 15 flag = 0 for i in range(len(arr)): if flag == 1: break desired_sum = 0 desired_sum += arr[i] for j in range(i, len(arr)): if desi...
true
a2202cd9a42a9b73b471f313bee127f177088754
Python
Vadbeg/algorithms
/tasks/trees/binary_tree/binary_search_tree.py
UTF-8
5,082
3.53125
4
[]
no_license
from typing import Union, Optional from tasks.trees.binary_tree.traverse import traverse_inorder, traverse_depth_first class BinarySearchTree: def __init__(self, payload: Union[int, float]): self.left_child: Optional['BinarySearchTree'] = None self.right_child: Optional['BinarySearchTree'] = None...
true
6fdb50bac74bf797220dc56995b5760c43b6450a
Python
yoonm/yoonm.github.io
/python/author_death.py
UTF-8
391
3.390625
3
[]
no_license
author_year = {"Charles Dickens": "1870", "William Thackeray": "1863", "Anthony Trollope": "1882", "Gerard Manley Hopkins": "1889"} for author, year in author_year.items(): print(author + " kicked the bucket in " + year + ".") ## using a method: # def print_the_names(name, year): # print(author + " ...
true
3bb8c28a3584ad704b94577ffbcd0d1819ef69eb
Python
jesstucker/exercism
/kindergarten-garden/kindergarten_garden.py
UTF-8
791
3.171875
3
[]
no_license
class Garden(): def __init__(self, code, students=None): self.code = code.splitlines() if not students: self.students = ['Alice', 'Bob', 'Charlie', 'David','Eve', 'Fred', 'Ginny', 'Harriet','Ileana', 'Joseph', 'Kincaid', 'Larry'] else: self.students = sorted(students) def plants(self, student): plant_r...
true
ade1c856c43daeedae79ea2a033dfc79a7b51785
Python
dair370/seleniumProject
/eesignup.py
UTF-8
2,273
2.8125
3
[]
no_license
import unittest from selenium import webdriver import time from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.common.by import By class eesignupCase(unittest.TestCase): def setUp(self): self.driver = webdriver.Chr...
true
7eec23f4073e142899f1aed92ce01d2327bfdae6
Python
vasu589/school-admission-tool
/README.py
UTF-8
1,295
3.5
4
[ "MIT" ]
permissive
#program for basic school administration tool import csv def write_into_csv(info_list) with open('student_info.csv','a',newline=' ') as csv_file: writer=csv.writer(csv_file) if cdv_file tell()==0: writer.writerrow("name","age","contact no","email id") writer.writerrow...
true
ea2e6e06e0566ea46610b4af9590de4f30680fb6
Python
168WenFangjun/grx
/tag/expand.py
UTF-8
1,749
3.125
3
[]
no_license
import tag import text import lexer import parser import iteration def token_class(): return ExpandTagToken class AbstractExpandToken(lexer.AbstractToken): def parse(self, context): try: start = context.defaultrange[0] end = context.defaultrange[1] except AttributeError: raise Exception("expansion di...
true
9547adbb47f20ae476b1d783687d8ad16795b31a
Python
yuly3/atcoder
/ABC/ABC195/D.py
UTF-8
732
2.796875
3
[]
no_license
import sys from bisect import bisect_left sys.setrecursionlimit(10 ** 7) rl = sys.stdin.readline def solve(): N, M, Q = map(int, rl().split()) WV = [list(map(int, rl().split())) for _ in range(N)] X = list(map(int, rl().split())) LR = [list(map(int, rl().split())) for _ in range(Q)] WV.sort(...
true
0ee0077b5359d661c71957c2096fbed23a6def53
Python
Lucasplpx/youtube-extract
/main.py
UTF-8
2,151
2.625
3
[]
no_license
from dotenv import load_dotenv from datetime import datetime from googleapiclient.discovery import build import pandas as pd import os load_dotenv() youTubeApiKey = os.getenv('API_KEY') youtube = build('youtube', 'v3', developerKey=youTubeApiKey) playListId = os.getenv('PLAY_LIST_ID') playListName = 'NAME_PLAYLIST...
true
7263ef9e5c7cdcde2858567a18ad76cc8511ee43
Python
FrancoJigo/Thesis
/to_grayscale.py
UTF-8
345
2.53125
3
[]
no_license
import cv2 import glob, os, errno # Replace mydir with the directory you want mydir = r'C:/Users/63917/Documents/Jigo/Thesis/' for fil in glob.glob("*.jpg"): image = cv2.imread(fil,0) # gray_image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) # convert to greyscale # print(image.shape) cv2.imwrite(os.pa...
true
b07e351fa1d20d9884faf8c913a17f11ac73cae9
Python
boknowswiki/mytraning
/lc/python/0740_delete_and_earn.py
UTF-8
1,363
3.4375
3
[]
no_license
# hash table and dp # time O(n+k) # space O(n+k) class Solution: def deleteAndEarn(self, nums: List[int]) -> int: points = defaultdict(int) max_number = 0 # Precompute how many points we gain from taking an element for num in nums: points[num] += num max_numb...
true
cfe78b8cdbbccd15373e346d908ff8b65942489d
Python
asogaard/AnalysisTools
/scripts/parseGRL.py
UTF-8
1,056
2.578125
3
[]
no_license
import os, sys from sys import argv # XML parser. import xml.etree.ElementTree as ET # I/O if len(argv) < 2: print "Please specify the GRL path." sys.exit() if not os.path.isfile(argv[1]) : print "Provided path '%s' doesn't point to a file." % ( argv[1] ) sys.exit() if not argv[1].split('.')[-1] == ...
true
97178ca38c55b79e5c4ae1168531ebe027d8ee6f
Python
Lanayaghi/pythonstack
/exam_dashboard/log_app/models.py
UTF-8
2,098
2.65625
3
[]
no_license
from django.db import models import re class UsersManager(models.Manager): def validator(self, post_data): errors = {} email_regex = re.compile(r'^[a-zA-Z0-9.+_-]+@[a-zA-Z0-9._-]+\.[a-zA-Z]+$') if len(post_data['first_name']) < 2: errors['first_name'] = "First name...
true
39da6bd74f17e5d8723fa28f0ef3ea52502691b0
Python
marekprochazka/V2_MarkoGebra
/Predecessors/list_view/NoiseRow.py
UTF-8
3,966
2.53125
3
[]
no_license
from Bases import BaseRow, BaseLabel, BaseColorPicker, BaseEntry from tkinter import StringVar, Button from tkinter import ttk as t from Decorators.input_checkers import noise_input_controller from Globals.variables import Variables as V # VALUE [id, seed, dispersion, quantity, color, marker, noise] # VALUE IS IN FOR...
true
313d20b728e97c95f39db9736e9b94ba79427de7
Python
jwmcglynn/videosync
/server/tests/test_room.py
UTF-8
2,184
2.609375
3
[ "ISC" ]
permissive
from models.room import Room, NoSuchRoomException from models.user import User from database_create import database_create import database import os from nose.tools import * k_database = "test_db.sqlitedb" class TestRoom: @classmethod def setup_class(cls): database_create(k_database) database.con...
true
c5c65cf3ad052956230f8e598a68d70555f9e7c2
Python
ProfessorLinstar/Derivative-Program
/derive/functions/separateFunctions.py
UTF-8
2,535
2.515625
3
[ "MIT" ]
permissive
class Separate: def sepByAdd(inpSep,parOrder): sep = [""] numOfGroups=len(parOrder[1]) sepCounter = 0 if len(inpSep)==1: return inpSep par0List=[] for i in range(numOfGroups): if parOrder[1][i]==0: par0List.append(parOrder[0]...
true
bfdc1700b6ec4726a5ad66a360783b8316724427
Python
SurabhiP13/Open-CV
/Face_Recognition.py
UTF-8
818
2.578125
3
[]
no_license
import cv2 as cv import numpy as np haar_cascade=cv.CascadeClassifier('haar_face.xml') people=[] for i in os.listdir(r'D:\Documents\opencv\faces'): people.append(i) face_recognizer=cv.face.LBPHFaceRecognizer_create() face_recognizer.read('face_trained.yml') img=cv.imread(r'test\v.jfif') gray = cv.cvtColor(img, ...
true
0c997239e5fd497a3da4f535ae7fe7a3fbdaffb5
Python
zack28/Algorithms
/Searching/linear_search.py
UTF-8
383
3.84375
4
[]
no_license
def search(a,key): i=0 while i< len(a): if a[i] == key: return True globals()['pos']=i i=i+1 return False a=[] n=int(input("Enter No Of Elements in the list: ")) for i in range(0,n): ele=int(input()) a.append(ele) print(a[0]) key=int(input("Enter The No To Be Searched: ")) if searc...
true
e35fca0d33503c077f1416be36034d382b1b18e4
Python
haeriamin/Hybrid-Optimization
/ref.py
UTF-8
1,178
2.6875
3
[]
no_license
# Copyright (C) 2020 Amin Haeri [ahaeri92@gmail.com] import csv def get_exp(depth): time = 20;22 # Exp time [sec] 45/60 fr_exp = 62.5 # Sampling frequency [Hz] start_exp = 1 path = './input/' filename = 'weight_calibration.csv' f = open(path + filename, 'r') reader = csv.reader(f) ...
true
687b4909449877c13b0c21fbf8d85111a80063b8
Python
inthescales/lyres-dictionary
/src/models/environment.py
UTF-8
578
2.765625
3
[ "MIT" ]
permissive
class Environment: def __init__(self, anteprev, prev, next, postnext, object_specified=False): self.anteprev = anteprev self.prev = prev self.next = next self.postnext = postnext self.object_specified = object_specified def is_initial(self): return self....
true
65101f6ca5044f40b281b1c294aa0133b28b62d2
Python
Anjalipatil18/ListOfAllQuestion
/occurence_list.py
UTF-8
335
3.09375
3
[]
no_license
char_list = ["a", "n", "t", "a", "a", "t", "n", "n", "a", "x", "u", "g", "a", "x", "a"] new_list=[] i=0 while i<len(char_list): j=0 count=0 while j<len(char_list): if char_list[i] == char_list[j]: count=count+1 j=j+1 if [char_list[i],count] not in new_list: new_list.append([char_list[i],count]) i=i+1 ...
true
5f59ba658b763e6db4851d131133fef8bbae2667
Python
ustcerlik/rookie2veteran
/frcnn/nms_.py
UTF-8
3,426
3
3
[]
no_license
import numpy as np class Nms(object): def __init__(self, threshold, topk): super(Nms, self).__init__() self.threshold = threshold self.topk = topk def nms_core(self, b_boxes, scores): """ b_boxes 排序, 按照scores, mapping: index的映射 注意:nms其实是对每个类别都要做,即类别之前是独立的,就是说如...
true
d22725cfb849159ac5a845206db32fed3e902e76
Python
vincentmader/statistical_physics
/10/code/task02b.py
UTF-8
271
3.296875
3
[]
no_license
import matplotlib.pyplot as plt import numpy as np from numpy import cosh, sinh def M(x): return cosh(x)/sinh(x) - 1/x x = np.linspace(0, 100) plt.plot(x, M(x)) plt.xlabel(r'$x$') plt.ylabel(r'$\coth(x)-\frac{1}{x}$') plt.savefig('../figures/magnetization.pdf')
true
f48927dba402df6e9e51d6418022511acf932566
Python
flance3032021/car_delivery
/app.py
UTF-8
3,483
2.953125
3
[]
no_license
import streamlit as st from geopy.geocoders import Nominatim from geopy.distance import geodesic geolocator = Nominatim(user_agent="car_price") st.set_page_config(page_title= 'Car Delivery Price Calculation Project', initial_sidebar_state = 'auto') hide_streamlit_style = """ <style> #MainMenu {visibility: hidden;} foot...
true
83d4a0f4ebc6bddd1642d93c470342ef3b83a3bf
Python
saibi/python
/ekiss/ekiss_login.py
UTF-8
8,741
2.59375
3
[]
no_license
#!/usr/bin/python3 import requests from bs4 import BeautifulSoup as bs import random import sys from datetime import datetime import time Header = { 'Referer' : 'http://ekiss.huvitz.com/', 'User-Agent' : 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:63.0)' } Agent_list = [ 'Mozilla/5.0 (X11; Ubunt...
true
3dce9f881a39e055c9be6ac5da13a6912a46c104
Python
jafriyie1/ML-GPS-Research-
/first_model.py
UTF-8
4,736
2.78125
3
[]
no_license
import tensorflow as tf import pandas as pd import numpy as np from sklearn import preprocessing # importing data and munging constant_data = pd.read_csv('full_library_xt875.csv') #normalizing data #normalization = lambda df: (df - df.mean()) / (df.max() - df.min()) #constant_data = normalization(constant_data) t_dat...
true
ae90bf14a93511c1a961ea67081cd15a730faf34
Python
FuckBrains/petrovich
/apps/bot/commands/ExchangeRates.py
UTF-8
2,220
2.796875
3
[ "MIT" ]
permissive
from apps.bot.APIs.CBRAPI import CBRAPI from apps.bot.classes.Exceptions import PWarning from apps.bot.classes.common.CommonCommand import CommonCommand class ExchangeRates(CommonCommand): name = "курс" help_text = "курс валют" help_texts = [ "- курс валют", "[количество=1] (валюта) - пере...
true
225ea764376babfbc29d48122f211da0a540aed8
Python
chrisemerson/adventOfCode
/2017-Python/day2/day2.py
UTF-8
440
3.203125
3
[]
no_license
spreadsheet = open('input.txt', 'r') total = 0 totalpt2 = 0 with spreadsheet as fp: for line in fp: numbers = list(map(int, line.strip().split("\t"))) total += max(numbers) - min(numbers) for number in numbers: for innernumber in numbers: if number > innernumbe...
true
08ea63de78d8b308bb921a4450d5ac58c2a4db1f
Python
LLCampos/pcrawler
/join_data.py
UTF-8
2,015
3.140625
3
[]
no_license
import json import os import time # pdata -> passatempos data def join_pdata(): """Joins all .json files resulting from the crawling into just one, called complete.json. Each higher-level name of this json is a string representing the name of a website and the corresponding value is a list of 'passa...
true
98d16a55576eceb16dd9dc39df3566edf32829df
Python
Ayseekinci/Python
/Python Temelleri/python object based programming/class1.py
UTF-8
1,014
4.0625
4
[]
no_license
# Kullanıcıdan kısa kenarı alıp uzun kenarıda=18 alıp dikdörtgenin çevresini ve alanını hesaplanması class dikdortgen: kisakenar = int(input("Kısa kenar : ")) def __init__(self, uzunkenar=18): self.uzunkenar = uzunkenar def cevre_hesapla(self): return 2*(self.kisakenar+self.uzunkenar) ...
true
df2c85ebb59959d2d78d04d48639fa6ea7190f5d
Python
lolsborn/python-testdata
/testdata/factories/statistical.py
UTF-8
2,799
3.484375
3
[ "MIT" ]
permissive
import math import random from ..base import Factory from ..errors import InvalidTotalPrecentage from .generic import Constant class StatisticalPercentageFactory(Factory): """ Returns a different value a precentage of a time. :param factories: a list of 2 item tuples. each tuple contains The Factory that ...
true
3922f33c0b3f234c5e55ce709b679d51acd5e9c9
Python
mattermost/mattermost-data-warehouse
/utils/twitter_mentions.py
UTF-8
4,590
2.671875
3
[]
no_license
import os import pandas as pd import tweepy from tweepy import OAuthHandler from extract.utils import execute_query, snowflake_engine_factory def get_twitter_mentions(): # Twitter credentials # Obtain them from your twitter developer account # Need to add this or another Twitter Developer API Key to Sy...
true
be581e5c2ec87ed06181ffdd9ec7c82b846ee658
Python
HodAlpert/Randomized
/run.py
UTF-8
3,730
3.1875
3
[]
no_license
import os from datetime import datetime from multiprocessing import Pool import networkx as nx from matplotlib import pyplot as plt from algorithm import ApproximateDistanceOracles from common import timeit, average_difference, avg def draw(G): pos = nx.spring_layout(G) # positions for all nodes # nodes ...
true
fae9c4ca1a8a0bb804b1e6aeb47d523b188490cf
Python
bleist88/MCC
/Create.py
UTF-8
2,130
2.734375
3
[]
no_license
""" MCC/Create.py This contains the function MCC.create() which creates a new FITS Cube from the configurations files. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals from .__imports__ import * ...
true
7a55363db7a2827a62f8879f5a95e9d5515d51a2
Python
Randeepk1/OPENCV
/TEMPLATE_MATCHING1.py
UTF-8
1,290
2.546875
3
[]
no_license
#!/usr/bin/env python # coding: utf-8 # In[13]: import cv2 import numpy as np import matplotlib.pyplot as plt from matplotlib import cm # In[14]: # img = cv2.imread("m2.jpg",0) img2 = cv2.resize(img,(75,110),3) template = img[40:150,100:175] plt.imshow(img) # template = cv2.imread("m1.jpg",0) # plt.subplot(111);...
true
2944b74e05814ae3c29c0b3e578aba21bb8d109c
Python
akimi-yano/algorithm-practice
/lc/743.NetworkDelayTime.py
UTF-8
7,705
3.28125
3
[]
no_license
# 743. Network Delay Time # There are N network nodes, labelled 1 to N. # Given times, a list of travel times as directed edges times[i] = (u, v, w), # where u is the source node, v is the target node, and w is the time it takes # for a signal to travel from source to target. # Now, we send a signal from a certain ...
true
ea1594ce9e6daf16360f8992e4db2c318b995679
Python
koenigscode/python-introduction
/content/partials/working_with_files/with_context_manager.py
UTF-8
229
3.15625
3
[]
no_license
with open("file.txt", "r") as f: content = f.read() print(content) print(f"The file is {'closed' if f.closed else 'open'}") # outside the context manager print(f"The file is {'closed' if f.closed else 'open'}")
true
eeac0a0df4aebdf5670ff37d7e188538d0115dbe
Python
fatgenius/tensorflow_selfstudy
/p1.py
UTF-8
523
2.78125
3
[]
no_license
import tensorflow as tf import numpy as np x_data = np.random.rand(100) y_data =x_data*0.1+0.2 #build linear model b= tf.Variable(5.) k= tf.Variable(0.) y=k*x_data+b #build a match loss= tf.reduce_mean(tf.square(y_data-y)) #build optimizer optimizer =tf.train.GradientDescentOptimizer(0.2) #build mini match trai...
true
d298b4bcdf7832d80637cc576dc1470196e286d1
Python
geunhee725/snubioinfo-TermProject
/gen-candidates.py
UTF-8
2,637
2.921875
3
[]
no_license
#!/usr/bin/env python3 # # Copyright (c) 2015 Hyeshik Chang # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modi...
true
72d6bf219c5bb0300dc72443dedb5c3ec1bfbd46
Python
miladbohlouli/Pytorch-Tutorials
/Intermediate/CNN.py
UTF-8
3,613
2.84375
3
[]
no_license
import torch import numpy as np import os import torch.nn as nn from torchvision.transforms import transforms from torch.utils import data import torchvision from tqdm import * batch_size = 64 num_epochs = 1 save_dir = "save/" learning_rate = 0.001 load = True train_dataset = torchvision.datasets.MNIST("../datasets",...
true
bb363a932ba63d648a9018a12df48efd56afe5d6
Python
haruyasu/LeetCode
/1_array_and_strings/find_pivot_index.py
UTF-8
461
3.40625
3
[]
no_license
class Solution: def pivotIndex(self, nums): """ :type nums: List[int] :rtype: int """ total = sum(nums) left_sum = 0 for i, num in enumerate(nums): if left_sum == (total - left_sum - num): return i left_sum += num ...
true
4c5cda3c2267f59b9928292e3031de2c5e10dc85
Python
pbarden/python-course
/Chapter 5/printf_string.py
UTF-8
77
3.015625
3
[]
no_license
user_word = 'Amy' user_number = 5 print('%s,%d' % (user_word, user_number))
true
e4ad240a085c38a076f0be842bcb893e2265e1fc
Python
tlingf/bluebook
/mean.py
UTF-8
227
2.703125
3
[]
no_license
import pandas as pd import numpy as np import sys fn = sys.argv[1] data = pd.read_csv(fn) print data print "mean", np.mean(data["SalePrice"]) data = pd.read_csv('Train.csv') print "mean of Train", np.mean(data["SalePrice"])
true
1f387bde3c85fc89f4d8816492d291b7e14b7e57
Python
DiksonSantos/Curso_Intensivo_Python
/Pagina_272_Faça_Você_Mesmo.py
UTF-8
1,809
3.125
3
[]
no_license
''' #9.10 Importando Restaurant #import MODULO_Classe_Restaurante_ from MODULO_Classe_Restaurante_ import * #Só funcionou Assim :/ ??? MamaMia = Restaurant("Lanchonete", "Tapioca") print(MamaMia.name) print(MamaMia.cuisine_type) ''' #9.11 -> Importando ADMIN #from MODULO_Admin import * #Hora Só f...
true
56052746ff0e5c8bdc3b6dc21b58ea9b85d7b3ab
Python
AlJohri/chromedevtools
/chromedevtools/debugger.py
UTF-8
3,693
2.546875
3
[]
no_license
""" Debugger Debugger domain exposes JavaScript debugging capabilities. It allows setting and removing breakpoints, stepping through execution, exploring stack traces, etc. https://developer.chrome.com/devtools/docs/protocol/1.1/debugger """ from __future__ import absolute_import, division, print_function, unicode_...
true
31f56e2961ad5135ecec68189f9e5f0dd4d05e0d
Python
gregmolskow/MarsRover
/RasPi/i2cCom.py
UTF-8
3,520
3.109375
3
[]
no_license
import smbus import time #Functions class SetupError(Exception): pass class PowerControlError(Exception): pass class i2cCom(object): #This class sets up the i2c communications systems for a single device. The only shared variable #between object instances is the "bus" variable which will not chn...
true
f57a47d0d83e0fea4023edf3dde5c8fe7e4d027e
Python
utsuke/ddssj
/data/type_detail.py
UTF-8
559
2.640625
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- import urllib def _print(data): if isinstance(data, unicode): data = data.encode('utf-8') # print data return data.strip() if __name__ == '__main__': type_data = {} count = 0 for line in open('type_detail.txt'): if not line.startswith('#'): ...
true
dd85880bc8a52a17be5162a674750c397fe179eb
Python
Synectome/WorkTimer
/Curtain.py
UTF-8
3,569
2.765625
3
[]
no_license
import os import csv import datetime class states: init_time = 0 init_break = 0 on_break = False timing_on = False since_start = False time_mod = False def task_submition(state, root_or_start=False, entr1=False, entr2=False): logtime = datetime.datetime.now().strftime("%d/%m/%Y %H:%M:%S"...
true
51067e2442661658d141e677dbcdea92faf5ce6d
Python
Fantomster/py
/deep_learning/validation/k-fold_cross-validation.py
UTF-8
683
2.5625
3
[]
no_license
k = 4 num_validation_samples = len(data) // k np.random.shuffle(data) validation_scores = [] for fold in range(k): validation_data=data[num_validation_samples * fold: num_validation_samples * (fold + 1)] training_data=data[:num_validation_samples * fold] + data[num_validation_samples * (fold + 1):] model...
true
d6b876029ff06c573fee187f1cb00315e3f97207
Python
ayouubeloua/PFE-BD
/Platform-Bigdata/dev/twitter_prod.py
UTF-8
1,701
2.578125
3
[]
no_license
import tweepy import json import time from kafka import KafkaProducer def json_encod(data): return json.dumps(data).encode('utf-8') def search_for_hashtags(consumer_key, consumer_secret, access_token, access_token_secret, hashtag_phrase): #create authentication for accessing Twitter auth = tweepy.OAuthHandle...
true
8dcf3c903cc484a307beaf8257b3808005173c3f
Python
rbaral/PythonDataAnalysis
/edu/fiu/rb/pandas/testgroup.py
UTF-8
4,243
3.546875
4
[]
no_license
__author__ = 'rbaral' #ref:http://www.shanelynn.ie/summarising-aggregation-and-grouping-data-in-python-pandas/ ''' Analyze the US baby names from the SSA dataset. Can be used to analyze for different metrics as provided in https://www.ssa.gov/oact/babynames/decades/names2010s.html ''' ''' TODOS: 1) given a year, find...
true
d5a6910f3c94cb0ba38711ef27f547e83f598755
Python
Abhi24krishna/Semantic-Code-Clone-Detection
/test_case_1.py
UTF-8
170
3.046875
3
[]
no_license
a = 235 b = 51 c = a p = a < b q = a < c if p: y=0 print(y) if q: x=2 print(x) else: l=3 print(l) a = 235 b = 51 c = 47 print(a,b,c)
true
fba0210cfd50112892b763f2b080c740e2f18d05
Python
k-takata/minpac
/tools/dl-vim-kt.py
UTF-8
4,565
2.65625
3
[ "MIT", "Vim" ]
permissive
#!/usr/bin/python3 # Download the latest vim-kt from the GitHub releases import argparse import calendar import io import json import os import sys import time import urllib.request, urllib.error # Repository Name repo_name = 'k-takata/vim-kt' gh_releases_url = 'https://api.github.com/repos/' + repo_name + '/release...
true
b5bd50171776c66f31a749b2d6ba90fcc57204c2
Python
jacobandreas/bright
/brightengine.py
UTF-8
3,685
3
3
[]
no_license
from math import * from numpy import * class World(object): def __init__(self, dimensions, c): self.dimensions = dimensions self.c = c def AddVelocities(self, v1, v2): if not v2.any(): return v1 par = dot(v1, v2) / dot(v2, v2) * v2 perp = v1 - par ...
true
dd381e6b8253cfeaffd129024ad8343a0c3e6bfb
Python
juranga/ntps
/Infrastructure/PacketLibrary/Packet.py
UTF-8
5,034
2.8125
3
[]
no_license
from Infrastructure.PacketLibrary.Dissector import Dissector from collections import defaultdict from scapy.all import * """ As it currently stands, the Ether layer has to be dissected in a different way than every other layer. This is because the Ether class in scapy does not have a "haslayer" function, and thus must...
true
d76ba238499b268a22c20d609340ae641981ac9b
Python
forhadmethun/my-data-structure
/linked_list/CircularLinkList.py
UTF-8
774
3.859375
4
[]
no_license
class Node: def __init__(self, data = None): self.data = data self.next = None class CircularLinkList: def __init__(self): self.head = None def insert(self,data): self.newNode = Node(data) if(self.head == None): self.head = self.newNode se...
true
89fa1821722bbf711698dd0c8b4ce0fcbfb94112
Python
burglarhobbit/machine-reading-comprehension
/S-NET/nmt_snet_ans_syn/nmt/analyze_dataset_2.py
UTF-8
19,361
3.0625
3
[ "Apache-2.0" ]
permissive
import tensorflow as tf import random from tqdm import tqdm import spacy import json from collections import Counter import numpy as np from nltk.tokenize.moses import MosesDetokenizer import string import re nlp = spacy.blank("en") def word_tokenize(sent): doc = nlp(sent) return [token.text for token in doc] def ...
true
bf5d18d9dd89a0fed88bac64d6aaf8d1a261d678
Python
KimKeunSoo/Algorithm
/Programmers/해쉬/Level2_전화번호 목록/solution.py
UTF-8
297
2.796875
3
[]
no_license
def solution(phone_book): for index1, num in enumerate(phone_book): for index2, num_punk in enumerate(phone_book): if index1 == index2: continue else: if num_punk.startswith(num): return False return True
true
004655b01e807dc4066fc9b9119123dc12b0c48a
Python
coderguanmingyang/LeetCode-GMY
/Group-Anagrams.py
UTF-8
1,118
4.21875
4
[]
no_license
# -*- coding:utf-8 -*- ''' Given an array of strings, group anagrams together. Example: Input: ["eat", "tea", "tan", "ate", "nat", "bat"], Output: [ ["ate","eat","tea"], ["nat","tan"], ["bat"] ] Note: All inputs will be in lowercase. The order of your output does not matter. ''' ##Solutio...
true
7ac3e170a6cf9940b4d20e9b937f40c9e2a30844
Python
simpleoier/espnet
/egs2/reazonspeech/asr1/local/data.py
UTF-8
1,543
2.671875
3
[ "Apache-2.0" ]
permissive
import os import sys from datasets import load_dataset from reazonspeech.text import normalize def save_kaldi_format(outdir, ds): os.makedirs(outdir, exist_ok=True) with open(os.path.join(outdir, "text"), "w") as fp_text, open( os.path.join(outdir, "wav.scp"), "w" ) as fp_wav, open(os.path.join(o...
true
b544f47b8da6f4173f6c854ae95f37a3baae5704
Python
vidyasagarr7/DataStructures-Algos
/GeeksForGeeks/Arrays/SmallestPositiveMissing.py
UTF-8
2,671
3.78125
4
[]
no_license
""" Find the smallest positive number missing from an unsorted array You are given an unsorted array with both positive and negative elements. You have to find the smallest positive number missing from the array in O(n) time using constant extra space. You can modify the original array. """ def segregate(input_list)...
true
2c75e109fe62bf8670aa70b31059385f9b80da6a
Python
NPScript/pysqrt
/pysqrt/__init__.py
UTF-8
2,989
3.59375
4
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- class sqrt: def __init__(self, number, max): """ Documentation of the algorithm can be found here: https://en.wikipedia.org/wiki/Shifting_nth_root_algorithm """ self.max = max # set maximal size after t...
true
3fdfdf01b40c695dc0071b4a6bcc8b9de6f66690
Python
marceltoben/evandrix.github.com
/py/django_tools/feincms/feincms/utils/__init__.py
UTF-8
7,341
2.671875
3
[ "BSD-2-Clause" ]
permissive
# ------------------------------------------------------------------------ # coding=utf-8 # ------------------------------------------------------------------------ """ Prefilled attributes ==================== The two functions prefilled_attribute and prefill_entry_list help you avoid massive amounts of database qu...
true
17cf71b86ca9a88299bd3245617b5a779bf1bf82
Python
RozenAstrayChen/ML-course
/ex1/ex1_1.py
UTF-8
1,233
3.421875
3
[]
no_license
import numpy as np import pandas as pd import matplotlib.pyplot as plt from linear_reg import computeCost, gradientDescent, predict data = pd.read_csv('ex1data1.txt', header = None) #read from dataset X = data.iloc[:,0] # read first column y = data.iloc[:,1] # read second column m = len(y) # number of training example...
true
9098c02fe54a113e8df065b19ba4edd2cdb9a682
Python
fusichang107117/image_utils
/read_mp4.py
UTF-8
3,962
2.78125
3
[]
no_license
import cv2 import os def get_frames_by_second(video_path, start = 0, end = 0, interval = 0, width = 0, height = 0): cap = cv2.VideoCapture(video_path) # Find OpenCV version (major_ver, minor_ver, subminor_ver) = (cv2.__version__).split('.') fps = 0 if int(major_ver) < 3: fps = cap.get(cv2.c...
true
934689e2fe58eba112e8ba1ba9c48abf05777868
Python
Lyther/Gomoku
/tools/convert.py
UTF-8
717
2.90625
3
[]
no_license
import generate SIZE = 15 def main(content): steps = [] pre_index = 0 index = 0 for i in content: if i >= 'a' and i <= 'z': if index == 0: pass else: steps.append(content[pre_index:index]) pre_index = index index += 1 steps.append(content[pre_index:index]) output(steps) def output(steps): ...
true
ea64170da29cca45df1d4f3ea069af1ff30787b3
Python
tjwudi/pythonic
/jsontest.py
UTF-8
80
2.84375
3
[]
no_license
import json x = { 'y': [1, 2, 3], 'z': 'Hello' } print json.dumps(x)
true
57103851feea037858c81147f8e64a0bec16c9d6
Python
christian-miljkovic/jarvis
/jarvis/crud/items.py
UTF-8
2,892
2.84375
3
[]
no_license
from asyncpg import Connection from typing import List, Union from jarvis.models import Beer, Wine, Liquor async def create_item( conn: Connection, item: Union[Beer, Liquor, Wine] ) -> Union[Beer, Liquor, Wine, None]: item_type = str(item) model_mapping = {"beer": Beer, "wine": Wine, "liquor": Liquor} ...
true
80ab0c2c6cf91ba33526acc185234ef0ec5421d6
Python
sommerpi/mappee-web-map
/mappee-web-map.py
UTF-8
1,764
3.0625
3
[]
no_license
import folium import pandas # load volcanoes data DATA = pandas.read_csv("volcanoes.txt") LAT = list(DATA["LAT"]) LON = list(DATA["LON"]) ELEV = list(DATA["ELEV"]) NAME = list(DATA["NAME"]) # create map MAP = folium.Map(location=[38.58, -99.09], zoom_start=5, tiles="Stamen Terrain") # produce colour based on elevati...
true
49f6744864fa649a6bff08d4aea03c9c7d6743f6
Python
kiboliu/Small-Programs
/Snake/game.py
UTF-8
7,455
3.25
3
[]
no_license
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Sun Nov 26 17:50:40 2017 @author: liuzhangqian """ import random, sys, time, pygame from pygame.locals import * #screen refresh rate, equal to the move speed of snake FPS = 5 WINDOWWIDTH = 640 WINDOWHEIGHT = 480 #size of grid CELLSIZE = 20 assert WINDO...
true
14aa25c3fdc60f1732509ba005e1f01376b02e04
Python
mayur2402/python
/PFile.py
UTF-8
189
3.125
3
[]
no_license
print("Enter file name") name = input() fp = open(name,"w+") print("Enter data to store in file") Adata = input() fp.write(Adata) pos = fp.seek(0,0) Ddata = fp.read(len(name)) print(Ddata)
true
e7d79dc84d9ec39220e9da882757f7c220122f55
Python
ruizhang84/full-stack-udacity
/catalog/lotsofitems.py
UTF-8
1,124
2.71875
3
[]
no_license
from sqlalchemy import create_engine, desc from sqlalchemy.orm import sessionmaker from datetime import datetime from db_catalog import Base, Category, Item, User engine = create_engine('sqlite:///catalog.db') Base.metadata.bind = engine DBSession = sessionmaker(bind=engine) session = DBSession() category1 = Categor...
true
0538ccdbfdaf9aa8c5014141baaebfb25c07a7da
Python
paulmwangi556/Object-Oriented-Programming-II
/Quizzes/Python_Loops_Quiz/grading_system.py
UTF-8
550
3.71875
4
[ "Unlicense" ]
permissive
print( """ GRADING SYSTEM (enter q to quit) """ ) def start(): score = input("Enter Score: ") if score.lower() == 'q': pass else: score = int(score) if score in range(70, 100): print("Grade: A") start() elif score in range(60, 69): print("Grade: B") start() elif score in range(50, 59): ...
true
a475a3d44f56f236afd0708738793231d6d3915b
Python
sail-y/python
/base/fileOp/fileTest.py
UTF-8
793
2.921875
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = 'xiaomai' f = open('/Users/xiaomai/test.txt', 'r') for line in f.readlines(): print(line.strip()) # 把末尾的'\n'删掉 f.close() try: f = open('/Users/xiaomai/test.txt', 'r') print f.read() finally: if f: f.close() # with语句来自动帮我们调用close()方法:...
true
d59678ed478cc71c391ea982c1dfaa4843dab754
Python
LXiong/PythonNetwork
/chapter1/1_13b_echo_client.py
UTF-8
870
3
3
[]
no_license
import socket import argparse import sys host = 'localhost' def echo_client(port): """A echo client""" # Create a TCP/TP client try: sock = socket.socket(socket.AF_INET,socket.SOCK_STREAM) server_address = (host,port) sock.connect(server_address) data = 'Hi,I\'m echo client...
true
84ff7bbf494788a7f29fe52b99127ec849a1332e
Python
hector81/Aprendiendo_Python
/Archivos/txt/Ejercicio_Dia3.py
UTF-8
3,832
3.625
4
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
# FUNCIONES def introducirNumero(): while True: try: opcion = int(input("Por una opción: ")) if opcion > 0 and opcion < 6: return opcion break else: print("Las opciones son del 1 al 5") except Value...
true
aecc3f0cc1ec54c64d094203e35bf36245c5d5d1
Python
lostarray/LeetCode
/204_Count_Primes.py
UTF-8
1,119
3.703125
4
[]
no_license
# Description: # # Count the number of prime numbers less than a non-negative number, n. # # Tags: Hash Table, Math # Difficulty: Easy class Solution(object): def countPrimes(self, n): """ :type n: int :rtype: int """ if n <= 2: return 0 prime = [True] ...
true
96fdbc7537410d8f968fd1a7fa53799461899eff
Python
anguyener/reu2018
/face_processor.py
UTF-8
869
2.625
3
[]
no_license
import cv2 as cv import os from converter import createCSV def processFaces(img_dirs): image_width = 48 d = int(image_width/2) for dir in img_dirs: for img_file in os.listdir(dir): img = cv.imread(os.path.join(dir, img_file), 0) top_left = img[0:d, 0:d] cv.imwri...
true
ae74b1bd07c4986e5effd664fee99ed87a187fe1
Python
palmerjh/Leiter-Summer-2016
/sim_alg_analyses/algorithm_comparison.py
UTF-8
2,814
3.203125
3
[]
no_license
import numpy as np import csv trials = 100 n = 100 # creates random matrix from two-humped distribution skewed towards 0.0 and 1.0 def randMatrix(): #return np.matrix(np.random.rand(n,n)) m = np.matrix(np.random.normal(0.0,0.25,n**2)) for j in range(n**2): e = m.item(j) if e < 0: ...
true
34ebb4419bf7deaa5d5076f6d2df0c63df9c3e33
Python
kerrblackhole/Leetcode-Code-Backup
/spiral-matrix/spiral-matrix.py
UTF-8
1,061
2.984375
3
[]
no_license
class Solution: def spiralOrder(self, matrix: List[List[int]]) -> List[int]: out = [] while len(matrix) > 0: for i in range(4): if i == 0: for i in matrix[0]: out.append(i) del matrix[0] elif ...
true
7b5650a0ce53ab096c3c5c90bec52303fa4ac874
Python
gourxb/RBI-ML-course
/Day 2/perceptron.py
UTF-8
607
3.03125
3
[]
no_license
import numpy as np from matplotlib import pyplot as plt from sklearn.linear_model import Perceptron X = np.array([ [0, 0], [0, 1], [1, 0], [1, 1] ]) Y = np.array([0, 1, 1, 0]) clf = Perceptron(tol=1e-3, random_state=23, max_iter=3, penalty='l1') clf.fit(X,Y) print(clf.predict([[0...
true
cfd27799c66f0e86f10cb338e897a4041d5f9e24
Python
WladimirTavares/fup
/busca_binaria/busca_binaria/busca_binaria.py
UTF-8
616
3.59375
4
[]
no_license
def busca_binaria(vetor, n, item): inicio = 0 fim = n - 1 contador = 0 while inicio <= fim: meio = (inicio + fim)//2 contador = contador + 1 #print ("inicio %d, fim %d, meio %d, contador %d" % (inicio, fim, meio, contador) ) if vetor[meio] == item: return contador e...
true
d6fb133ee2540ecb2f126be709a4e96c9a9d6cbf
Python
JonathanLaneMcDonald/maigo
/game.py
UTF-8
1,009
2.5625
3
[]
no_license
class GameStatus: in_progress = 0 player_1_wins = 1 player_2_wins = 2 nobody_wins = 3 killed = 4 class TeachableGame: @staticmethod def get_feature_dimensions(): raise Exception("not implemented") @staticmethod def get_action_space(): raise Exception("not implemented") @staticmethod def get_name()...
true
572e5233d8f5b1fe9ca6d60888cd2c50b86af27c
Python
flaviapb/Jogos
/Jogo Advinhação/jogoadvinhacao.py
UTF-8
1,236
4.125
4
[]
no_license
"Desenvolvido por Flávia" from random import randint print('''============================================================================================= \n Olá usuário, eu sou o computador, e quero interagir um pouco com você!! Dica: Vou pensar num número de 0,10, topa advinhar??? \n ====...
true
d2c5285e16c998f872d19210c421803ad0182b02
Python
marblefactory/RRN_Test
/real_data_example/dataset.py
UTF-8
1,937
3.28125
3
[]
no_license
import gspread from oauth2client.service_account import ServiceAccountCredentials from typing import List from abc import abstractclassmethod import numpy as np class Dataset: """ Represents a collection of data and its corresponding target category. """ # An array containing an array of words in eac...
true
41691242911da09a2c142a369cdceb881c9a85c6
Python
FrozenYogurtPuff/transformers-ner
/examples/app.py
UTF-8
588
2.796875
3
[]
no_license
from infer_softmax_ner import predict from flask import Flask, request app = Flask(__name__) @app.route('/api/predict', methods=['POST']) def main(): if request and request.is_json: data = request.json else: data = [{'sent': 'Teacher Y asks student A to fill out a loan form and write down th...
true
1d67549ec083cfb238151e0a2ecdc952d5fda275
Python
pepsionly/ssserver
/application/redisclient/model/__init__.py
UTF-8
1,195
2.953125
3
[]
no_license
import abc import json from json import JSONDecodeError import redis class RedisColumn: def __init__(self, no_null=False): self.no_null = no_null class RedisModel(abc.ABC): obj = {} def __init__(self, obj): """ @param obj: """ self.obj = obj assert (sel...
true
7c7b710911a3cf8c7b6b8039e045f1bcf78a0fba
Python
AymunTariq/AI-Labs
/Lab2.py
UTF-8
2,283
3.375
3
[]
no_license
import numpy as np import math class Complex(): def __init__(self, r, i): self.Real = r self.Imaginary = i def magnitude(self): mag = math.sqrt((self.Real)**2 + (self.Imaginary)**2) return print(mag) def orientation(self): if(self.Imaginary ==0): print("...
true
c53db22ae5920adae1bb47a85b82e9d2f690158b
Python
timpark0807/self-taught-swe
/Algorithms/Leetcode/535 - Encode and Decode TinyURL.py
UTF-8
1,241
3.640625
4
[]
no_license
import secrets class Codec: """ long2short = {url:hash} short2long = {hash:url} long_url = https://leetcode.com/problems/design-tinyurl short_url = http://tinyurl.com/4e9iAk 1. Take long url ex: https://leetcode.com/problems/design-tinyurl 2. Create a hash, associate...
true
2e0f3e8d7a724fe02c27a44ef4de31187bbdc30c
Python
ccrain78990s/Python-Exercise
/0330 測驗及資料庫SQL指令/0330期中小測驗/02-while5x5.py
UTF-8
183
3.859375
4
[ "MIT" ]
permissive
x=1 while x<=5: print(x) y = 1 while y <=5: print(y) print(x, "*", y, "=", x * y) # 只要x等於4 y等於4 就不印 y = y + 1 x = x + 1
true
08fae614c3df91f91f6788b56fedd9bc160759ba
Python
benjaminhuanghuang/ben-leetcode
/1415_The_k-th_Lexicographical_String_of_All_Happy_Strings_of_Length_n/solution.py
UTF-8
288
2.859375
3
[]
no_license
''' 1415. The k-th Lexicographical String of All Happy Strings of Length n Level: Medium https://leetcode.com/problems/the-k-th-lexicographical-string-of-all-happy-strings-of-length-n ''' ''' Solution: ''' class Solution: def getHappyString(self, n: int, k: int) -> str:
true
83c14a5eed99cdabbbd8883b95269692589c55d5
Python
aviaryapi/AviaryFxPython
/example/cgi-bin/AviaryFX.py
UTF-8
14,425
2.734375
3
[]
no_license
''' AviaryFX Python SDK @version: 1.0 @author: Bruce Drummond @contact: http://www.aviary.com ''' import time import hashlib import urllib import urllib2 from xml.dom import minidom import os from urllib2 import URLError class AviaryFX(object): ''' Class holding the methods to use the AviaryFX API - upload, ...
true
1e3e1dbe2ea4953613620feccc09773e53ccb70a
Python
cwishart1/Ops301d2-Challenges
/Challenge6-printTree
UTF-8
629
3.765625
4
[]
no_license
#!/usr/bin/env python3 # Script Name: Challenge6-printTree # Class Name: Ops 301 # Author Name: Cody Wishart # Date of latest revision: 3/9/21 # Purpose: Use os walk to print dir tree # Import Library import os # Declaration of variables u...
true
a6cf0d71a3aa3467be4d8ef54f4a02730113c997
Python
dykim822/Python
/ch04/lotto2.py
UTF-8
249
3.34375
3
[]
no_license
from random import randint lotto = set() # 중복 안되게 하기 위해 set while len(lotto) < 6: ran = randint(1, 45) # 1 ~ 45 사이의 정수 random 생성(1, 45도 포함) lotto.add(ran) print("로또번호 : ", sorted(lotto))
true
10447f4867d69b05d81e630c761afb0109b2d42b
Python
zzhwang/docker_file
/kafaka/project/producer.py
UTF-8
586
2.546875
3
[]
no_license
from confluent_kafka import Producer import requests #producer配置,dict格式 p = Producer({'bootstrap.servers':'192.168.1.88:19092,192.168.1.88:29092,192.168.1.88:39092'}) #回调函数 def delivery_report(err, msg): if err is not None: print('Message delivery failed: {}'.format(err)) else: print('Message ...
true
1c63070e0089979e48457c5dbad66aaed781797e
Python
veraxrl/the-sheldon-machine
/lstm.py
UTF-8
1,970
2.875
3
[ "Apache-2.0" ]
permissive
import torch import torch.nn as nn import torch.autograd as autograd import torch.nn.functional as F from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence from model_embeddings import ModelEmbeddings class LSTMClassifier(nn.Module): def __init__(self, vocab, embed_size, hidden_size, output_size,...
true
0b3ddc8c5c7285e03b7d2a941bf2232b79bcd4e2
Python
17mcpc14/recommend
/4step/strip.py
UTF-8
525
2.5625
3
[]
no_license
import glob import sys def read_raw(): f = open('quarterly-data/2005-3') lines = f.readlines() lines.pop(0) f.close() new_file = 0 for line in lines : individual_rating = line.split(",") userid = individual_rating[1] movieid = individual_rating[0] r...
true
4bc51dcda8d452fa58996bd93d7dfb14656c8324
Python
DarkHian/Parcial
/ejercico ex1-parametros.py
UTF-8
642
3.796875
4
[]
no_license
# -*- coding: utf-8 -*- """ Created on Tue Mar 23 18:58:32 2021 @author: Brahian """ def mostrar_mayor(v1,v2,v3,v4): print("El valor mayor de los tres numeros es") if v1>v2 and v1>v3: print(v1) else: if v2>v3 and v2>v4: print(v2) else: ...
true
51fe0e54e9f4edc9c8aab7e8ce60261b022b0d05
Python
cgmoganedi/PythonBasics
/a_Python3.6Essentials/1.4 - data analysis with pandas/pandas-0.3.py
UTF-8
302
3.015625
3
[]
no_license
import numpy as np import pandas as pd # working with 3D data randItems1 = np.random.randn(4, 3) randItems2 = np.random.randn(4, 2) dataDict = { 'item1': pd.DataFrame(randItems1), 'item2': pd.DataFrame(randItems1) } dataPanel = pd.Panel(dataDict) print(dataPanel) print(dataPanel['item2'])
true
fcfdfd4042093757d33993872a0890859825b000
Python
shuw/nengo
/simulator-ui/python/nef/functions.py
UTF-8
2,887
2.5625
3
[]
no_license
from ca.nengo.math.impl import AbstractFunction, PiecewiseConstantFunction class PythonFunction(AbstractFunction): serialVersionUID=1 def __init__(self,func,dimensions=1,time=False,index=None,use_cache=False): AbstractFunction.__init__(self,dimensions) PythonFunctionCache.transientFunctions[sel...
true