blob_id
stringlengths
40
40
language
stringclasses
1 value
repo_name
stringlengths
5
133
path
stringlengths
2
333
src_encoding
stringclasses
30 values
length_bytes
int64
18
5.47M
score
float64
2.52
5.81
int_score
int64
3
5
detected_licenses
listlengths
0
67
license_type
stringclasses
2 values
text
stringlengths
12
5.47M
download_success
bool
1 class
9120d930f38546cbc1df93100a22f78463909089
Python
satriopangestu17/tugas1
/balikkatadalamkalimat.py
UTF-8
698
3.609375
4
[]
no_license
# #balik kata dalam kalimat # nama = 'hai aku lintang' # namasplit = nama.split() # print(namasplit) # def ngebalik(l): # namadibalikin = '' # for t in l: # balik = t[::-1] + ' ' # namadibalikin+= balik # return namadibalikin # print(ngebalik(namasplit)) # #ngebalik dengan fungsi # y ...
true
1693cff978074ce4bd6329824bcbf96ee4b78f28
Python
gustafl/advent-of-code-2020
/src/21/21a.py
UTF-8
367
2.84375
3
[ "MIT" ]
permissive
def get_input(file): with open(file, 'rt', encoding='utf8') as f: lines = [] for line in f.readlines(): line = line.strip() lines.append(line) return lines def get_ingredients(lines): ingredients = set() for line in lines: pass def main(): line...
true
22e3d44e98dd3f47d6197543be82ae2d3a2d20ff
Python
UnforeseenOcean/Stasis
/tests.py
UTF-8
1,214
2.640625
3
[]
no_license
import sys import unittest import interpreter import runtime class Test_tests(unittest.TestCase): #def test_hello_floats(self): # input = interpreter.build_input_array_floats([72, 101, 108, 111]) # #print(input) # # holder cell # runtime.set_var("esc",input[0]) # runtime.set_v...
true
2c40da79b3301b4b4306dfce305206b1095bbeb6
Python
akobyl/advent_of_code
/2017/2017_3_1.py
UTF-8
1,359
3.484375
3
[]
no_license
INPUT = 289326 print('Solving puzzle 2017 day 3 part 1!') # get ring ID ring_id = 0 ring_start = 2 ring_width = 1 last_ring_start = 2 while INPUT > ring_start: ring_id += 1 # the number of elements increments 1,3,5 plus 4 corners ring_count = ring_width * 4 + 4 print('ring id: {}, first: {}, count: ...
true
09f87621536bb8e6b60157a7d9a19ebbd1255186
Python
jasonelliots/Intro-Python-II
/examples/main.py
UTF-8
1,934
3.515625
4
[]
no_license
from user import User import sys from department import Department from products import Product from store import Store num_args = len(sys.argv) if num_args == 1: user = User(100) elif num_args == 2: user = User(int(sys.argv[1])) else: print("Usage: store.py [money]") sys.exit(1) departments = { ...
true
914ee1e067b1d0b713d213d8530af03678232c13
Python
crvlwanek/math
/misc/2tothe_n.py
UTF-8
62
3.171875
3
[]
no_license
k = 1 while str(2**k)[:2] != '10': k += 1 print(k, 2**k)
true
989698a8d573991c13476eaa1d6952a886cc2fa4
Python
GS-Shashank/DSP-Basic-codes
/wave generator/sine,cosine,square waves.py
UTF-8
1,022
3.65625
4
[ "MIT" ]
permissive
""" SINE, COSINE, SQUARE WAVE GENERATION BY:- GSS """ import math import numpy as np import matplotlib.pyplot as plt time= np.arange(0, 1, 0.01); sig_freq =float(input("Enter the frequency for sine and cosine waves:\t")) #plotting Sine wave amplitude_sine = np.sin(2*math.pi*sig_freq*time)...
true
ffdb0277779207eee7cf189b956ae496918b5998
Python
chelosky/ost-videogames-covers
/main.py
UTF-8
2,876
2.953125
3
[]
no_license
''' BIBLIOTECAS UTILIZADAS pandas ''' import pandas as pd import requests from dotenv import dotenv_values ''' VARIABLES GLOBALES ''' config = dotenv_values(".env") url_api = config['URL'] file_path = config['FILE_PATH'] access_token = config['ADMIN_TOKEN'] sheets_name = ['Videogame','Ost'] headers_token ={'Content-...
true
88fb047d21bcc0c47972be1a037880a114c27266
Python
zubairrauf123/Airlines-Review-Data
/LexiconSentimentAnalysis- Final.py
UTF-8
5,492
3
3
[]
no_license
# Import pandas package to store and manipulate data import pandas as pd # Import csv package to convert pandas dataframe to csv file import csv # Import Counter package to do counting from collections import Counter # Import operator package to sort a dictoinary by its values import operator # Import NTLK package afte...
true
c583e816074b8b07297c263aac370f9902f80b0d
Python
jose0luis41/testproject
/files.py
UTF-8
1,540
2.625
3
[]
no_license
from flask import Flask, request, abort import os, json from files_commands import get_files, remove_all_files, get_files_recent app = Flask(__name__) api_url = '/v1.0' @app.route(api_url + '/files', methods=['POST']) def create_file(): content = request.get_json(silent=True) filename = content['filename'] con...
true
05eff332a8896c83ce7209ef7aff1a525dd610fd
Python
violenti/felix
/census.py
UTF-8
858
2.734375
3
[]
no_license
#!/usr/bin/env python3 # -*- encoding: utf-8 -*- import RPi.GPIO as GPIO import time def water(sensor): GPIO.setwarnings(False) GPIO.setmode(GPIO.BCM) if sensor == 0: GPIO.setup(17,GPIO.OUT) GPIO.setup(27,GPIO.IN) GPIO.output(17, GPIO.LOW) time.sleep(1.0) GPI...
true
69c1468df8dbcc23fdc4db554e6f003b4fe23ddc
Python
EdlinLink/Go
/Client.py
UTF-8
2,270
3.53125
4
[]
no_license
######################################################################### # Title : Client.py # # Author : Edlin (LIN Junhao) # # Date : Sept. 17, 2014 # ######################################################################### import thread import threading import time import socket fro...
true
5f8e1a0fa5bcf1fa053e4be9b091e851fbbb20e0
Python
DaviPMello27/PythonImageProcessing
/Power.py
UTF-8
1,307
3.46875
3
[]
no_license
import matplotlib.pyplot as plt import cv2 def showImage(title, pos, effect = None): image = plt.subplot(pos) image.set_title(title) image.set_yticks([]), image.set_xticks([]) image.imshow(cv2.cvtColor(img, cv2.COLOR_BGR2RGB), cmap = effect) def calculateIntensity(image, plot): intervals = () ...
true
6bc349027523852de931ca509a1fba3b8c6b0669
Python
tomd100/stream2-python3
/tdd1.1.py
UTF-8
1,014
3.84375
4
[]
no_license
def count_upper_case(message): if not isinstance(message, str): return 0 count = 0 for c in message: if c.isupper(): count += 1 return count # print(count_upper_case("Here is a message with some text and some CAPITALS and a FEW more")) assert count_upper_case("") == 0, "E...
true
9c7a71f7ccc3cfc284ffb7b982112ae5b2ad6f1e
Python
Shuijing725/ECE490_mps
/mp3/gd_armijo.py
UTF-8
2,403
3.15625
3
[]
no_license
###### copied from mp1 ###### import numpy as np class GD_Armijo(object): def __init__(self, Q, A, b, epsilon, alpha0, sigma, beta): # arguments for f(x) (L_c(x, lambda)) self.Q = Q # n*n pd matrix self.A= A # m*n matrix self.b = b # m*1 vector # arguments for Armijo's rul...
true
54923eb39a37304160ddc4dcbf5ecffcc541dbd8
Python
cherishbrowne/Portfolio_SchoolProjects
/LogicAndProgrammingI_Python/Assignment2/MobileDataPlans.py
UTF-8
1,109
3.625
4
[]
no_license
#Don't forget to rename this file after copying the template #for a new program! """ Student Name: Cherish Browne Program Title: Mobile Data Plans Description: """ def introMessage(): print("Welcome to the data plan generator\n") def totalChargeDisplay(dataCharge): print("Total charge is ${0:.2f}".form...
true
563e00ca80cd3415a20e025aec6db88771f1fa91
Python
Cockie/DnDStuff
/Python scripts/hit.py
UTF-8
1,121
3.296875
3
[]
no_license
import random total = 0 tries = 100000 AC = 16 bonusA = 9 bonusB = 7 damage = 4 attacks = 3 def doRoll(die, lucky = False): roll = random.randint(1, die) if lucky and roll == 1: roll = random.randint(1, die) return roll for i in range(0, tries): usedhunter = False for j in range(0, at...
true
171e79d0ad322fdafb6c85601c1539151d14ef6e
Python
dacioromero/hackerrank
/Python/py-collections-ordereddict.py
UTF-8
342
3.3125
3
[ "MIT" ]
permissive
from collections import OrderedDict def main(): net_prices = OrderedDict() for _ in range(int(input())): item, price = input().rsplit(maxsplit=1) net_prices[item] = net_prices.get(item, 0) + int(price) for item in net_prices: print(item, net_prices[item]) if __name__ == '...
true
866bbb8a44c459f3e0d78c986c1de1b6c7d4a9d5
Python
Aasthaengg/IBMdataset
/Python_codes/p03568/s255573875.py
UTF-8
337
2.875
3
[]
no_license
import numpy as np def dfs(A, a, n, ans): if len(A) == n: tmp = np.array(A) + a if sum(tmp % 2) < len(A): ans += 1 return ans for i in range(-1, 2): A.append(i) ans = dfs(A, a, n, ans) A.pop() return ans n = int(input()) a = np.array(list(map(int, input().split()))) print(...
true
feecab9554bcd74bbfcaeeddca188c47753e501e
Python
voun/datascience-ML
/data_mining/homework3/nbayes_summarize_data.py
UTF-8
1,968
2.6875
3
[]
no_license
import numpy as np import argparse import os benign_data = [{"total":0},{"total":0},{"total":0},{"total":0}] #clump thickness, uniformity, marginal adhesion,mitoses malignant_data = [{"total":0},{"total":0},{"total":0},{"total":0}] tot_benign,tot_malignant = 0,0 parser = argparse.ArgumentParser() parser.add_argument...
true
2a0f80f14b84b90c548059bd6bdb46c96638df3e
Python
cdgus1514/NLP_Project-Travel-Chatbot-
/Travel_Chatbot/src/crawler/seoul_crawler.py
UTF-8
1,512
2.546875
3
[]
no_license
import random import re import urllib from urllib.request import urlopen, Request import requests import bs4 from . import parsing_test as ps # import parsing_test as ps # 테스트 경로 def seoul_cr(city, info): # url = 'http://info.hanatour.com/dest/content/know/36?ctype=1000010089&contentID=1000056139101' url ...
true
ed746ce2887e2c75ad76613b16ffd90055f3801e
Python
acao2002/WeatherPredictionModel
/WeatherPrediction/Flaskimplementation.py
UTF-8
971
2.78125
3
[]
no_license
from flask import Flask , render_template, request, redirect, url_for app = Flask(__name__) from WeatherPrediction import weather @app.route('/', methods = ["GET", "POST"]) def index(): state = 0 days =0 sunny = 0 rainy = 0 cloudy = 0 if request.method == "POST": if 'submitname' in ...
true
b5b0a1de34699b9bc74e44ea65b8b725004e2ea8
Python
benizl/bigglesworth
/biggles_test.py
UTF-8
3,578
2.640625
3
[]
no_license
#!/usr/bin/env python from biggles import * system = System("Sol Invictus") user = User("Driver") race_requirements = ExternalRequirementSet() width_constraint = Constraint("shall have a maximum width less than 2000mm", width__lte = "2000mm") panel_area_constraint = Constraint("shall have a total solar panel area l...
true
4099b3fbfa1a933b85a51fcd10598cebae27c2b2
Python
GerogeLiu/pyDemos
/01 getMoocMedia/download.py
UTF-8
2,712
3.140625
3
[ "Apache-2.0" ]
permissive
import os import requests from urllib import error # 下载路径选择 def select_direction(courseName): currentDir = os.getcwd() currentDir = currentDir.replace("\\", "/") # 美化显示 path = input(f'>>> 请输入保存路径:(默认在当前路径{currentDir}下创建"{courseName}"文件夹)\n>>> ') # 获得当前文件夹 if not path: path = currentDir + "/" ...
true
4080432dd4380eedec3127ed90dd63be2d2c7f8a
Python
Tauseef117/DSA-2020-21-Py
/Hacker/Data Structures/1-D/hack_monk-and_power_of_time.py
UTF-8
326
2.640625
3
[]
no_license
n=int(input()) c=list(map(int,input().split())) id=list(map(int,input().split())) if id==c: print(n) exit() else: t=0 while(len(c)>0): if c[0]==id[0]: c.pop(0) id.pop(0) t+=1 else: c.append(c[0]) c.pop(0) t+=1 pr...
true
3010d70d37a829d50d356fb94e0992adcd6f2fa5
Python
i-Xiaojun/PythonS9
/Day20/daemo.py
UTF-8
89
2.640625
3
[]
no_license
__all__ = ["money","readme"] money = 100 def readme(): print('my money is ', money)
true
834c50cce403fb568b62be5b3ff7737101b2dec5
Python
Baymax94/Games
/Game11/Game11.py
UTF-8
3,247
2.8125
3
[ "MIT" ]
permissive
''' Function: 俄罗斯方块主程序 Author: Charles 公众号: Charles的皮卡丘 ''' import sys import random from utils import * from PyQt5.QtCore import Qt, QBasicTimer from PyQt5.QtWidgets import QMainWindow, QDesktopWidget, QApplication, QHBoxLayout, QLabel ''' Function: 定义俄罗斯方块游戏类 ''' class TetrisGame(QMainWindow): def __init__(sel...
true
1869edbb67401166c550cbbd7c214557ab3b071e
Python
bru08/mot
/metrics/detection_metrics.py
UTF-8
2,567
2.640625
3
[ "MIT" ]
permissive
from motPapa import DetectionFileReader from scipy.optimize import linear_sum_assignment from scipy.spatial import distance_matrix import numpy as np import matplotlib.pyplot as plt from motPapa import IoU_calc, get_bb_pp gt_path = "../data/gt/gt.txt" det_path = "../Output/detections.csv" gt_reader = DetectionFileRea...
true
346691e1c1e00a431530c35fb8aea6be37e9afac
Python
SachetAdhikari/ImageProcessingProject
/Working/median.py
UTF-8
687
2.90625
3
[]
no_license
from statistics import median from PIL import Image from numpy import array # img = Image.open("..\\InputImages\\Median.png") img = Image.open("..\\OutputImages\\resultThresholding.png") img.show() arr = array(img) img.close() if arr.ndim > 2: arr = arr[:, :, 0] width = len(arr[1]) height = len(arr) for...
true
df758427766c3bce803670ddbfc8f2fd08b9de3a
Python
VarshaRadder/APS-2020
/Code library/77.additive number.py
UTF-8
647
3.6875
4
[]
no_license
# -*- coding: utf-8 -*- """ Created on Mon Apr 27 23:05:18 2020 @author: Varsha """ import itertools #Additive number is a string whose digits can form additive sequence def isAdditiveNumber(num): n = len(num) for i, j in itertools.combinations(range(1, n), 2): a, b = num[:i], num[i:j] ...
true
84fcbf0f7428af8e1edbe0f2d971fa4788205dc0
Python
padmacho/default
/deploy.py
UTF-8
2,183
3.1875
3
[]
no_license
from subprocess import call # Used to call pandoc command # Deploy script for the application # Deletes old deployed versions in google cloud def delete_old_deployed_versions(): print("Deleting old versions") def update_anchor_elements_in_index_file(index_file): # Read index.html file with open(index_f...
true
aea6e1d3065d23a3e1e00744df39f726900cd0fc
Python
jasminedevv/PDXCGExercises
/centsShort.py
UTF-8
250
3.6875
4
[]
no_license
total = int(input("Please enter change: ")) COINS = [("quarters", 25), ("dimes", 10), ("nickels", 5), ("pennies", 1)] for coin_name, coin_value in COINS: result, total = (total // coin_value, total % coin_value) print(result, " ", coin_name)
true
33f3db279475c45f259752b855463ad4d461109a
Python
Xiaoyi0406/Yelp_review_group2
/code/score/word2vec.py
UTF-8
1,854
2.578125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Tue Mar 12 17:59:59 2019 @author: 74293 """ import numpy as np import config import gensim class word_embedding(): def __init__(self): print('Now loading the word embedding') self.text = 0 def text(self): print(self.text) ...
true
6ffc0c49b9f7c5f225566c45d332acc8ee21e198
Python
CPSC-449-Projects/project1
/server.py
UTF-8
3,961
3.1875
3
[]
no_license
''' Members: 1. Vinh Tran (Email: kimvinh@csu.fullerton.edu) 2. Quang Nguyen (Email: quangdnguyen2211@csu.fullerton.edu) CPSC 449 - 02 Professor: Kenytt Avery Project 1: HTTP Clients and Servers ''' import sys import json import http.client import http.server import socketserver import urllib.parse PORT =...
true
9cd0c409ef106bd57414cd86cfee970f061027c6
Python
jiajunshen/Lasagne
/lasagne/layers/gaussianMixtureScore.py
UTF-8
5,598
2.546875
3
[ "LicenseRef-scancode-generic-cla", "MIT" ]
permissive
import theano.tensor.nnet import theano.tensor as T import numpy as np from ..import init from ..import nonlinearities from ..utils import as_tuple from ..theano_extensions import conv, padding from .base import Layer from .. import updates __all__ = [ "MultiGaussianMixtureScore", ] class MultiGaussianMixture...
true
0577a8a85c0e32291a598daf353ea8c532829d73
Python
reshmahayathbi1999/pythonproject
/specialcharacter.py
UTF-8
82
2.96875
3
[]
no_license
import re para=input() ans=len(para) - len( re.findall('[\w]', para) ) print(ans)
true
2f388007fd1569ebe9d105b4b5a94c8235279d5f
Python
v370r/Codes
/TechDose/ImportantDSA/N-Krepeating.py
UTF-8
395
3.609375
4
[]
no_license
#Given n number find k repearting numbers from collections import Counter class NKrepeat: def majorityElement(self,nums,n,k): b = Counter(nums) n = len(nums) for x in b: if b[x]>(n//k): yield x #Importat Note: yeild is a generator A = [3,1...
true
6b7e4607d3d3e72d14e566ad204c916b32cf8c32
Python
isosky/gamestatus
/pys/gisfuncs.py
UTF-8
4,208
3.140625
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Mon Oct 10 17:42:33 2016 @author: wtr """ import math """ 第一个参数为一个路的起点和终点组成的list,如下: sp=[116.291087273989,40.0484742339865] ep=[116.292488728211,40.0487113818083] lines=[sp,ep] 第二个参数为前进了多少的百分比 """ def line_interpolate_point(lines, percent): p1, p2 = lines # 如果传进来...
true
cf5f49175143ab5bf25ad3735c0341ee32245edb
Python
pranavnraj/project_drive
/drive_py/train.py
UTF-8
1,818
2.5625
3
[]
no_license
import tensorflow as tf from tensorflow import keras import logging import cv2 import numpy as np import os # Load images and labels def load_data(folder_name): images = [] labels = [] current_path = os.getcwd() img_folder_path = os.path.join(current_path, folder_name) for img_name in os.listdir(img_folder_path...
true
27521a1e9a5d447c4eb3bf4870724487b0d9070b
Python
wph21cen/FOMCTextAnalysis
/src/analysis/python/scripts/indirect/generate_final_data_file.py
UTF-8
12,013
2.609375
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ @Author Anand Chitale Produces a final derived file containing all information required for data preparation """ import pandas as pd import numpy as np import math import sys # Monthly data data_df=pd.read_csv('../../../collection/python/output/string_theory_indicato...
true
b0b333a20c0977aca0bd676edd7fbe17683ec351
Python
hao-minmin/DataStructures
/DS1_Interoduction/DS1_introductions.py
UTF-8
5,563
3.8125
4
[]
no_license
#注册牛客网,leetCode(必刷) #如果a+b+c = 1000 并且a^2 + b^2 = c^2 求出所有的a,b,c可能的组合 #解决同一个问题 时间短的 # print("--------------------------------------------") # import time # start_time = time.time() # for a in range(0,1000): # for b in range(0,1000): # for c in range(0,1000): # if a+b+c == 1000 and a**2+b**2 =...
true
7b8ddb066b9a9266cc611927d69dedd26d924d12
Python
AkankshaKaple/Twitter_Sentiment_Analysis
/Model_Training.py
UTF-8
2,480
2.78125
3
[]
no_license
import pandas as pd import numpy as np import pickle import sklearn import nltk import re import warnings # To ignore warnings warnings.filterwarnings('ignore') try: data_columns = ["label", "ids", "date", "flag", "user", "tweet"] data = pd.read_csv("data.csv", encoding = "ISO-8859-1", names = data_columns) ...
true
360fce999128075214a659fba457f1e313f65bef
Python
nemesmarci/Advent-of-Code-2019
/18/common.py
UTF-8
3,185
2.859375
3
[]
no_license
from copy import deepcopy from collections import defaultdict def get_neighbours(current): up = (current[0], current[1] - 1) left = (current[0] - 1, current[1]) right = (current[0] + 1, current[1]) down = (current[0], current[1] + 1) return [up, left, right, down] def get_diagonal(current): ...
true
6dfebf262485e20840594859a69c6170d73e95e0
Python
abrikos110/school-bla
/tmp/16.3.2018/_2.py
UTF-8
232
2.546875
3
[]
no_license
from functools import lru_cache def C(n, k): if k < 0 or n < 0: return 0 if k == 0 or n == k: return 1 return C(n-1, k-1) + C(n-1, k) n, m = map(int, input().split()) print(C(max(n, m), min(n, m)))
true
e882d95f35c883cb7fb5178ed648b8db49e0b8cc
Python
guzhoudiaoke/leetcode_python3
/48_rotate_image/48.py
UTF-8
761
3.703125
4
[]
no_license
class Solution: def rotate(self, matrix): """ :type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead. """ n = len(matrix) if n <= 1: return # swap row for i in range(n // 2): matrix[i]...
true
bcac44863447bf814b0fd3de3e7309c0e5401acb
Python
AlkosGit/playlistmanager
/helpdoc.py
UTF-8
2,405
3.140625
3
[]
no_license
# file: playlistmanager/help.py from tkinter import * from style import * helptext = """ ### Playlistmanager ### ### Written in Python 3.X ### This application can save playlists (e.g. Youtube) or local directories with media files, and play the content from those sources. It is also possible to download a playlis...
true
4c4632c20e9985ec0be483b12cafdd98ed42e76e
Python
YoungXueya/LeetcodeSolution
/src/49. Group Anagrams.py
UTF-8
814
3.125
3
[]
no_license
import collections class Solution: def groupAnagrams(self, strs: List[str]) -> List[List[str]]: dic={} for w in strs: key=tuple(sorted(w)) if key in dic: dic[key].append(w) else: dic[key]=[w] return dic.values() ...
true
294fe36f749a0da6c122fc6f2f49676071e6c529
Python
smmvalan/Python-Learning
/Selenium_Automation/table.py
UTF-8
868
2.890625
3
[]
no_license
from selenium import webdriver from selenium.webdriver.common.keys import Keys import time driver=webdriver.Chrome(executable_path="C:\\python\\Python_Drivers\\chromedriver.exe") driver.get("https://krninformatix.com/learn.html") row=len(driver.find_elements_by_xpath("html/body/table/tbody/tr")) # row col=row=len(drive...
true
8550863c1c01bbc64d5528308c344accc53b263b
Python
pondruska/l5kit
/l5kit/l5kit/data/map_api.py
UTF-8
7,701
2.609375
3
[ "Apache-2.0" ]
permissive
from functools import lru_cache from typing import Iterator, Sequence, Union, no_type_check import numpy as np import pymap3d as pm from ..geometry import transform_points from .proto.road_network_pb2 import GeoFrame, GlobalId, MapElement, MapFragment CACHE_SIZE = int(1e5) ENCODING = "utf-8" class MapAPI: def ...
true
76605caf6fc75caace84604b8644793f36379a8a
Python
suzieneave/fun_stuff
/Computer Vision/blobDetector.py
UTF-8
26,258
2.90625
3
[]
no_license
import numpy as np import math import cv2, PIL, os import matplotlib.pyplot as plt import matplotlib.cm as cm import numpy as np def check_and_make_int(a): assert abs(a - int(a)) == False return int(a) def add_guard_band_2D(greyimage, bandlengthx, bandlengthy): assert abs(bandlengthy - int(bandlengthy)) == Fals...
true
d268401b875210811c95539cff4bf58d5e7dccad
Python
XiaoyangzZ/pycharm
/strategy/Python_knowledge/df.loc,iloc,ix.py
UTF-8
1,609
3.390625
3
[]
no_license
# -*- coding: utf-8 -*- import pandas as pd import numpy as np df = pd.DataFrame(np.arange(9).reshape((3, 3)), columns=['a', 'b', 'c'], index=['d', 'e', 'f']) """ a b c d 0 1 2 e 3 4 5 f 6 7 8 """ # 另外一种取dataframe种多列的方式是 print(df[1:2]) # loc:通过行标签索引数据 print(df.loc['d']) # 索引d行,但是这种应该是series格式 """ a ...
true
88f4d72dbc99b0def7298f2dba914ad1239c548e
Python
ahadnur/git_auto
/src/main.py
UTF-8
582
3.1875
3
[]
no_license
import time import datetime import argparse starting_time = time.time() version = "1.0.0" # The argument parser = argparse.ArgumentParser(prog='main') parser.add_argument("--version", required=True, help='Print the version of the code', action='store_true') args = parser.parse_args() if args.vers...
true
b1209ee53a707ef0341c5e48de0efe150b85ee24
Python
catalincoroeanu/django-rest-framework-braces
/drf_braces/utils.py
UTF-8
6,569
3.265625
3
[ "MIT" ]
permissive
from __future__ import absolute_import, print_function, unicode_literals import inspect import itertools IGNORE_ARGS = ['self', 'cls'] def find_function_args(func): """ Get the list of parameter names which function accepts. """ try: spec = inspect.getfullargspec(func) if hasattr(inspect, 'g...
true
aaeb6232223f66057793556683e6a842488d6568
Python
yphsieh/Self-tracking-Car
/cargo/python_files/main.py
UTF-8
631
2.828125
3
[]
no_license
import sys, tty, BT ser = BT.bluetooth() port = input('PC bluetooth port name: ') port = port if port != '0' else '/dev/cu.HC-05-SPPDev' ser.do_connect(port) tty.setcbreak(sys.stdin) print ('START!!') ''' while True: print (sys.stdin.read(1)) ''' pickup = 0 while True: key = sys.stdin.read(1) # key captures the...
true
f231f549cab43ad97db9988eafa595ed1735f922
Python
TheAlgorithms/Python
/sorts/cocktail_shaker_sort.py
UTF-8
1,326
4.375
4
[ "MIT" ]
permissive
""" https://en.wikipedia.org/wiki/Cocktail_shaker_sort """ def cocktail_shaker_sort(unsorted: list) -> list: """ Pure implementation of the cocktail shaker sort algorithm in Python. >>> cocktail_shaker_sort([4, 5, 2, 1, 2]) [1, 2, 2, 4, 5] >>> cocktail_shaker_sort([-4, 5, 0, 1, 2, 11]) [-4, 0...
true
66f2433a1d4ed218e4a6b11849f0ad4928d4f26a
Python
Senuch-Uzair-Tariq/Workspace
/Python Mark Lutz- Volume 1/Python117.py
UTF-8
132
2.546875
3
[]
no_license
print\ ("Wow"); s=("asd""222""333" "asd"); print(s) s={'a','b'}; print(s) print((3 and 2,1 or 2)); print((3 and [],[] or 1));
true
91969e7ae60e2b7b1223ac995a19c2f7db29ec0d
Python
Victor835xd/AlgoritmosSistemas
/ago-dic-2020/VictorDeLeon/Practica4/palindromo.py
UTF-8
296
3.71875
4
[]
no_license
palabra = input() cont = 0 palab = 0 for i in reversed(range(0, len(palabra))): if palabra[i].lower() == palabra[cont].lower(): palab += 1 cont += 1 if len(palabra) == palab: print("El texto es palindromo!") else: print("no es un palindromo")
true
cded45556b803d75fb61f6c1d6b44d2d99f19b7e
Python
Kotti/kotti_boxes
/kotti_boxes/tests/test_functional_text.py
UTF-8
2,297
2.640625
3
[ "BSD-3-Clause-Modification" ]
permissive
# -*- coding: utf-8 -*- """ Created on 2015-01-27 :author: Davide Moro (d.moro@truelab.eu) """ from pytest import mark from pytest import fixture @fixture def dummy_manager(root): from kotti_boxes.resources import RightBoxManager root['right'] = cc = RightBoxManager() return cc def test_login_requi...
true
e14e2ff9efc2ea140f006a84ba93d26f1100171e
Python
tim-clifford/pycalc
/main.py
UTF-8
3,070
2.9375
3
[ "MIT" ]
permissive
import chk,calc,test,cnst,trig import sys # Surely I am allowed to get command line options #NOTE: infix operator control characters must be one character OPERATORS = [ [ # Infix [['^'],lambda a,b: a**b], [['C'],trig.comb], [['x','*'],lambda a,b: a*b], [['/'],lambda a,b: a/b]...
true
6ebb6ba68906b9c36cb4376cc7984e08e71a535b
Python
hemangini23/Hello
/mysite/passwordGen.py
UTF-8
98
2.890625
3
[]
no_license
import random pattern = "1234567890" len = 4 otp = "".join(random.sample(pattern,len)) print (otp)
true
f239565d4eaca95c5c1f6c3e0a2ac62e9b1941f7
Python
CloseToAlgoTrading/CodeFromVideo
/Portfolio_Testing_Framework/Models/base_SelectionModel.py
UTF-8
573
2.921875
3
[]
no_license
# base model class Base_SelectionModel: def __init__(self, bt, assets): # <- bt -> reference to backtrader self.assets = assets # assets -> asset dictionory self.bt = bt pass def get_assets(self, data=None): # <--- Input pandas data frame return self.assets ...
true
d566c1d22800e1693d1123155fed5270ef56ab19
Python
lexypakzaban/Shrek-Game
/Shrek Game/pygame_main.py
UTF-8
10,213
3.4375
3
[]
no_license
__author__ = 'Lexy' # put your name here!!! import pygame, sys, traceback, random from pygame.locals import * GAME_MODE_MAIN = 0 GAME_MODE_TITLE_SCREEN = 1 GAME_MODE_GAME_OVER = 2 GAME_MODE_YOU_WON = 3 # import your classFiles here. from ShrekFile import Shrek from LordFile import Lord from PieFile import Pie # ==...
true
b58f837e1d5597dc4625cbd17eea97496d1e1d25
Python
zuzanna-f/pp1
/03-FileHandling/03.20.py
UTF-8
207
3.0625
3
[]
no_license
with open('numbers.txt', 'r') as file: for line in file: if int(line)%2 == 0: with open('evennumbers.txt', 'a') as file: file.write(line)
true
7f749a4588fe77121a712ef8f3f1e478c2ec174f
Python
gamblinflanagan/DNS-client-server
/server.py
UTF-8
1,795
2.734375
3
[]
no_license
''' Joseph Flanagan jcf29 004 ''' #! /usr/bin/env python3 # Echo Server import sys import struct import struct import time import json #import socket from socket import * # Read server IP address and port from command-line arguments serverIP = sys.argv[1] serverPort = int(sys.argv[2]) returnCode = 1 fileName = 'dns-...
true
4ad0a781628a3410303ec3825c09c299db5f511e
Python
goboden/learn-python-homeworks
/week1/08_functions.py
UTF-8
133
3.390625
3
[]
no_license
def get_summ(one, two, delimiter='&'): return delimiter.join((str(one), str(two))).upper() print(get_summ('Learn', 'python'))
true
5c863c70e310e17e4dc177cb74df842f5538e47a
Python
ngeissel/Gladys_Deezer
/gladys_start.py
UTF-8
3,751
2.59375
3
[]
no_license
#!/usr/bin/env python # coding: utf8 import subprocess import json import urllib2 import Queue import threading import sys import ctypes import time from myDeezerApp import * from text_recognition import * global project_location global gladys_location project_location = "." # A MODIFIER gladys_location = "/usr/lib...
true
fb8db05d4d64db3353c1a9833c99bdbbfb24bb23
Python
ossayed/hackerrank-problems
/Implementation/divisble-sum-pairs.py
UTF-8
662
3.0625
3
[]
no_license
#!/bin/python3 import sys #https://www.hackerrank.com/challenges/divisible-sum-pairs/problem def divisibleSumPairs(n, k, ar): # Complete this function num_sol = 0 for x in range(0,n): for y in range(1,n-x): pot_sol = 0 pot_sol = ar[x] + ar[x + y] #print(pot_...
true
c2bd783a75eed1c4878ab962fd63483413158c04
Python
ryancollingwood/neo4j-flask
/common/text_utils.py
UTF-8
1,334
3.328125
3
[]
no_license
import re import string import unicodedata class TextCleanUp: @staticmethod def is_empty_string(value: str): if value is None: return True if value.strip() == "": return True return False @staticmethod def remove_double_whitespace(value: str): ...
true
05617e01b61f9c4cc4fb4970f86decc5f20bdacc
Python
bullfest/sudokusolver
/solver.py
UTF-8
2,677
3.765625
4
[]
no_license
import itertools from typing import List, Optional, Any, Iterator def constrain(area: List[List[int]]) -> int: """ Constrain options in area so that values are unique in the area :returns The number of positions constrained to a single value """ n_solved = 0 for i, list1 in enumerate(area): ...
true
3db520f01a76706856d11ed53c67a5b5f195a16b
Python
Asperas13/leetcode
/problems/150.py
UTF-8
713
3.15625
3
[]
no_license
class Solution: def evalRPN(self, tokens: List[str]) -> int: stack = [] def _add(x, y): return x + y def _substract(x, y): return x - y def _multiply(x, y): return x * y def _divide(x, y): return int(x / y) OPERATOR...
true
007c1771448b5cc4c667376c6b8bddab4b632775
Python
Shob11097/100-s-of-MINI-PROJECTS
/93.Age calculator.py
UTF-8
307
3.09375
3
[]
no_license
#Age calculator from _datetime import date try: def calculate_age(dtob): today = date.today() return today.year - dtob.year - ((today.month, today.day) < (dtob.month, dtob.day)) print() print(calculate_age(date(1997,10,1))) except: print("Enter a val;id input!")
true
84044960ff440f089d36c77e7221803cc5f2f863
Python
CakeFTW/AI-miniproject
/lstm_simple.py
UTF-8
1,925
2.65625
3
[]
no_license
import pandas as pd import numpy as np import dataprocess as dp import json from keras.models import Sequential from keras.layers import Dense from keras.layers import LSTM from sklearn.model_selection import train_test_split from sys import argv k_fold = False if argv[1] == '1': print("performing kfold valida...
true
d69a8769ca2c70b7b8a3572efc818952a4b4d86f
Python
bingli8802/leetcode
/1104_Path_In_Zigzag_Labelled_Binary_Tree.py
UTF-8
631
3.359375
3
[]
no_license
class Solution(object): def pathInZigZagTree(self, label): """ :type label: int :rtype: List[int] """ # 思路就是看在正常编号的二叉树中,“之” 字形是怎样的路径 # 在正常二叉树上按“之” 字形寻路就是每次跳到该层对称的子树上 # int(math.log(label,2))用来计算层数 ans = [] while label: ans.insert(0,...
true
a6d498d9d6bf20d3251e611645d8ddd993d4a4a9
Python
willATgithub/InterviewPrep
/src/delete_node.py
UTF-8
602
3.9375
4
[]
no_license
class LinkedListNode: def __init__(self, value): self.value = value self.next = None def __repr__(self): return "%s , %s" % (self.value,self.next) def delete_node(node): if node.next: node.value = node.next.value node.next = node.next.next else: ...
true
56c6d60f4bb8a62b3877234be73e79101a631e5b
Python
LakshBhambhani/Swiffee-Minikame-Simulator
/QuadrupedPi/Quadruped/TurningTest.py
UTF-8
265
2.703125
3
[ "MIT" ]
permissive
import Quadruped import time quad = Quadruped.Quadruped() try: print("Running turning test") for x in range(6): quad.turnLeft() time.sleep(1) for x in range(6): quad.turnRight() time.sleep(1) except: quad.homePos()
true
21953ef266c77759e96d13cccaf095a568ce45f7
Python
AaVaS270/ALLCA
/day5.py
UTF-8
1,622
4.46875
4
[]
no_license
#1 '''def max(): A,B,C=int(input('Give a number')),int(input('Give another number')),int(input('Give a number')) if A>B and A>C: print(f'{A} is the greatst') elif B>A and B>C: print(f'{B} is the greatest') else: print(f'{C} is the greatest') max()''' #2 '''def month(nu): i...
true
1c70453daea0c64ca7b025425eb31d87dec716bd
Python
AmalSiby/Lets-Learn-Git
/diff.py
UTF-8
47
3.171875
3
[]
no_license
a = 1 b = 3 print("The difference is : ", b-a)
true
a03c41a19d8da42afe05b475def4e790eda495ab
Python
LETE-CRC/LETE-Experimental
/PIV/Python/crcPIV/classes/ReadData.py
UTF-8
3,752
2.640625
3
[]
no_license
""" =============================================================================== Python code for PIV analysis Created by Combustion Research Center CRC at LETE - Sao Paulo, Brasil Laboratory of Environmental and Thermal Engineering - LETE Escola Politecnica da USP - EPUSP =========...
true
6bfe63861a2326c40d105e5f5b1d694d3fa913fb
Python
sharmasourab93/knowledgebase
/kb/views.py
UTF-8
4,482
2.640625
3
[]
no_license
from pyramid.view import view_config #TODO: Do Not Use transaction from transaction import manager from .models import DBSession from .models import DictionaryCombo as Page from .eng_dictionary import Dictionary as Parser from sqlalchemy.orm.exc import NoResultFound class Views(object): def __init__(self, ...
true
9eefb43118651897e4cb62b6a5596ff8ab72d55f
Python
lsky2061/code-2021-team-sapphire
/streamlined/FormularyLookup.py
UTF-8
2,717
2.828125
3
[]
no_license
import pandas as pd import numpy as np import pickle df = pd.read_csv("formulary.csv") def InFormulary(payer,drug): #Check for valid input if not(drug in df.columns): outstring = "Error! Drug is not valid." elif not( (df['Payer'] == payer).any()): outstring = "Error! Payer is not valid." ...
true
b23491720c6c9e5cf516703db557c5cf8f2d182a
Python
sergey3012/4_json
/pprint_json.py
UTF-8
691
3.203125
3
[]
no_license
import json def load_data_json(filepath): with open(filepath, 'r', encoding='utf-8') as file: return json.load(file) def pretty_print_json(json_data): return print(json.dumps(json_data, ensure_ascii=False, indent=4, sort_keys=True)) if __name__ == '__main__': try: filepath = input('Вве...
true
f1914f7547c7db176ad0063e9cd55984bd6624ab
Python
yue-w/LeetCode
/Algorithms/91. Decode Ways.py
UTF-8
721
3.34375
3
[]
no_license
class Solution: def numDecodings(self, s: str) -> int: ## the key of len(s) is empty string memo = {} return self.recursion(s, 0, memo) def recursion(self, s, i, memo): ## Base case: if s[i:] == '': memo[''] = 1 return 1 if s[i] == '0': ...
true
0725f0fa268c14c3a6d14f58599e771ce7be0c03
Python
DerNerger/Python
/Standardbib/passGenerator.py
UTF-8
177
3.109375
3
[]
no_license
import random import string def id_generator(size=8 , chars=string.letters + string.digits): return ''.join(random.choice(chars) for _ in range(size)) print id_generator()
true
76b0032d8204525813b22a9e2e02751443f871fd
Python
Anandjeenkeri/Python
/leaderInArray.py
UTF-8
270
2.9375
3
[]
no_license
def leader(arr): res = [] leader = arr[0] i = 0 print(len(arr)) for i in range(0, len(arr)): for j in range(i+1, len(arr)): if arr[i] <= arr[j]: break if j == len(arr)-1: print(arr[i]) if __name__ == "__main__": leader([6,7,15,1,3,4,5])
true
0467c7e159e3d2a6331e2e9f581d2007fcef8050
Python
Ashwin2999/xobin-challenge
/decimal to binary.py
UTF-8
1,162
4.375
4
[]
no_license
'''Given a number N, Write a program that generates and prints the value of all binary numbers from 1 to N. Input:The test case contains an Integer N. Output: Print all binary numbers with from 1 to n . The output for the testcase must be in a single line and space separated. Note:The Binary digits are separated by ...
true
5c4e224bc7e97c79e115a1fffb8b719c768e9f3c
Python
myungit/42ai
/ex01/exec.py
UTF-8
270
3.46875
3
[]
no_license
import sys args = ' '.join(sys.argv[1:]) result = "" i = len(args) - 1 while i >= 0: if args[i].isupper(): result += args[i].lower() elif args[i].islower(): result += args[i].upper() else: result += args[i] i -= 1 print(result)
true
e0fa20da7a786dd42a8423e999bf5accdb61bee9
Python
Yu-jinKim/Projects
/Monopoly/gui_monopoly.py
UTF-8
18,976
3.15625
3
[]
no_license
""" Monopoly game GUI done in PyQt5 using monopoly_core.py """ import sys import time from PyQt5.QtWidgets import ( QLineEdit, QWidget, QApplication, QLabel, QMainWindow, QGridLayout, QPushButton, QStackedWidget, QVBoxLayout, QHBoxLayout, QMessageBox, QErrorMessage, ...
true
d02bf03446ebcf10b6cb6cd50e34f1f498f7e94e
Python
mattany/gomoku
/gym_test.py
UTF-8
3,686
2.78125
3
[]
no_license
import gomoku_env from gomoku_env import GomokuEnv, board_domination_heuristic import numpy as np import random from IPython.display import clear_output import gym gym.register('Gomoku-v0', entry_point=GomokuEnv) env = gym.make('Gomoku-v0') # for i_episode in range(1000): # observation = env_a.reset() # for t ...
true
34d8ad80ee30830b0082ddafca53d82b6d4cc251
Python
skyrise11/AI-Programming-With-Python-Udacity-NanoDegree
/get_pet_labels.py
UTF-8
3,318
3.390625
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # */AIPND-revision/intropyproject-classify-pet-images/get_pet_labels.py # # PURPOSE: Create the function get_pet_labels that creates the pet labels from # the image's filename. This function inputs: # - The Image Folder as image_dir within get_pet_label...
true
292281e486b5c492afa549587fcb3e1501e90d83
Python
perovai/deepkoopman
/aiphysim/losses.py
UTF-8
6,719
2.734375
3
[ "MIT" ]
permissive
import traceback as tb import numpy as np import torch from aiphysim.utils import timeit class BaseLoss: def __init__(self, opts, is_loss=True): self.weights = ( {name: float(weight) for name, weight in opts.weights.items()} if is_loss else {} ) self....
true
72e443fa19df6c6d286a56bc2ff7c9e7b9e5035f
Python
stefanduscher/stefanduscher
/Anfänger_Tag4_Fenster4.py
UTF-8
1,087
3.59375
4
[]
no_license
# Programm: Fenster 4 # # Datum: 11.10.2019 # # Autor: Stefan Duscher # # Bemerkungen: Beispiel VHS-Kurs zum Einsatz eines GUI (graphic user interface) # # --------------------------------------------------------------------------------- """ Widgets sind alle Bausteine, mit denen man dann e...
true
b9f3c36ae69bdccd9cd5792ec15551da6cde1bec
Python
Andrewpqc/mana
/mana/templates/models/_models_code.py
UTF-8
4,220
2.796875
3
[ "MIT" ]
permissive
# coding: utf-8 _models_code = '''# coding: utf-8 from . import db # write your database model here ''' _rest_models_code ='''# coding: utf-8 import base64 from app import db from flask import current_app from itsdangerous import URLSafeSerializer as Serializer from werkzeug.security import generate_password_hash,...
true
2876d1a30a8e8f0098c3a5bb49853b8ba6c13efd
Python
eberlawrence/openDVS
/edu_files/Detection/segmentationUtils.py
UTF-8
16,001
2.671875
3
[]
no_license
import copy import math import numpy as np import cv2 as cv import matplotlib.pyplot as plt from iou import iou from classifierTools import classifierTools from skimage.morphology import erosion, dilation, opening, closing, white_tophat,square,convex_hull_image from filterUtils import filterUtils class segmentationUti...
true
8979f18605551ef84aef9216ae04df25d4e55450
Python
iandavidson/SeniorResearchProject
/SeniorResearch/period5/regularLanguage.py
UTF-8
12,306
3.078125
3
[]
no_license
############################################################################### # Author : Ian Davidson # # Class: CS496 Senior Capstone Project # # Date: March 5, 2019 # # About: This...
true
b17c060eca33ba0f20cab1346146d2356701ed88
Python
User32Q/HService
/app/routes.py
UTF-8
3,202
2.53125
3
[ "MIT" ]
permissive
from app import app from flask import jsonify from flask import request from hashlib import md5 from threading import Thread import urllib3 import os import smtplib #Для хранения задач используем список словарей tasks = [ { 'id' : 0, 'status' : None, 'md5' : None, 'url' : None } ] #Основная функция для вычи...
true
b82561dfbeb1764d472b7cc6337ab2013a6f6775
Python
AshiishKarhade/Competitive-Programming-using-Python-C-
/cses/week_1/1_weird_algorith.py
UTF-8
749
4.625
5
[]
no_license
""" PROBLEM Consider an algorithm that takes as input a positive integer n. If n is even, the algorithm divides it by two, and if n is odd, the algorithm multiplies it by three and adds one. The algorithm repeats this, until n is one. For example, the sequence for n=3 is as follows: 3→10→5→16→8→4→2→1 Your task is...
true
fd792d1c18275aad7565d10c297258ea3440ca3e
Python
hamishhuggard/triage_concept_drift
/driftviewer/panels.py
UTF-8
8,060
2.671875
3
[]
no_license
import dash import dash_core_components as dcc import dash_html_components as html import plotly.graph_objects as go from dash.dependencies import Input, Output import pandas as pd import numpy as np import itertools from collections import Counter import re import os from plots import * ###########################...
true
4b89c82546050393aee6831feb9da9c04bf60480
Python
devarshi7/Dynamic-Genre-Classification
/cap_package/ReadTransform.py
UTF-8
10,107
3.09375
3
[]
no_license
import numpy as np import pandas as pd import random import re from sklearn.preprocessing import OneHotEncoder # -------------------------------------------------------------------------------- # Functions for reading and transforming dataset # -------------------------------------------------------------------------...
true
ee87e87fcbec908fac98c720dcf75c711a0ebd73
Python
bilal-dsu/Guru-workflow
/11.CollaborationCent.py
UTF-8
2,742
2.703125
3
[ "MIT" ]
permissive
""" Created on Sun Nov 24 2019 @author: Bilal Hayat Butt, Sufyan Faizi @Description: The code is used to apply centrality analysis on collaboration network First, collaboration network graph is loaded in memory Second, SNAP and Netoworkx python API's were used to calculate the scores of below centrality measures...
true
86bb8ef0836b86d9aafbf17d3ae50d2c488bfe34
Python
Renovamen/metallic
/metallic/metalearners/mbml/protonet.py
UTF-8
2,806
2.703125
3
[ "MIT" ]
permissive
from typing import Callable, Optional, Tuple import higher import torch from torch import nn, optim from .base import MBML from ...utils import get_accuracy from ...functional import get_prototypes, get_distance_function class ProtoNet(MBML): """ Implementation of Prototypical Networks proposed in [1]. `...
true