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
f273dcddcf73799aac416368e958e5bdb4aebc06
fanshaoze/uctGym
/uctPlanner.py
UTF-8
5,905
2.765625
3
[]
no_license
import sys import math import random import uct import datetime class ToyState(uct.State): def __init__(self, _x, _y, _food): self.x = _x self.y = _y self.food = _food def equal(self, state): if isinstance(state, ToyState): if state.x != self.x or state.y != self.y...
true
edbcc70cac884212e90ce2a06c89fe40384c8eb5
Sharm-Zhao/Practice_3D_U-net
/TF.py
UTF-8
509
3.703125
4
[]
no_license
import torch # 首先,新建一个三维的tensor a = torch.tensor([[[3, 3, 3], [3, 3, 3], [3, 3, 3], [3, 3, 3]]]) # 打印出它的形状,这里它的形状为(1,4,3) print(a.shape) # 对该tensor进行维度变换,根据我上面文字详细说的那样 b = a.permute(2, 0, 1) # 打印出变换后a的形状,形状变为(3,1,4) print(b.shape) # a.permute(2,0,1) # b=a.permute(2,0,1) # #打印出变换后a的形状 # print(b.shap...
true
275900bd88bfd795ffae0b905759cbfb926dd237
KadirEmreOto/hackerrank
/strings/palindrome-index.py
UTF-8
403
3.40625
3
[]
no_license
T = int(raw_input()) for _ in xrange(T): string = raw_input() answer = -1 for i in xrange(len(string)/2): if string[i] != string[-i-1]: straigt = string[i:len(string)-i-1] reverse = straigt[::-1] if straigt == reverse: answer = len(string) - i -...
true
4ff0c51e54c19cd0c8fbbb3af9465e1ed17ddf82
pnizi/Small-Programs
/NPL/sentence-generator/randsent.py
UTF-8
739
2.765625
3
[]
no_license
import random import re file = open('grammer.txt', 'r') list = [] for line in file: m = re.findall("ROOT|S|NP|VP|PP|Noun|DT|Verb|Adj|Prep][^ \t\n\r\f\v].*", line) m = re.sub('1|\\n|\\t', ' ', line) if m: list.append(m) d = {} for k, v in (s.lstrip().split(' ', 1) for s in list if ' ' i...
true
8c6379d86eed5697ab26e722f6ab5adecd8b271f
sebigher/pyhonistas_101
/chap3_lotto.py
UTF-8
906
3.734375
4
[]
no_license
import random # stupid draws number1 = random.randint(1, 49) number2 = random.randint(1, 49) number3 = random.randint(1, 49) number4 = random.randint(1, 49) number5 = random.randint(1, 49) number6 = random.randint(1, 49) print("#1:", number1) print("#2:", number2) print("#3:", number3) print("#4:", number4) print("#5...
true
a93fbcc2cd1743d1d6052df6f5c8e7530d9bc7ab
yunday/BaekJoon
/greedy/회의실배정.py
UTF-8
264
3.015625
3
[]
no_license
n = int(input()) cnt = 1 lst = sorted([list(map(int, input().split())) for x in range(n)], key=lambda x: x[0]) lst = sorted(lst, key=lambda x: x[1]) end = lst[0][1] for _ in range(1, n): if lst[_][0] >= end: cnt += 1 end = lst[_][1] print(cnt)
true
6cf476ffa23f88ebc1b92e0ade8f7c6978921d13
touka-aoi/attendance_iput
/windowtest.py
UTF-8
738
2.6875
3
[]
no_license
import sys # For Sample from PySide2.QtWidgets import ( QApplication, QMainWindow, QVBoxLayout, QWidget, QTableView ) class TestWindow(QMainWindow): def __init__(self, parent=None): super().__init__(parent) self.root_widget: QWidget = QWidget() self.lay...
true
3638705c2f16bc2ebe935a57b15517a79f8e33ff
Kevinpsk/LT614N
/load/debugging/exercises/sum_of_primes_simple.py
UTF-8
393
3.796875
4
[]
no_license
import math def is_prime(n): for i in range(2, int(math.sqrt(n) + 1)): if n % i == 0: return False return True def sum_of_primes(maximum): total = 0 for i in range(2, maximum + 1): if not is_prime(i): continue total += i return total def main...
true
ea5a2fe4728388d9c0f9a1cd53afcbbe99f769d2
bergmarkus/DQN
/utils_new.py
UTF-8
772
2.828125
3
[]
no_license
import numpy as np import pandas as pd import os import glob def get_data(folder, asset, start_date, end_date, cols=[1,4]): path = os.path.join(folder, asset + '.csv') df = pd.read_csv(path, index_col=0, usecols=cols, dtype=np.float32, parse_dates=True) df = df.iloc[::-1] df = df.loc[start_date:end_dat...
true
22088c6077050bc52d3f146e8d83b21c0dee933b
AlexThePav/StepikBioInfo
/Stepik/1 Finding Hidden Messages/Week 4/RandomizedMotifSearch.py
UTF-8
4,894
3.25
3
[]
no_license
# import the random package here import random from decimal import Decimal # Input: Positive integers k and t, followed by a list of strings Dna # Output: RandomizedMotifSearch(Dna, k, t) def RandomizedMotifSearch(Dna, k, t): #M = RandomMotifs(Dna, k, t) M = ["TGA", "GTT", "GAA", "TGT"] BestMotif...
true
ab48d61d69ec4483f659510ecf09bca7e15becc6
upasek/python-learning
/conditional_statements_and_loops/csl_sum_avg.py
UTF-8
505
4.5
4
[]
no_license
#Write a Python program to calculate the sum and average of n integer numbers (input from the user). Input 0 to finish. print("Input some integers to calculate their sum and average. Input 0 to exit.") sum = 0.0 count = 0 num = 1 while num != 0: num = int(input("")) sum = sum + num count += 1 if count =...
true
7e90d6bd79692b8468310029820b1e7372c6d1a5
chithu1992/DEMD-pjt-D20009
/Telecom_customer_churn.py
UTF-8
19,453
3.5625
4
[]
no_license
#!/usr/bin/env python # coding: utf-8 # # Analysis on Telcom Customer Churn # Context: # ----------- # # "Predict behavior to retain customers. You can analyze all relevant customer data and develop focused customer retention programs." # # Content: # ------------ # # Each row represents a customer, each column c...
true
63c4efea31a83970beeec529ec2398cc37a7bab0
yuyue98/MyUniversity
/python_language_programming/code/project/myspider/getMemAward.py
UTF-8
464
2.578125
3
[]
no_license
import requests, os ''' 目前该网址已失效,需使用最新网址 ''' dirpath = os.getcwd()+'/mem' if not os.path.isdir(dirpath): os.mkdir(dirpath) for i in range(100): num = 1900002+i filename = str(num)+'.pdf' filepath = os.path.join(dirpath, filename) url = 'http://www.comap-math.com/mcm/2019Certs/' +filename print("downloading...
true
0c7596a6457c5807c65e6f4570fc7e90a2471b58
jfzlma/ict_fullstack
/python/diction.py
UTF-8
178
3.296875
3
[]
no_license
myDic = { 'Name': 'Ford','Model':'Mustang', 'Year':1964 } print(myDic) print(myDic['Name']) print(myDic['Model']) print(myDic['Year']) print(myDic.keys()) print(myDic.values())
true
a963f1be1cbfb0bcd18717a1491be112050381e8
kehrl/big3
/lib/crossoverlib.py
UTF-8
5,069
3.234375
3
[]
no_license
''' Find and process crossover points. LMK, UW, 10/01/2015 ''' import os import sys import distlib, coordlib import numpy as np import shapefile from shapely.geometry import LineString def find(x,y,z,maxdist=200.0): ''' cross,ycross,zcross1,zcross2,zcrossdiff = find(x,y,z,maxdist=200.0) Find crossovers and...
true
05d78d23b7eb7c021bab6a4d680e453590b8110c
MySixGod/Algorithms-And-Data-Structures
/leetcode/字符串算法/马拉车算法.py
UTF-8
1,043
3.390625
3
[]
no_license
# 214. 最短回文串 -- 马拉车算法 class Solution: def shortestPalindrome(self, s: str) -> str: s = "#" + "#".join(s) + "#" size = len(s) # 回文串的中心index center = 0 # 最大的回文串右边界 max_right = -1 # p[i] == 以s[i]为中心的最大回文串长度 p = [0] * len(s) max_len = 0 for...
true
54cfd85bbb128f8e61e53600c9cb3c4e17ac4bcb
tah20112/SoftDesSp15
/Floobits/Day03/while.py
UTF-8
268
4.25
4
[]
no_license
"""While loops""" def sum_of_integers(n): """ Return sum of all integers up to n >>> sum_of_integers(4) 10 """ i = 0 result = 0 while i <= n: result = result + i i = i + 1 return result print sum_of_integers(4)
true
02d739eb234f2a07990b46b72561a69b2640b911
Siegallab/Flexostat-interface
/Experiment-Simulator.py
UTF-8
7,789
2.890625
3
[ "BSD-2-Clause-Views", "BSD-2-Clause" ]
permissive
""" BACKGROUND Created April 12, 2018 by David Klein contributions found at https://github.com/Siegallab/Flexostat-interface INSTRUCTIONS Run using Python 3 on the command line as such $ python3 Experiment-Simulator.py -h """ from datetime import datetime import argparse import numpy import os from configpars...
true
4dd81d73851978981145b01f6515974c815227fa
MrvKrt/microsim_python
/_2a_estimate_behavioral_cps.py
UTF-8
9,004
2.8125
3
[]
no_license
# Replicating CPS imputation via logistic regression of: # 1.whether pay is received on an hourly basis; # 2. employer size; # 3. number of employers that the person worked for in the last 12 months; # 4. weekly pay (derived from weeks worked, separate regression not needed) # 5. weeks worked # Housekeeping impor...
true
3633afd4e494b9f32623fe98d4b81023e905beb9
gmaucotelbis/dobbleCardGenerator
/fenetre.py
UTF-8
1,214
2.5625
3
[]
no_license
from tkinter import tix from tkinter import * from tkinter.filedialog import * import os class Fenetre(Tk): def listSelected(evt): print("test") def __init__(self): fenetre=Tk() selected=0 listValues=[3,4,6,8,12] labNCartes=Label(fenetre,text=self.textSelected(listVa...
true
24d857b87a603f573bb114f521e99ee5e4ef266e
nakatest1234/python
/ebs_snapshot/mylib/slack.py
UTF-8
1,604
2.625
3
[]
no_license
#! /usr/bin/env python # -*- coding: utf-8 -*- import os import sys import datetime from urlparse import urljoin from urllib import urlencode import pprint import urllib2 import json # 日本時間 class JST(datetime.tzinfo): # UTCからの時間のずれ def utcoffset(self, dt): return datetime.timedelta(hours=9) # サマータイム def dst(...
true
1355514e913f9b1f0cb7edbbb12b06d4f996a907
RysiekPrecikowski/smart_assistant
/my_speedtest.py
UTF-8
428
2.640625
3
[]
no_license
import speedtest def to_Mbps(val): return round(val/10**6, 2) def to_ping(val): return round(val, 2) def speed_test(args): st = speedtest.Speedtest() res = "" res += "download {} Mbps\n".format(to_Mbps(st.download())) res += "upload {} Mbps\n".format(to_Mbps(st.upload())) res += "ping {...
true
10d345cbf6ea530047f21114d4e8a2bc6aa0e880
laurenblackburn/daily-sketches
/day_002/falling.py
UTF-8
2,111
3.328125
3
[]
no_license
# 9/23/18 import matplotlib.pyplot as plt import numpy as np def projectile_motion(x, v, a, t): return x + v*t + 0.5*a*(t**2) fig, ax = plt.subplots() time = np.arange(60) time2 = np.arange(60*2) x1 = projectile_motion(0, 300*np.cos(np.pi / 2.5), 0, time2) y1 = projectile_motion(0, 300*np.sin(np.pi / 2.5), -9....
true
485684883163761fa5bfb1c3c4dc7591b764f9b4
sheymann/edgestream-to-neo4j
/streamtoneo_v1.py
UTF-8
4,226
2.859375
3
[]
no_license
# -*- coding: utf-8 -*- #!/usr/bin/env python """ Fill a Neo4j database with an edge stream where edges have timestamps. Requires Python 2.7 Usage ------- python2.7 streamtoneo.py """ # Copyright (C) 2013 by # Sébastien Heymann <sebastien.heymann@lip6.fr> # All rights reserved. # BSD license. nodes = {} ...
true
41c79df1d20f7c608e3884a570b4884f6715b2d2
Richie010/uplift-python-resources
/OOPS/__init__example.py
UTF-8
235
3.59375
4
[]
no_license
""" The init fucntion is alwasy executed when a certain class is initaited """ class Person: def __init__(self, name, age): self.name = name self.age = age p1 = Person("Sagnik", 23) print(p1.name) print(p1.age)
true
edb4e97e4f205cba821325c48e59f76ed23818bf
htl1126/leetcode
/1752.py
UTF-8
349
2.90625
3
[]
no_license
class Solution: def check(self, nums: List[int]) -> bool: idx = -1 for i in range(len(nums) - 1): if nums[i] > nums[i + 1]: if idx == -1: idx = i else: return False if idx >= 0: return nums[-1] <=...
true
2151ce106294bda4d977b2be46c98c4b090b496d
belaboe97/Python
/vehicle.py
UTF-8
581
3.15625
3
[]
no_license
class vehicle: #CONSTRUCTOR def __init__(self,regNum,make,model,milesOnClock): self.__regNum = regNum self.__make = make self.__model = model self.__milesOnClock = milesOnClock #SETTER && GETTER def set_miles(milesOnClock): self.__milesOnClock = milesOnCloc...
true
04ce046098626cc5de55889786ce8a1d7845ca5d
vrde/harvey
/harvey/command_line.py
UTF-8
1,828
2.546875
3
[ "MIT" ]
permissive
"""Harvey Usage: harvey crawl [--multicore] harvey config harvey (-h | --help) harvey --version Options: --multicore Spawn subprocesses. -h --help Show this screen. --version Show version. --logfile=FILE Override the default log file (harvey.log) """ import gevent.monkey gevent.monk...
true
d0118250683fd045c7119b84d14bc43a0b808ceb
muhammadsidd/CryptographyProject
/hashes/bitwise_rotator.py
UTF-8
772
3.546875
4
[ "MIT" ]
permissive
# Bitwise Rotator Module # Note that the functions perform a circular rotation # Rotates bits to the left d times # Use for 32-bit integers only def rotate_left_32bit(n, d): return ((n << d) | (n >> (32 - d)) & 0xffffffff) % 4294967296 # Rotates bits to the right d times # Use for 32-bit integers only def rotat...
true
7bcaf374712ec8780e65d8c3c1d0a256f231e9a6
mitscay/flight_tables
/flight_tables/flight_parsing.py
UTF-8
2,334
3.15625
3
[ "MIT" ]
permissive
from datetime import datetime import numpy as np import pandas as pd class Flight(object): def __init__(self, flight_info): """ Input: flight_info (dict) Attributes: The keys in `flight_info`: flight_id, origin, destin...
true
cf3abe6b74b4c7b5b33cc5fa45d4da715aa734e0
eliilek/tribegame
/villagers.py
UTF-8
2,421
3.03125
3
[]
no_license
import pygame import random from pygame.locals import * class XP(object): @property def xp(self): return self._xp @xp.setter def xp(self, x): self._xp = x if self._xp > self._xp_max: self._xp = self._xp_max elif self._xp < 0: self._xp = 0 @pr...
true
bb44d41f3d505160b0b6cd6e1fce3e28b6c59bc2
istlab/maven_bug_catalog
/analysis/repo-statistics/project_bugs_counts.py
UTF-8
3,788
2.75
3
[]
no_license
# Extracts the project counters data from the JSON representation # and calculates correlations between version numbers and number # of bugs. import json import sys import numpy as np import matplotlib.pyplot as plt import scipy.stats as st import math import collections bugs_per_version = collections.OrderedDict() b...
true
08392a8feeda436bac061785b5a3084550413169
zaid-kamil/skillshop_chatbot
/admin.py
UTF-8
2,530
2.84375
3
[]
no_license
import streamlit as st import pandas as pd import os st.title("Skillshop chatbot Admin") choices = ['View Dataset','Add Queries','Add Bot Responses'] tags = ['timing','menu','offers','delivery','address','combo'] # files that are going to store the data Q_DATASET = 'query_dataset.csv' R_DATASET = 'bot_response_datas...
true
9539e9dd2d4bf1de544492b19dee6e7d5868204c
khand078/arnav-khandelwal-csci1133
/exam2e.py
UTF-8
196
3.28125
3
[]
no_license
def remove_comments(line_list): clines = 0 for i in range(len(line_list)-1, -1, -1): if '#' in line_list[i]: clines += 1 line_list.pop(i) return clines
true
5f0a97f826c094f736f37cea367c3f715f82e914
cbosoft/geas
/scripts/level_editor/side_panel/widget_collection.py
UTF-8
636
2.921875
3
[ "MIT" ]
permissive
class WidgetCollection: def __init__(self): self.clickables = list() self.typeables = list() def key_down(self, **kwargs): for typeable in self.typeables: if typeable.active: typeable.key_down(**kwargs) def mouse_up(self, button, pos): for click...
true
96d7f5a3b629405373a26fc818184d56e75562b6
RoamingSpirit/SLAM
/drone/droneclient.py
UTF-8
3,632
3.046875
3
[]
no_license
""" DroneClient class. """ import socket import threading from drone import Drone class DroneClient(threading.Thread): """ Class representing a client which receive drone commands and send drone odometry. """ running = True def __init__(self, host="", port=9000): threading.Thread.__i...
true
ceffaa2f383741f63fc0b5707527294e161ac1b4
millenialGaston/structuredPredictionProject
/expcode/numerical_code/pystruct_synth_data.py
UTF-8
7,612
2.90625
3
[]
no_license
from pystruct.datasets import load_scene import numpy as np import pickle import random from fasttext import FastVector import scipy.optimize as opt import time import os from matplotlib import pyplot as plt def one_hot(integer, nb_classes): hot = np.zeros(nb_classes) for id, digit in enumerate(reversed(np.bi...
true
7d33ee43a9d0a608858d482e227d17b7c4c95a2a
SergeTarasov/opencv_patterns
/sketches/utils/kalman.py
UTF-8
4,517
2.984375
3
[]
no_license
import numpy as np from numpy.linalg import inv # why not the one from opencv? this implementation is more flexible and could be easily changed. # also this should be changed to Extended or Unscented Kalman Filter class Kalman: # np.eye( int, int, ... ) # but # np.zeros( tuple(int, int), ... ) d...
true
2d54629fc60de769068fed532fd94a396db374a3
canetaba/hog-features
/distancia2.py
UTF-8
3,071
2.953125
3
[]
no_license
import numpy as np ''' Created on Oct 19, 2019 @author: María José Briceño Guillermo Otarola ''' label_path = 'C:/Users/mjnik/Desktop/Programas Python/computer_vision/Sketch_EITZ/labels.np' label_test_path = 'C:/Users/mjnik/Desktop/Programas Python/computer_vision/Sketch_EITZ/labelsTest.np' features_pat...
true
6196886cf24deb4b4a49b96b73b608d9acca60c5
DianaLuca/Algorithms
/Coursera/PythonForEverybody_UniversityOfMichigan/Part3UsingPythonToAccessWebData/UrlHtmlXml/ScheduleTCOviewStandings.py
UTF-8
234
2.5625
3
[]
no_license
import schedule import time def job(): print("Hello World! ...") schedule.every(5).seconds.do(job) # schedule.every().hour.do(job) # schedule.every().day.at("10:30").do(job) while 1: schedule.run_pending() time.sleep(1)
true
d432d89f67be9abcd8f7ea0fa5229114afd12853
blanche/comp6235-group-6
/src/analyse/drilldown.py
UTF-8
3,937
2.546875
3
[]
no_license
import json from collections import defaultdict, Counter from scipy import stats import matplotlib.pyplot as plt import numpy from db.connection import DbConnection worst = {'Spelthorne', 'Adur', 'Selby', 'Mid Ulster', 'North Kesteven', 'Wychavon', 'Aylesbury Vale...
true
418705961451ec0d2174c9817fb22643497a9540
ilovewarpig/MathModeling
/智能优化算法/ACO.py
UTF-8
5,925
3.421875
3
[]
no_license
import math import random import matplotlib.pyplot as plt #读取数据 f=open("test.txt") data=f.readlines() #将cities初始化为字典,防止下面被当成列表 cities={} for line in data: #原始数据以\n换行,将其替换掉 line=line.replace("\n","") #最后一行以EOF为标志,如果读到就证明读完了,退出循环 if(line=="EOF"): break #空格分割城市编号和城市的坐标 city=l...
true
61a27ac74359652f78885112e43abe082aa2cbe3
muweid/LeetCode
/113. Path Sum II
UTF-8
1,035
3.109375
3
[]
no_license
#!/usr/bin/env python3 __author__ = 'Wei Mu' # Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def pathSum(self, root: TreeNode, sum: int) -> List[List[int]]: if root == None: ...
true
b181ae6002bab96f192b661ecef034de0fb41e36
GumbleDorf/SomethingAwesomeCtfHash
/hash.py
UTF-8
5,492
2.71875
3
[]
no_license
#Python 3.9 def newArray(num): array=[] for x in range(num): array.append(0) return array def convertToWordArray(string): lMessageLength=len(string) lNumberOfWords_temp1=lMessageLength+8 lNumberOfWords_temp2=(lNumberOfWords_temp1-(lNumberOfWords_temp1%64))/64 lNumberOfWords=int((lNu...
true
d8b45e10a8b9b0e70a225c18d8f088d77ff85951
mikedory/Buzzkiller
/buzzkiller.py
UTF-8
3,959
3.3125
3
[]
no_license
#!/usr/bin/env python # encoding: utf-8 """ buzzkiller.py Created by Michael Dory on 2011-03-05. Copyright (c) 2011 DxM. All rights reserved. """ import argparse import sys # import shlex # the next step is to do better multi-word phrase checking # this is where the magic happens def main(arguments=None): # crea...
true
1dd494c249de9afadc160f7bda91d32f145b3891
Suvid-Singhal/PyNews
/data.py
UTF-8
505
2.609375
3
[]
no_license
import os api_key=os.getenv('key') def News(keywords): from requests import get import json all_articles = get("https://newsapi.org/v2/everything?qInTitle="+keywords[0]+"&apiKey="+api_key).json() desired_articles = all_articles.get("articles") for i in range(1,len(keywords)): all_art...
true
b76a03a21108b7daa52bde9790b5c08a487dae49
Allexy/roguelike
/src/rpg/rogue.py
UTF-8
536
2.6875
3
[]
no_license
from pygame import Surface from rpg.scene import SceneObject from rpg.scene_progress import SceneProgress class RPG(SceneObject): def __init__(self, w: int, h: int) -> None: self._scene = SceneProgress(w, h) def update(self) -> None: if self._scene.is_finished(): next_scene = sel...
true
50d5274ca3def474f5f85d82c4385db43b16088e
nahara1/BrewingProjectIST440
/TeamKegging/KeggingBriteTank.py
UTF-8
24,909
2.796875
3
[]
no_license
# Project: Brewing Project # Purpose Details: Brite Tank Object # Course: IST 440W # Author: Team Kegging - Daibo Zhang # Date Developed: 4/03/2020 # Last Date Changed: 4/18/2020 # Rev: 1.4 import sys import math import time import datetime from Brewing import ServiceNowLog from Brewing import MongoLogging sim_sleep_...
true
2afdc81ae47f8b041b5627067d01e3cfce2180fd
Sngunfei/algorithms
/sword2offer/FindNumbersWithSum.py
UTF-8
662
4.03125
4
[]
no_license
""" 给定一个有序数组,和一个target,找出两个数组a和b,使得a+b=target,如果有多对,任意输出一对 """ def findNumbersWithSum(arr, target): if target < arr[0] or target > arr[-1]: return L, R = 0, len(arr) - 1 while L < R: if arr[L] + arr[R] > target: R -= 1 elif arr[L] + arr[R] < target: L += 1 ...
true
0de2c4e2a3ddc1959529481778c315899f82a06a
ChangxingJiang/LeetCode
/LCCI_程序员面试金典/面试17.14/面试17.14_Python_1.py
UTF-8
268
3.265625
3
[]
no_license
import heapq from typing import List class Solution: def smallestK(self, arr: List[int], k: int) -> List[int]: return heapq.nsmallest(k, arr) if __name__ == "__main__": # [1,2,3,4] print(Solution().smallestK(arr=[1, 3, 5, 7, 2, 4, 6, 8], k=4))
true
806294a07426a76d2bdcfd603e3fc5d9a6001aeb
ErfanDipto/Python_Projects
/quiz_game(day_17)/main.py
UTF-8
896
3.125
3
[]
no_license
from question_model import Question from data import question_data from quiz_brain import QuizBrain question_bank = [] # que_end = False for i in range(0, len(question_data)): question_bank.append(Question(question_data[i]["text"], question_data[i]["answer"])) # TODO 1: asking the questions question_pass = Qui...
true
5b476123801a5cb6bfbebe436b74d66544a3f95c
Akshayy99/Mario-Game
/board.py
UTF-8
7,055
3.140625
3
[]
no_license
''' Contains the board class along with the methods and other features ''' import sys import os from os import system import time import random from objects import * import config rows = 60 cols = 200 start = 0 end = 200 columns = 100000 grid = [] init_x = 53 init_y = 10 mario = Mario(init_x, init_y) for i in range(r...
true
d825a91caacc513e507a241fd3e06a8453649554
sputnick1124/lds-scripture-podcasts
/update-podcast.py
UTF-8
2,938
2.640625
3
[]
no_license
#!/usr/bin/env python import sys import os import argparse import requests from datetime import datetime from random import sample import xml.etree.ElementTree as ET from bs4 import BeautifulSoup as BS if sys.version_info.major == 2: from urlparse import urlparse elif sys.version_info.major == 3: from urllib....
true
e6250104660353ebc6fe107d76665b78d740c85e
cliu5/softdev-spring-hw
/23_memoize/app.py
UTF-8
1,310
3.828125
4
[]
no_license
''' scenario: randomiing greetings in an HTML doc goal: separate generation oftext from HTML-ification time-saving solution via closures ''' import random ''' this fxn will wrap text in an H1 tag pair: ''' def make_HTML_heading(f): txt = f() def inner(): return '<h1>' + txt + '</h1>' return inne...
true
cf34292224b3f8c2e7c2dc8a8b0197e7f1dd578f
3l3ktr0/CloudHP
/microservices/s/s.py
UTF-8
1,254
2.734375
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """Service S checks whether the player has already played""" from flask import Flask from flask import jsonify from flask import abort #import config import pymysql app = Flask(__name__) app.debug = True #config.logger = app.logger @app.route('/') def hello_world(): ...
true
fde41c9307b305ed8a5b127f9b1e0bdb0f57b478
canders1/Ling692c
/lecture 4/fizzbuzz.py
UTF-8
216
2.953125
3
[]
no_license
""" This is a program to play fizzbuzz. """ def main(): #Prints number def fizz(): # Handles the fizz case #I think I'll use an if statement def buzz(): #Handles the buzz case def fizzbuzz(): #fizzbuzz case
true
32468809424f49997a808c8692da454fc94a1f29
lp02781/bayesrace
/bayes_race/pp/pure_pursuit.py
UTF-8
925
2.75
3
[ "MIT" ]
permissive
""" Pure pursuit controller. """ __author__ = 'Achin Jain' __email__ = 'achinj@seas.upenn.edu' import numpy as np def purePursuit(x0, LD, KP, track, params): """ x0 : current state LD : lookahead distance KP : proportional gain for speed control params : see bayes_race.params, example ORCA trac...
true
74fa7ad845d7e72ae8084112b0ef798083097c2b
Darshan1917/Data_analysis
/gradient_descent.py
UTF-8
1,644
3.609375
4
[]
no_license
# -*- coding: utf-8 -*- import numpy as np import pandas as pd import matplotlib.pyplot as plt def compute_error(b,m,points): total_error = 0 for i in range (0, len(points)): # get x value x = points[i,0] y = points[i,1] total_error += (y-((m*x + b)**2)) return total_error/f...
true
1bc54c614c3cd588e2314971d9f146a22979865e
anooptoffy/MultiModalRoutePlanning
/src/src/directed.py
UTF-8
192
2.515625
3
[ "MIT" ]
permissive
import sys from pygraph.dgraph import PyGraph g = PyGraph() g.add_relation('A likes B') g.add_relation('A dislikes C') g.add_relation('B loves C') g.add_relation('C likes A') g.draw_graph()
true
532064ec1e65bdd0f9426cfa8212f78c9eff062f
rgan/quizgen
/question.py
UTF-8
1,473
2.96875
3
[]
no_license
class Question(object): CURRENT_ID = 1 @classmethod def id(cls): return_value = cls.CURRENT_ID cls.CURRENT_ID+=1 return return_value @classmethod def single_line_answer(cls, question_text): id = cls.id() return '''\ <div id="%s"> ...
true
4af0526231edf7f82cc69f4af1b8c7d209098d55
mkosicki1/Python
/cwiczenia/P11/P11.py
UTF-8
74
2.703125
3
[]
no_license
num1 = 2 + 5j num2 = 4 + 6j num3 = 4 print(num1 + num2) print(num3 -num2)
true
da48b8a9f4849fd90a25ffd419af99159ea3cec0
FredCox3/public-jss
/appStoreBundleSearch.py
UTF-8
527
2.859375
3
[ "MIT" ]
permissive
#!/usr/local/bin/python3 __author__ = 'Freddie Cox' __version__ = '0.1' import requests import json print('Returns Maximum of 50 results. This only shows iPad Software.') appName = input('Which App Name? ') searchUri = "https://itunes.apple.com/search?term=" + appName + "&entity=iPadSoftware" searchResults = request...
true
0e9f72704bf895e19133dbdc05974662c0769949
Nqsir/Expert_system
/Modules/File_calc_value.py
UTF-8
1,037
2.65625
3
[]
no_license
from Header.Header import * # ------------------------------------------------------------------------------------------------------------------ # Replacement function of negative value # ------------------------------------------------------------------------------------------------------------------ def calc_neg(...
true
1986da2a09821cd626e31956e4a939fe9f682754
BetikSonu/PyGUI
/PyQt/Dersler | ykslkrci & raifpy/r_ORNEK2.py
UTF-8
1,357
3.203125
3
[]
no_license
import PyQt5.QtWidgets as ayq class pencere(ayq.QWidget): def __init__(self): super().__init__() self.sol = 300 self.ust = 100 self.en = 500 self.boy = 550 self.title = "Ben son örneğim !" self.kodlama() def kodlama(self): self.setWindowTitle(s...
true
0be3bbd7f2ebcede5fb1c6c71a83729f5680e369
vitorlombardi/exercicios_exemplo_aulas_blue
/modulo1/exercicios/aula20/animais.py
UTF-8
465
3.265625
3
[]
no_license
class mamifero(): def som(self): print('superclass: emitir som') class homem(mamifero): def som(self): print('humano: pao de batata') class cachorro(mamifero): def som(self): print('cachorro: au! au! wuuf!') class gato(mamifero): def som(self): print('gato: miau') ...
true
3764bc895ebfef80f8b1e4e6d6fc64692c97b384
YIYUE-Joanna/movieapp
/movie/datafilereaders/movie_file_csv_reader.py
UTF-8
1,975
3.09375
3
[]
no_license
import csv from movie.domainmodel.movie import Movie from movie.domainmodel.actor import Actor from movie.domainmodel.genre import Genre from movie.domainmodel.director import Director class MovieFileCSVReader: def __init__(self, file_name: str): self.__file_name = file_name self.__dataset_of_mo...
true
6ec922aa9bef5b4d032f14cf63bd254c1f7bcd31
baichen7788/test
/NewtonInterpolation.py
UTF-8
566
3.703125
4
[]
no_license
# Newton interpolation (output: Divided Difference Table & y value given xp) import numpy as np def NewtonInterpolation(x,y,xp): #Create Divided Difference Table n=len(x) m=np.zeros((n,n+1)) m[:,0]=x m[:,1]=y for i in range(1,n): for j in range(2,i+2): m[i,j]=(m[i,...
true
107bf911098e2eaa698fcdc4468b9e770f5c076d
anjanasrinivas/Intuit-Coding-Challenge-
/problem_3.py
UTF-8
2,907
3.34375
3
[]
no_license
import json def runToTextInData(data, text, depth, path): if type(data) == dict: for someKey in data: if len(path) <= depth: path.append(str(someKey)) else: path[depth] = str(someKey) someValue = data[someKey] ...
true
1e5083a890f649d37973c5870bbc964defe80c1b
wookiekim/CodingPractice
/codeforces/1345B.py
UTF-8
312
3
3
[]
no_license
#https://codeforces.com/problemset/problem/1345/B #1100 import math t = int(input()) for _ in range(t): cards = int(input()) total = 0 while cards > 1: height = math.floor((-1 + math.sqrt(1 + 12*2*cards)) / 6) cards -= height*(3*height + 1) // 2 total += 1 print(total)
true
2a2517a6d70139f5e1c64f74c4e2a5198ae0fd93
AliKarami/worm_simulator
/simulate_worm.py
UTF-8
7,240
3.515625
4
[]
no_license
#!/usr/bin/python3 """Simulate a worm traversing a network.""" from optparse import OptionParser from csv import reader from networkx import Graph from random import choice, random def simulate(net: Graph, patient_zero: str, infection_probability: float) -> int: """Simulate worm propagation through a...
true
257c6bc04d124a8e3a041a2a9504039a79e288a9
RobertFeussner/TLSMeasurementsCode
/DownloadRankings.py
UTF-8
2,264
2.515625
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Wed Aug 5 15:38:21 2020 @author: Robert Feussner """ # %% run all - spyder configuration import os #os.chdir('/u/home/feussner/Project') import pandas as pd from global_variables import TEMP, DATA_PATH, DATABASE from datetime import datetime import sqlite3 def downloadWithRep...
true
091119fcddd95ca6f5b615daeca6753a29ad2e86
Barry36/campus_forum
/lib/post.py
UTF-8
3,271
2.828125
3
[]
no_license
def view_all_posts(self, user_info): self.cursor.execute("select post_ID, message, thumbs, is_read from User_post;") query_res = self.cursor.fetchall() if len(query_res) == 0: print("There is no posts yet!") else: for e in query_res: print("Post_ID: ", e[0]) print...
true
7a7170c7473bacf66d1379e40e3abbe9f35bed7c
chariotrequiem/python-learning
/code/项目-数据可视化/chap16下载数据/16.2制作世界人口地图:json格式/16.2 制作世界人口地图:JSON格式.py
UTF-8
12,053
4.34375
4
[]
no_license
# 当前版本 : python3.8.2 # 开发时间 : 2021/8/29 16:44 # 2.1下载世界人口数据 """ 将文件population_data.json复制到本章程序所在的文件夹中,这个文件包含全球大部分国家1960~2010年的人口数据。 OpenKnowledge Foundation(http://data.okfn.org/ )提供了大量可以免费使用的数据集,这些数据就来自其中一个数据集。 """ # 2.2提取相关的数据 """ 我们来研究一下population_data.json,看看如何着手处理这个文件中的数据: 这个文件实际上就是一个很长的Python列表,其中每个元素都是一个包含四个键的字典...
true
f528e86e495e3b6d249f3adca32a42ec9b3b6314
dr-dos-ok/Code_Jam_Webscraper
/solutions_python/Problem_200/2804.py
UTF-8
646
3.640625
4
[]
no_license
t = int(input()) # read a line with a single integer filep = open("p2.txt", 'w') for i in range(1, t + 1): n = int(input()) # read a list of integers, 2 in this case for num in range(n,0,-1): num_string = str(num) pre = int(num_string[0]) for ch in num_string: if in...
true
46aaf4689207f2c02c592559e98d88356a704d2c
AvTibidabo/AdventOfCode2018
/day1.py
UTF-8
1,074
3.78125
4
[]
no_license
def ChronalCalibrationCalculateSum(): filename = 'input.txt' with open(filename, 'r') as input: frequency = 0 for line in input: new_freq = int(line.split()[0]) frequency += new_freq print('Total frequency is {}'.format(frequency)) def ChronalCalibrationFindDouble...
true
5f21931c99855f8295845662722cc4ec32b21233
GuQiangJS/Python_docstring_Sample
/reStructured/__init__.py
UTF-8
3,454
3.875
4
[]
no_license
def square(a): """short description of the function square longish explanation: returns the square of a: :math:`a^2` :param a: an input argument :returns: a*a """ return a * a def example(param1, param2, param3, param4, param5): """描述示例 :param param1: 第一个描述。接受一个字符串作为参数。 :type par...
true
3880e596f2e0591e51e9cd9fb346083586568c08
Atif-Bashir-1998/JustDialScrapper
/page_scraper.py
UTF-8
1,252
2.625
3
[]
no_license
from selenium import webdriver from selenium.webdriver.chrome.options import Options import time def scrap_page(url): path = r'chromedriver.exe' chrome_options = Options() chrome_options.add_argument("--start-maximized") browser = webdriver.Chrome(path, options=chrome_options) browser.get(url) ...
true
a008a434410ab33ff3ee6c793b3265645ceb090e
viswanath3/guvi
/incriment.py
UTF-8
71
2.921875
3
[]
no_license
no=int(input()) sum=0 for k in range(1,no+1): sum=sum+k print(sum)
true
c87a518c44c7bd775fbc92b927bbbc36c613ad3b
musicjae/korean_sentiment_analysis
/data.py
UTF-8
1,732
2.765625
3
[]
no_license
import pandas as pd from soynlp.tokenizer import RegexTokenizer import stopword import torch.nn as nn from torch.utils.data import Dataset, DataLoader tokenizer = RegexTokenizer() train = pd.read_csv(r'C:\Users\USER\Desktop\gitgit\korean_sentiment_analysis\nsmc\ratings_train.txt',sep='\t') # 150000,3 test = pd.read_cs...
true
9a59f769dabaa3ac1ebc6df2bb7e732513bff5f5
apm71/algorithm
/SquareMatrixMultiply/Strassen.py
UTF-8
4,287
3.046875
3
[]
no_license
import math def strassen(matrixA,matrixB): n = len(matrixA[0]) halfLen = int(math.floor(n/2)) matrixC = createMatrix(n) if n==1: matrixC[0][0] = matrixA[0][0] * matrixB[0][0] else: a00 = createMatrix(halfLen) a01 = createMatrix(halfLen) a10 = createMatrix(...
true
30e979fa1358f4cfeb06d741c019318cfe1bbbd6
surrealyz/growtrees
/save_sklearn_rf_to_json.py
UTF-8
2,413
2.8125
3
[]
no_license
#! /usr/bin/env python import sys import json import pickle import pprint import argparse def parse_args(): parser = argparse.ArgumentParser(description='Convert sklearn Random Forest model to the json format.') parser.add_argument('--model_path', type=str, help='pickled sklearn model path. e.g., models/rf/skl...
true
49077730e33a4e7389a5273450fc384e55801a59
stevehof/pyslet
/unittests/test_rfc2396.py
UTF-8
26,583
2.671875
3
[ "BSD-3-Clause" ]
permissive
#! /usr/bin/env python import unittest import logging import os import os.path import string import sys from types import UnicodeType, StringType import pyslet.vfs as vfs import pyslet.rfc2396 as uri def suite(): return unittest.TestSuite(( unittest.makeSuite(RFC2396Tests, 'test'), unittest.make...
true
7dcd30ddc6f0da78cfb0788fdfa981da3809f086
Kawser-nerd/CLCDSA
/Source Codes/AtCoder/abc099/B/4929350.py
UTF-8
61
3.046875
3
[]
no_license
a,b= map(int, input().split()) d = b-a print((1+d)*d//2 -b)
true
014e36dbb55496f1a5cf8ee5b5d87e8f57671205
Perle/DeepSM
/bin/preprocess_files.py
UTF-8
1,387
2.9375
3
[ "MIT" ]
permissive
""" Processes raw song packs into a more usable format. Converts the .mp3/.ogg files into a single channel wav file, and modifies the sm file to point to the wav file. """ import os import argparse import subprocess def preprocess_dataset(ds_name): songs = os.listdir(f'data/{ds_name}') for song in songs: ...
true
ffcf479707d8d307d603c8cafc33bc334cef8580
IrshaadS/LearnPython
/listsAsStack.py
UTF-8
172
3.734375
4
[]
no_license
#Using list as stack stack = [3,4,5] stack.append(6) stack.append(7) print(stack) print(stack.pop()) print(stack) print(stack.pop()) print(stack.pop()) print(stack)
true
e33d4d58a22641f64991dcf71de4cac88288e239
YauheniRusinchuk/flask_project
/myapp/models.py
UTF-8
709
2.546875
3
[]
no_license
from myapp import db from datetime import datetime class Article(db.Model): id = db.Column(db.Integer, primary_key=True) title = db.Column(db.String(250), index=True) body = db.Column(db.String(), index=True) url = db.Column(db.String(),nullable=True) comments = db.relationship('Comment', backref='...
true
797a955565e8af9ede856b614ae86b7acac3cb87
kyawmyoag/python-tutorial
/Inheritance/main.py
UTF-8
593
3.390625
3
[]
no_license
from employee.base_employee import EmployeeBase from employee.permanent_employee import PermanentEmployee from employee.probation_employee import ProbationEmployee emp_1 = PermanentEmployee('John', 500) emp_2 = ProbationEmployee('Smith', 100) print('Permanent Employee - {}, Salary - {}, Bonus - {}'.format(emp_1.name,...
true
62f435374d240c3e8b808c33aa02a8e274ef2367
zaproxy/zap-extensions
/addOns/jython/src/main/zapHomeFiles/scripts/templates/active/Active default template.py
UTF-8
1,807
2.65625
3
[ "Apache-2.0" ]
permissive
""" The scanNode function will typically be called once for every page The scan function will typically be called for every parameter in every URL and Form for every page Note that new active scripts will initially be disabled Right click the script in the Scripts tree and select "enable" """ def scanNode(sas, msg...
true
aeccffcfdd750a568c6cd96f70b15704d43e702f
Aguilera4/AA
/Practicas/P2/ejercicio2.py
UTF-8
14,122
3.546875
4
[]
no_license
# -*- coding: utf-8 -*- """ TRABAJO 2 Nombre Estudiante: SERGIO AGUILERA RAMIREZ """ import numpy as np import matplotlib.pyplot as plt # Fijamos la semilla np.random.seed(1) # simula_unif() def simula_unif(N, dim, rango): return np.random.uniform(rango[0],rango[1],(N,dim)) # simula_gaus() def simula_gaus(N, dim, ...
true
959c30d5fbd2c0a30086b3618610171104ad302d
Konohayui/LeetCode
/104. Maximum Depth of Binary Tree.py
UTF-8
561
3.234375
3
[]
no_license
# Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: def maxDepth(self, root: TreeNode) -> int: if not root: return 0 depth = 0 level = [root] ...
true
17a93d96275917b5488ed7896461664ca3a03412
chaoshunh/Georgia-Tech-CS-7630-Autonomous-Robotics
/rover_driver_base/src/rover_driver_base/rover_kinematics.py
UTF-8
2,745
2.84375
3
[]
no_license
#!/usr/bin/env python import roslib; roslib.load_manifest('rover_driver_base') import rospy from geometry_msgs.msg import Twist import numpy from numpy.linalg import pinv from math import atan2, hypot, pi, cos, sin prefix=["FL","FR","CL","CR","RL","RR"] class RoverMotors: def __init__(self): self.steering={} sel...
true
63be17df0c73e5de84511f5dbd54c6f0e93ecfab
svetakeda/project_oop_1
/main.py
UTF-8
1,125
4.0625
4
[]
no_license
from book import Book def read_file(file_name): books = [] with open(file_name) as file: lines = file.read().splitlines() # считывает весь файл for line in lines: a = line.split(';') name = a[0] year = int(a[1]) author = a[2] cost =...
true
1cec7f6bda5e36aa14fb28e894df7d7db9989f21
oewilliams/sucess_in_showbusiness
/efficiency_distribution/activity_random_check.py
UTF-8
3,093
2.765625
3
[]
no_license
#!/usr/bin/python from __future__ import division from collections import Counter import numpy as np import os import matplotlib.pyplot as plt from matplotlib import rc from itertools import cycle import random #Program generates sample values for L and s and compares the ratios. #This is effectively a null model for...
true
746ca494182b48ccd5558cecbb4f1408bbfb81e5
laszlo-f/CPA
/Scripts_simulate_data/loaddata_functions.py
UTF-8
6,677
2.734375
3
[ "CC0-1.0" ]
permissive
''' Handler for reading and writing files ''' def Findlinebreaks(loadFilepath): breaks = [] print(loadFilepath) with open(loadFilepath, 'r') as f: for idx,line in enumerate(f): if line == '\n' or len(line)<3: breaks += [idx] return breaks def WriteDict(filename, myd...
true
27d41677ff5e85d7d26c1eeb2f92da943cbc5f79
messaismael/Test_python
/search -e.py
UTF-8
210
2.921875
3
[]
no_license
a = 'je suis admis en terminal c' z = 'e' e = len(a) r = 0 t = 0 while( r < e): y = a[t] t = 1 r = r + 1 if( t == 1): print("il y en a") else: print("il y en a pas")
true
783e421bca28879d22862320b7662c7dd659f9df
jeremy886/learn_p5
/session_3/seek_with_limit.py
UTF-8
1,160
3.5625
4
[]
no_license
from p5 import * class Vehicle: def __init__(self, start_x, start_y): self.pos = Vector(start_x, start_y) self.vel = Vector(0, 0) self.acc = Vector(0, 0) self.max_speed = 5 self.max_force = 0.5 def seek(self, target): """ Craig Reynolds: steerin...
true
5c1ca380faed9d0eae7d57f1bdd09baed15744e6
ShaikhAbdulRahi/Leads-Filteration-Analysis
/Leads Filteration.py
UTF-8
6,214
3.15625
3
[]
no_license
#!/usr/bin/env python # coding: utf-8 # In[1]: import pandas as pd # In[2]: leads=pd.read_csv("E:/Decode_Lectures/Case Study/Case Study_4/Leads.csv") leads # # Data Cleaning # In[3]: leads.isna().sum() # In[4]: #Drop the column have more then 3000 missing value or null value for col in leads.columns: ...
true
cfaf5e2a0ee3f0f2ee85f3a6b64ff6347c23988d
Jamshid-Mamatov/Flask1
/flask_.py
UTF-8
478
3.015625
3
[]
no_license
from flask import Flask app=Flask(__name__) @app.route('/') def hi(): return "salom" jamshid_page="""<!DOCTYPE html> <html> <body> <h1>This is heading 1</h1> <h3>This is heading 3</h3> <h6>This is heading 6</h6> <p><b>Tip:</b> Use h1 to h6 elements only for headings. Do not use them just to make text bold o...
true
09bcfd91d847200f49858750d914ae38787c1a7b
Global19-atlassian-net/ComputationalPhysics
/DLA Cluster Mod.py
UTF-8
5,389
3.03125
3
[]
no_license
""" Created on Sun Oct 27 17:50:45 2013 """ # DLA Cluster Mod """ This generates a DLA particle cluster. """ import numpy as np import matplotlib.pyplot as plt from datetime import datetime # DLA Cluster Mod #******************************************************************* #----------------------------------...
true
097ceff34243ae035756d1ed423f9be01591cfc6
kalyangcp123/schoolHostelAssignment
/assignment.py
UTF-8
1,669
3.53125
4
[]
no_license
def schoolHostelAssignment(class_max_size, AV, BV, ANV, BNV, NA, students): id = input("enter the roll number:") if len(id) != 4: raise Exception('id must be 4 digits') # roll number should be 4 digits if id in students: return students.append(id) section = input("enter the clas...
true