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
d7e6a365d31f1a3f4a2618907a63391624657524
TeamHG-Memex/quickpin
/lib/model/avatar.py
UTF-8
1,554
2.515625
3
[]
no_license
from datetime import datetime import io import os import re import urllib.parse from PIL import Image from sqlalchemy import Column, DateTime, ForeignKey, Integer, Table, Text from sqlalchemy.orm import relationship import app.config from model import Base from model.file import File THUMB_SIZE = (32, 32) class A...
true
b75d160424650ee0ef02c8185cc701f887e4ee9b
david-grey/BESTAT
/src/api/crime.py
UTF-8
2,309
2.78125
3
[]
no_license
# encoding: utf-8 ''' @author: ZiqiLiu @file: crime.py @time: 2017/10/8 下午2:59 @desc: ''' # https://spotcrime.com/pa/pittsburgh/daily-blotter/2017-10-07 # https://spotcrime.com/pa/pittsburgh/neighborhoods # https://spotcrime.com/pa/pittsburgh/allegheny+center import requests import pickle from api.circle import...
true
66bd8df92dee62af55db850cafb2f5dc768a443f
adnan-77/data_science
/5th May Assignments/case study 2/question_4.py
UTF-8
169
4.5
4
[ "MIT" ]
permissive
# 4. Write a for loop that prints all elements of a list and their position in the list. a = [4, 7, 3, 2, 5, 9] for ele in a: print(f"{ele} - {a.index(ele) + 1}")
true
4c3975c97fcd49ddd2454b2c26be3ff5ae3046a5
arsenomadridabin/projecteuler
/factors.py
UTF-8
627
3.15625
3
[]
no_license
# def factors(num): # divisors=[] # for i in range(1,int(num/2)+1): # if not num%i: # divisors.append(i) # divisors.append(num) # return divisors # print(factors(50005000)) # from functools import reduce # def factors(n): # return set(reduce(list.__add__, # ([i, n...
true
a12609b983a83ea88a950c1ab3fca67b9c217057
agentdisguise/projects-2018-1
/database/company.py
UTF-8
1,125
3.3125
3
[]
no_license
import json class Company: def __init__(self): self.name = None self.url = None self.languages = None self.formality = None self.size = None self.locations = None def populate(self, json): self.name = json['name'] self.url = json['url'] s...
true
fbeadf4bfa03c6a8816acd6a5ef330e089b79f90
preetum/ballbot
/demos/court/gui.py
UTF-8
3,887
2.953125
3
[]
no_license
import random, time, thread import numpy from Tkinter import * import models, util from filter import ParticleFilter class Simulator: def __init__(self, particleFilter=None): self.pf = particleFilter self.width = 800 self.height = 600 self.scale = 0.5 self.border = 20 s...
true
56bb38a3416af831b4c89da83bec39fa43084fad
Taospirit/HITsz_Course_Code
/CV_py/solvePNP_ex.py
UTF-8
2,867
2.890625
3
[]
no_license
# 原文说明链接:https://www.cnblogs.com/subic/p/8296794.html import cv2 import numpy as np import math # 世界坐标系上的坐标 object_3d_points = np.array(([0, 0, 0], [0, 200, 0], [150, 0, 0], [150, 200, 0]), dtype=np.double) # 图像坐标系上的坐标 object_2d_point =...
true
3c86b124ee41e3ee71591efac3efe5e2177a3acf
dr-dos-ok/Code_Jam_Webscraper
/solutions_python/Problem_74/860.py
UTF-8
617
3.09375
3
[]
no_license
#!/usr/bin/python import sys import math if __name__=="__main__": data = sys.stdin.readlines() number = int(data[0]) for times in xrange(0, number): print "Case #%d:" % (times+1), line = data[times+1].split(' ') n = int(line[0]) line = line[1:] t = {'O':0, 'B':0} ...
true
8d0cfbe91bca7550c75c80415b5b211665ba5258
samedii/neighbour-kde
/simple.py
UTF-8
1,347
2.53125
3
[]
no_license
import scipy.stats import matplotlib.pyplot as plt import numpy as np import scipy.optimize import scipy.integrate np.random.seed(1) #weight based on distance from interesting point #extra-/inter-polate points (move them) len_y_data = 100 y_data = scipy.stats.norm.rvs(loc=0, scale=1, size=len_y_data) #plt.hist(y_d...
true
40837731ef14be8b014e8b3b31c052aef7358ae6
segerphilip/ProLang
/Homeworks/homework2.py
UTF-8
10,680
3.5
4
[]
no_license
############################################################ # HOMEWORK 2 # # Team members: Hannah Twigg-Smith, Philip Seger # # Emails: Hannah.Twigg-Smith@students.olin.edu, Philip.Seger@students.olin.edu # # Remarks: # We spent about 8 hours on this assignment, but we were unable to complete a # fully functional vers...
true
0cd7a29b472dfb6e81cf621d13b212e9b55770e0
linruohan/my_study
/Python/python_study/decorator/装饰器/staticmethod内置装饰器.py
UTF-8
276
2.984375
3
[]
no_license
class Foo(object): """docstring for Foo.""" @staticmethod def static_method(msg): print(msg) def member_method(self,msg): print(msg) f=Foo() f.member_method("sdfsadfa") f.static_method("static msg") Foo.static_method("chang shi hero ling")
true
83c96e6451733fb071fd3b61b93c8696ba465ab3
JakubPetriska/poker-agent-kit
/test/sampling_tests.py
UTF-8
2,099
2.828125
3
[ "MIT" ]
permissive
import unittest import os import numpy as np from tools.sampling import read_log_file from tools.walk_trees import walk_trees_with_data from tools.game_tree.nodes import ActionNode, BoardCardsNode, HoleCardsNode LEDUC_POKER_GAME_FILE_PATH = 'games/leduc.limit.2p.game' class SamplingTests(unittest.TestCase): def...
true
28db19d6ccc9248fb5c2b269c7a934724dc7f687
nh295/Connect4
/AIPlay.py
UTF-8
3,757
3.09375
3
[]
no_license
from connect_four import Game from connect_four import NONE, RED, YELLOW import random from connect_four_eval import BoardEvaluation from minimax import minimax_decision from cross_mutate import sbx, pm def play(games, win, player1, player2): player1_wins = 0 player2_wins = 0 ties = 0 last_winner = -1...
true
f4e147daf94a042ed1444b91433438db527caaad
fmsdwifull/python
/operfile.py
UTF-8
320
3.140625
3
[]
no_license
#!/usr/bin/python #coding=utf-8 def read_file(file): with open(file, 'r') as f: print(f.read()) # 输出语句 f.close() def write_file(file): with open(file, 'a') as f: for i in range(10): f.write(str(i) + '\n') f.close() file = 'test.txt' write_file(file) read_file(file)
true
671e9f3b773db9882762f412ef1afdb077811d47
AnthonyMChong/leetcodepractice
/escape-the-ghosts/escape-the-ghosts.py
UTF-8
881
3.71875
4
[]
no_license
#you are at 0,0 #dest is at target[0] target[1] #true for 100% can escape False for cannot escape #will need to change if ghost can be both farther away from the target than you AND catch you... #possibly need to check every tile of your movement to see if a ghost could have reached within time def canEscape (ghosts ,...
true
ddccd2a4b88130142b117c31b9f8cb3c3f68ecc8
chanaabramov/csci127-assignments
/hw_04/list.py
UTF-8
2,234
3.90625
4
[]
no_license
import random def build_random_list(size,max_value): """ Parameters: size : the number of elements in the list max_value : the max random value to put in the list """ l = [] # start with an empty list # make a loop that counts up to size i = 0 while i < size: l.append(r...
true
55cf6538909c1beeeb5c347cfd5c6a4e9d5ca21a
jhorey/koopa
/koopa/generator/bash.py
UTF-8
924
2.578125
3
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
""" Bash generator. """ class BashGenerator(object): def gen_install(self, parent_dir, req_file): """ Generate the installation process for the Python script. """ # Read in the requirements file. with open(os.path.join(parent_dir, req_file), 'r') as f: require...
true
8417a8e0181933cd9cbfece6df8d3fc7fe8ce26d
chfouka/Neural-Network
/item/LOC/adaptssv.py
UTF-8
214
2.625
3
[]
no_license
import sys import csv out_file = open(sys.argv[2], "w") trainingSet = open(sys.argv[1]) for row in trainingSet: line = row.rstrip('\n') t = line.rstrip(',') t = t + '\n' out_file.write(t) out_file.close()
true
abbeaac0498d04a2de72d1d56a4b8c9c9775fec7
tastypenguinbacon/college
/TS/optymalizacja/main.py
UTF-8
3,330
2.734375
3
[]
no_license
from itertools import tee import numpy as np from control import tf, step from scipy.optimize import minimize from plot import Plot, PlotData, grid, title day_of_birth = 11 month_of_birth = 8 def trim(min_limit, max_limit): def wrapper(func): def wrapped(*args): result = func(*args) ...
true
c2bb4b67a71017574449402fc9e8c7c84f193207
erjan/coding_exercises
/word_pattern_ii.py
UTF-8
7,609
3.875
4
[ "Apache-2.0" ]
permissive
''' Given a pattern and a string s, return true if s matches the pattern. A string s matches a pattern if there is some bijective mapping of single characters to strings such that if each character in pattern is replaced by the string it maps to, then the resulting string is s. A bijective mapping means that no two c...
true
60351acafbed5baa2343fe8b1069be2f5e7f67d2
nimitm97/CryptoTrading-Bot
/ta.py
UTF-8
272
2.671875
3
[]
no_license
import numpy import talib from numpy import genfromtxt my_data = genfromtxt('15minutes.csv', delimiter=',') print(my_data) close = my_data[:,4] print(close) # moving_average = talib.SMA(close, timeperiod=10) # print(moving_average) rsi = talib.RSI(close) print(rsi)
true
7f6f6039fbb39a4a320613062ab361ceb7a52fc3
zdenek-nemec/sandbox
/billions/data_generator.py
UTF-8
421
3.40625
3
[ "MIT" ]
permissive
import random TIME_FORMAT = "%Y-%m-%d %H:%M:%S" CUSTOMERS = [1, 2, 3, 4] SITES = ["Alpha", "Beta", "Gamma"] LOCATIONS = ["N", "E", "S", "W"] def main(): print(f"Hello, World!") random_customer = random.choice(CUSTOMERS) random_site = random.choice(SITES) random_location = random.choice(LOCATIONS) ...
true
4ed3dae36ff84dfbb2c8cd609989f5e644aa27f1
Aasthaengg/IBMdataset
/Python_codes/p03607/s111484439.py
UTF-8
149
3.46875
3
[]
no_license
n = int(input()) li = set() for i in range(n): x = int(input()) if x in li: li.remove(x) else: li.add(x) print(len(li))
true
f17d2a88ffb5df0787ebaaa84bc2db5d473efefa
shubhamoli/solutions
/leetcode/medium/79-Word_search.py
UTF-8
1,679
3.828125
4
[ "MIT" ]
permissive
""" Leetcode #79 """ from typing import List class Solution: def exist(self, board: List[List[str]], word: str) -> bool: if not board or not word: return False if not board[0]: return False m = len(board) n = len(board[0]) # using separate v...
true
edb9530d0cdde4b1e27813f647b0c6cbd8375599
maxkferg/mobile-robot-controller
/webserver/application/schema.py
UTF-8
1,739
2.921875
3
[ "MIT" ]
permissive
import os import graphene from .hardware import MotorController, clip_verbose isProd = os.environ.get('PROD') motor = MotorController(isProd) class CarState(graphene.ObjectType): """Mutation return value""" leftWheel = graphene.Float() rightWheel = graphene.Float() def set_state(self, left_wheel, ri...
true
e3180610436c183b613144608bd453f764cf9c7e
django/django
/tests/string_lookup/tests.py
UTF-8
2,440
3.078125
3
[ "LicenseRef-scancode-other-copyleft", "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause", "GPL-1.0-or-later", "Python-2.0.1", "LicenseRef-scancode-free-unknown", "LicenseRef-scancode-other-permissive", "Python-2.0" ]
permissive
from django.test import TestCase from .models import Article, Bar, Base, Child, Foo, Whiz class StringLookupTests(TestCase): def test_string_form_referencing(self): """ Regression test for #1661 and #1662 String form referencing of models works, both as pre and post reference, on...
true
721c5bc4446515a34e7c6989fd3f632bf1497cd3
bhatiakomal/pythonpractice
/Udemy/Multitasking/Set_And_Get_Thread_Name.py
UTF-8
1,128
3.515625
4
[]
no_license
from threading import Thread,current_thread def disp(): print("child thread object",current_thread()) #From this we can know name of thread t=Thread(target=disp()) t.start() print("main Thread",current_thread()) print() from threading import Thread,current_thread def disp(): print("child thread Name",current_t...
true
7ab02b2b68021028b8a706924c1e925b699ca65e
peace098beat/SignalProcessingApp
/Example/spectrumAnalyser1.py
UTF-8
1,560
2.828125
3
[]
no_license
# -*- coding: utf-8 -*- """ sox な感じにスペクトログラムを表示する。 """ from scipy import hanning, hamming, histogram, log10 # from scikits.audiolab import wavread from AudioAnalyser01.FiSig.audiolab import wavread from matplotlib import pylab as pl from stft import stft # ===============================...
true
29f721cca192cc43ca6bc1018dc6ece152a87096
jionjion/Python_WorkSpace
/PythonBase/src/grammar_modules/tiems_modules/time_module.py
UTF-8
1,669
3.75
4
[]
no_license
# -*- coding: utf-8 -*- ''' Time模块 公开了底层C库中与时间相关的功能,比较基础 它包括用于检索时钟时间和处理器运行时间的函数,以及基本的分析和字符串格式化工具。 ''' import time if __name__ == '__main__': # 获得当前秒数,可以根据操作系统认为设定系统时间 1970年1月1日0时 print(time.time()) # 格式化,可以传入时间秒数,获得当时时间 print(time.ctime(time.time() + 30)) # 获得当前...
true
2ecc9be4a227bda5a8941e85749e7586b84bab3c
jackiekuen2/health-insurance-pricing
/regression_model/preprocessing/outlier_remover.py
UTF-8
1,274
3.21875
3
[]
no_license
import pandas as pd import numpy as np from sklearn.base import BaseEstimator, TransformerMixin class OutlierRemover(BaseEstimator, TransformerMixin): """Remove outliers""" def __init__(self, variables=None, factor=1.5): self.factor = factor if not isinstance(variables, list): sel...
true
7d472e604b371e420e6c21f90928b9b440721c9e
Coding-Crashkurse/Flask-APIs-YouTube
/02_Intermediate/app/models.py
UTF-8
959
2.796875
3
[]
no_license
from flask_sqlalchemy import SQLAlchemy from sqlalchemy import Column, Boolean, Integer, String, Float def setup_db(app, database_path): app.config["SQLALCHEMY_DATABASE_URI"] = database_path app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = True app.config["TESTING"] = True db.app = app db.init_app(ap...
true
c51ba5da0d9aabc4822bd89ee1c89f5a9cf22209
luisjogl/TDD-in-Python
/dvd_library_TDD2/test/donate_movie_test.py
UTF-8
591
2.6875
3
[]
no_license
import unittest import os, sys CURRENT_DIR = os.path.dirname(os.path.abspath(__file__)) sys.path.append(os.path.dirname(CURRENT_DIR)) from movie import Movie from library import Library class DonateMovieTest(unittest.TestCase): def setUp(self): self.movie = Movie() self.library = Library() ...
true
6d6dd74956cbcbf567cea8c92b5c47231f60f86b
CW-Huang/CP-Flow
/lib/distributions.py
UTF-8
302
2.765625
3
[ "MIT" ]
permissive
import torch import numpy as np Log2PI = float(np.log(2 * np.pi)) def log_normal(x, mean, log_var, eps=0.00001): z = - 0.5 * Log2PI return - (x - mean) ** 2 / (2. * torch.exp(log_var) + eps) - log_var / 2. + z def log_standard_normal(x): z = - 0.5 * Log2PI return - x ** 2 / 2 + z
true
8a4ae3b87c5cf4eacbef91bda3279275280b6d06
Prashant-Bharaj/A-December-of-Algorithms
/December-09/python_Raahul46_IS_THIS_URL.py
UTF-8
409
3.53125
4
[]
no_license
#!python3 """ Hi there. This file doesn't contain any code. It's just here to give an example of the file naming scheme. Cheers! """ import validators def isurl(link): value=validators.url(link) if(value==True): print("It is a URL") else: print("It is not a URL") def main(): string=str(in...
true
6f20aa7d5996af85186790f7c11f1cf14caeab25
kyeah01/Problem_Solving
/code/codexpert/뿌요뿌요.py
UTF-8
1,573
3.109375
3
[]
no_license
def solution(): def pprint(): for i in range(h): print(*board[i]) print() direction = ((0,1), (1,0), (0,-1), (-1,0)) def gravity(): for j in range(w): temp = [] for i in range(h-1, 0, -1): if board[i][j] != '.': ...
true
980e9e2a4aa17f253fae84cafc70d180bf03d9c3
FoothillCollege/StemCenterAnalytics
/stem_center_analytics/utils/io_lib.py
UTF-8
25,680
3.171875
3
[]
no_license
"""Collection of I/O Database functionality. Notes ----- * All IO functions in io_lib assume UTF-8 encoding ONLY * All output functions are made flexible such that empty data structures are still written to disk without error. Likewise, empty files return their corresponding empty data structure. It's important to...
true
8d4d412fc1b863924315e3ad01fb493eebdbe755
xudalin0609/leet-code
/BFS/cloneGraph.py
UTF-8
1,708
3.875
4
[]
no_license
# LintCode 137 """ 137. 克隆图 中文English 克隆一张无向图. 无向图的每个节点包含一个 label 和一个列表 neighbors. 保证每个节点的 label 互不相同. 你的程序需要返回一个经过深度拷贝的新图. 新图和原图具有同样的结构, 并且对新图的任何改动不会对原图造成任何影响. 样例 样例1 输入: {1,2,4#2,1,4#4,1,2} 输出: {1,2,4#2,1,4#4,1,2} 解释: 1------2 \ | \ | \ | \ | 4 说明 关于无向图的表示: http://www.lintc...
true
01497bb1e67dc181d36d667a23ef45d8b8aef9a7
liubiggun/CommandServer
/CommandServer/ImgSender.py
UTF-8
12,112
2.828125
3
[]
no_license
#-*- coding: UTF-8 -*- """ CommandServer spawn出来的子进程,用来发送摄像头图片给客户端 """ import socket from CaptureFromCAM import CvCapture import sys import time import thread import cv2 import numpy """ 使用无线网卡进行调试时注意: 电脑插上无线网卡后(此处使用了360wifi),电脑连接internet的网卡是wan,而无线网卡自然是wlen了, 似乎,360wifi它设置了wlen内的用户不能访问wan网卡,所以在写服务端和客户端时要特别注意ip地址要 指...
true
d30aa1f46537aacd890dfeb992e7eb19b3a56c22
simpsonyong/TIL
/00_startcamp/day2/file_write.py
UTF-8
383
3.203125
3
[]
no_license
restaurants = { '양자강': '02-557-4211', '김밥카페': '02-553-3181', '순남시래기': '02-508-0887' } with open('restaurant.csv', 'w', encoding = 'utf-8') as f: # w는 코드 실행할수록 계속 쓰기가 되어 덮어쓰기 된다. f.write('식당이름, 전화번호\n') for name, phone in restaurants.items(): f.write(f'{name}, {phone}\n')
true
58a619188466eae4674d2051f11ba5254f6469a9
julitosnchez/TFG
/PYTHONSOURCE/src/baxter_pykdl/scripts/trayectoriaSinusoidal.py
UTF-8
2,392
2.59375
3
[ "BSD-2-Clause" ]
permissive
import rospy import argparse import time from time import clock from baxter_pykdl import baxter_kinematics import baxter_interface from math import sqrt,sin,cos def main(): rospy.init_node('baxter_kinematics') arg_fmt = argparse.ArgumentDefaultsHelpFormatter parser = argparse.ArgumentParser(formatter_cl...
true
6ecfd960a0ebbc48edd6266c782282b6e0a79eef
DariaMachado/Algoritmos_Python
/soma-matrizes.py
UTF-8
807
3.8125
4
[ "MIT" ]
permissive
m: int; n: int; j: int; i: int m = int(input("Quantas linhas vai ter cada matriz? ")) n = int(input("Quantas colunas vai ter cada matriz? ")) A: [[int]] = [[0 for x in range(n)] for x in range(m)] B: [[int]] = [[0 for x in range(n)] for x in range(m)] C: [[int]] = [[0 for x in range(n)] for x in range(m)] print("Dig...
true
99bcfa98189c892c5b75653cce3b5f9acb25064d
sunnychemist/pylearn
/python_tutor/11_dictionary/frequency_analisys.py
UTF-8
1,758
4.34375
4
[ "Apache-2.0" ]
permissive
''' Source: https://pythontutor.ru/lessons/dicts/problems/frequency_analysis/ Condition Given text: the first line contains the number of lines in the text, and then the lines themselves. Print all the words that appear in the text, one for each line. Words should be sorted in descending order of th...
true
12a1e516b5d5f687950bd5afb21fa1476147ca25
Bit4z/python
/addpython/prime.py
UTF-8
173
3.65625
4
[]
no_license
n=int(input("enter the value")) i=2; c=0 while(i<n): if(n%i)==0: c=c+1 i=i+1 break if(c==0): print("prime") else: print("not prime")
true
cdab3eee7575e961fb69061c5d3bca9874ef0fa2
wahabshaikh/problems-vs-algorithms
/problem_6.py
UTF-8
906
4.25
4
[]
no_license
import math def get_min_max(ints): """ Return a tuple(min, max) out of list of unsorted integers. Args: ints(list): list of integers containing one or more integers """ if not ints: return None, None minimum = math.inf maximum = -math.inf for val in vals: if v...
true
86a0125a14c39f225366660573eb6101d3608621
fitrialif/openmv-projects
/donkey-car/obstacle_detection_main.py
UTF-8
7,424
2.546875
3
[ "MIT" ]
permissive
# This file is part of the OpenMV project. # Copyright (c) 2013-2017 Ibrahim Abdelkader <iabdalkader@openmv.io> & Kwabena W. Agyeman <kwagyeman@openmv.io> # This work is licensed under the MIT license, see the file LICENSE for details. ########### # Settings ########### COLOR_OBSTACLE_DETECTION = True # False to use ...
true
c01e95dcea8095a3580731658350f5ad048cdf64
bielspm/alien_invasion
/alien_invasion.py
UTF-8
800
3.21875
3
[]
no_license
import sys import pygame from settings import Settings from ship import Ship from pygame.sprite import Group import game_functions as gf def run_game(): """ Inicializa o jogo e cria um objeto para a a tela """ pygame.init() settings = Settings() screen = pygame.display.set_mode((se...
true
6dd796117c1fe0015e6d8ae6cb0e2f52dd4a41ad
jonsmartins52/cev
/times_futebol.py
UTF-8
1,250
4.1875
4
[]
no_license
'''Cria uma tupla preenchida com a tabela do brasileirão na ordem de colocação. Depois mostre: a) Os 5 primeiros times b) Os 4 ultimos colocados c) Times em ordem alfabética d) Em que posição está a Chapecoense ''' times = ('Palmeiras', 'Flamengo', 'Internacional', 'Grêmio', 'São Paulo', 'Atlético-Mg', 'Athletic...
true
754c5317bd84ebbeaccb4681ed17e28e1d50a8ca
yanxuanshaozhu/datastructuredemos
/LearnAlgorithmWithFun/05HuffmanCoding.py
UTF-8
854
3.3125
3
[]
no_license
import heapq from _collections import defaultdict from bitarray import bitarray def huffman(text: str): dt = defaultdict(int) for letter in text: dt[letter] += 1 heap = [[freq, [key, ""]] for (key, freq) in dt.items()] heapq.heapify(heap) while len(heap) > 1: left = heapq.heappop(h...
true
4b1b4237e491605f22c5a81aa030ed8bc9acbcd9
n86-64/GamesTechYear3-AT-Task2-NFlow
/cnn2/dataLoader.py
UTF-8
3,319
3.03125
3
[]
no_license
# Dataloader # Loads pictures for use in traning and prediction # in my neural network. # TODO - Add routiene to resize the images for the neural network. # Dependancies import zipfile import cv2 import os import numpy as np from glob import glob # Define filepaths train_data_path = os.path.join(os.path.dirname(__f...
true
6202232a29711aac79ccb295a4da49c3a475cdb6
jtlai0921/MP31601
/CH08/CH8.3/CH0834A.py
UTF-8
193
3.03125
3
[]
no_license
# 使用calendar import calendar calen = calendar.calendar(2016) print(calen) #設定日曆的第一天是星期天 calendar.setfirstweekday(calendar.SUNDAY) calendar.prcal(2015, c= 3, m = 2)
true
72da256eb8d5bc1c64840334b57c36b6d7acfa79
hylom/lmacli
/lib/access_token.py
UTF-8
3,228
2.625
3
[ "MIT" ]
permissive
"""LINE Message API: get channel access token v2.1""" import json from .interface import Interface class TokenInterface(Interface): def set_parser(self, name, subparsers): '''add ArgumentParser to subparsers''' token = subparsers.add_parser(name) token_subparsers = token.add_subparsers(de...
true
5b4d57fcffd3e163ed3ef34100e15fffc58d685e
ejnic/edoclitecreation
/myfunctions.py
UTF-8
218
2.859375
3
[]
no_license
import re def cleanprogramcd(siscd): cleanedcd = re.sub( r'[^\x00-\x7F]+', '', siscd) if cleanedcd[-1].isnumeric: cleanedcd = cleanedcd[:-1] else: cleanedcd = cleanedcd return cleanedcd
true
656716522bdbd9a79bf5b7e24faf1cf7e7b76538
ChrisPayne89/ESP8266_SensorServer
/comm.py
UTF-8
7,802
2.65625
3
[]
no_license
import socket,time,supp # ------------------------- class CommServer ------------------------- # Class that provides an interface for TCP/IP-communication with the host class CommServer(): def __init__(self,port,name,verbose): self.__conns = [] self.__name = name self....
true
e97e6a216dfd73732336fb981bbe24607c3b48f4
satojkovic/algorithms
/kickstart/2022/RoundD/image_labeler.py
UTF-8
462
3.03125
3
[]
no_license
T = int(input()) for t in range(1, T + 1): N, M = list(map(int, input().split())) As = list(map(int, input().split())) As = sorted(As, reverse=True) res = 0 for i in range(M-1): res += As[i] rem = [As[i] for i in range(N-1, M-2, -1)] if len(rem) % 2 != 0: res += rem[len(rem)...
true
179fd42cded991a5d7c023fd64a2f8d938159f8d
kkirchhoff01/lslext
/hdf5/calculateTimeDomainADC.py
UTF-8
4,799
2.8125
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- """ calculateTimeDomainADC.py - Read in a DRX/HDF5 wataerfall file and calculate the noise temperature (mean and RMS) for each observation (XX and YY or I). Usage: ./calculateTimeDomainADC.py [OPTIONS] file $Rev$ $LastChangedBy$ $LastChangedDate$ """ import os import ...
true
8e8c5a0d83a7164daee04678a00f276b0e3abc91
antondelchev/Python-Fundamentals
/Functions - Exercise/08. Loading Bar.py
UTF-8
432
3.890625
4
[]
no_license
def loading_bar(num): loading = f"{num}% [" bars = num // 10 for i in range(1, bars + 1): loading += "%" print(end="") loading += "." * (10 - bars) print(end="") loading += "]" if not num == 100: print(loading) return "Still loading..." elif num == 100: ...
true
330f64fc9e85533f64a989ee5d327d037fc94934
SujanMaga/Python-prac-for-ref.
/test/Lists_tuples/06_list_tuple.py
UTF-8
337
4.3125
4
[]
no_license
# create list and changing the value inside of a list or value of list a = [1,2,3,4,5, 665,54,2,"Namaste"] a[8] = "Hello" print(a[8]) print(a) # We can create a list with items of different types(int,string,floating point,boolean) # list slicing a = ['Anuska','Doraemon','Hattori','Shaun',22,64.7] print (a) print(a[0...
true
42d74ec4f428e9c8692602405d87505d59709cac
HarshaMatta/PythonProjects
/fibonacci2.py
UTF-8
661
4.3125
4
[]
no_license
# created by harsha matta # this code goes through the fibonacci sequence for a 100 numbers # then it finds phi by dividing the last two fibonacci numbers # after that it compares it to the formula of calculating them def main(): cnt = 0 limit = 101 before = 1 twobefore = 0 while cnt < limit: ...
true
74d13f12597f1aadd26f9652ec5ba8c8e9cb113f
BraydanNewman/JCU_Uni
/CP1401/prac_06/jcu_grades.py
UTF-8
830
3.65625
4
[]
no_license
import random MAX_SCORE = 100 def get_valid_number(prompt, min_number, max_number): while True: score = int(input(prompt)) if min_number <= score <= max_number: return score elif score < 0: get_random_scores() def get_random_scores(): loop_times = abs(int(inp...
true
78ddbf7286994918a82157d6233731306cc53a3c
Urbine/YohamGabrielB
/Python Projects/Working with Databases/Tracks.py
UTF-8
3,625
3.59375
4
[ "MIT" ]
permissive
# I have a similar project called Bill Evans Library. The main difference is that, for some Jazz lovers, # the album chronology is very important. For that reason, I created a different project with a "year" table # and a refined string extraction technique using Regular Expressions. # Initiated imports and, in the ca...
true
8f46a4b2beb29f315282c77ba3dd542d8e31e821
lgt494371725/leetcode
/python/最长回文串.py
UTF-8
458
2.84375
3
[]
no_license
#虽然简单但细节很多 class Solution(object): def longestPalindrome(self, s): dic1={} dic1=dic1.fromkeys(s,0) for i in s: dic1[i]+=1 length=0 single=False for i in dic1: if dic1[i]%2==0: length+=dic1[i] if dic1[i]%2!=0: ...
true
31d5f4d557386de5c924d0025775a9e9c069a616
charlesdebarros/CodeWars
/CodeWars_Python/say_hello.py
UTF-8
519
4.71875
5
[]
no_license
#!/usr/bin/env python3 # Say hello! # # Write a function to greet a person. Function will take name as # input and greet the person by saying hello. Return null/nil if # input is empty string or null/nil. # # Example: # # greet("Niks") == "hello Niks!" # greet("") == nil; # Return nil if input is empty string # greet(...
true
13d74e59461a3391fd715d0224026bffc6befea9
erelin6613/imdb
/main_2.py
UTF-8
8,011
2.90625
3
[]
no_license
#!/usr/bin/env python3 """ The program designated to preform basic natural language processing with help of movie reviews one can scrape as needed. """ import os import requests from bs4 import BeautifulSoup import nltk from nltk.tokenize.casual import casual_tokenize from nltk.stem import WordNetLemmatizer from nl...
true
5d63b44f1b5b2ab7f9d61379b23bfdd26791a750
ndrabins/malifier
/tools.py
UTF-8
3,546
3.25
3
[]
no_license
import numpy as np import random #================================================= #================================================= # Any tools that are needed across multiple # files #================================================= #================================================= #======================...
true
517f129f29c7bfee7569e0484844147832dbf7b0
Yoon-Haeng-Heo/Algorithm
/binary_search/2805.나무 자르기.py
UTF-8
337
2.921875
3
[]
no_license
n,m = map(int,input().split()) arr = list(map(int,input().split())) start = 0 end = max(arr) res = 0 while (start <= end): mid = (start + end) // 2 total = 0 for a in arr: if a > mid: total += (a - mid) if total < m: end = mid - 1 else: res = mid start =...
true
e638d6b2979e9a84484d5778f54e450b5e65e788
ranok/hash-mnemonic
/git_mnemonic/__init__.py
UTF-8
1,671
2.765625
3
[ "MIT" ]
permissive
import sys import os import subprocess import git_mnemonic.translate as t def debug(msg, obj): if os.environ.get('GIT_DEBUG', False): print("%s: %r" % (msg, obj)) def encode(rev, abbrev=8): "Take a git revision and turn it into a mnemonic" revision = clean_revision(rev, abbrev=abbrev) chars =...
true
f65f8dd0e57b9d5b4cf0a0201dfed57f9f248e77
kevin83321/python_future_trading
/Strategy_Sample_Python/回測範例/24.py
UTF-8
871
3.09375
3
[]
no_license
# -*- coding: UTF-8 -*- #時間轉數值 def TimetoNumber(time): time=time.zfill(8) sec=int(time[:2])*360000+int(time[2:4])*6000+int(time[4:6])*100+int(time[6:8]) return sec #取I020,依照逗點分隔,並將分隔符號去除 I020 = [ line.strip('\n').split(",") for line in open('/Volumes/DataStore/python_future_trading/TickDataFutures_20170815_I020.cs...
true
b6e2121f71b74349508f91be2c44c41aadfbcd5a
m0rtal/GeekBrains
/algorythms/lesson7/task3.py
UTF-8
942
4.03125
4
[]
no_license
"""Массив размером 2m + 1, где m — натуральное число, заполнен случайным образом. Найдите в массиве медиану. Медианой называется элемент ряда, делящий его на две равные части: в одной находятся элементы, которые не меньше медианы, в другой — не больше медианы.""" import random m = int(input("Введите m для определения...
true
4323f7a0eb5fa3f51e23cecf47fb4120be52a279
pezy/AutomateTheBoringStuffWithPython
/practice_projects/downloadHuaban.py
UTF-8
919
2.578125
3
[ "MIT" ]
permissive
#!python # downloadHuaban.py - download picture from http://huaban.com/favorite/beauty/ import requests, os, re url = "http://huaban.com/favorite/beauty/" os.makedirs('huaban', exist_ok=True) print('Fetching waterfall...') res = requests.get(url) res.raise_for_status() pin_id_match = re.compile('"pin_id":(\d+)') pin...
true
a18b3eaa4ae9e35521586d2911f84247d3fa4555
StratisZx/ErgasiaPatsaki
/askisi1.py
UTF-8
1,503
3.96875
4
[]
no_license
print ("Εισάγεται διαδοχικά την αρχή και το τελος των διαστημάτων σε διαφορετικα κελιά το καθενα(Για τερματισμο εισαγεται το 0 στη λιστα):") print("Αν θελετε το 0 για αρχη διαστηματος αντικαταστηστε το με 1 και προσθεστε μια μοναδα στο τελος του διαστηματος για να αποφυγουμε τον τερματισμο της λιστας!!") List1 = [] whi...
true
795f7238942964b0a0f1b59f77b7d265d787be71
hemangbehl/Data-Structures-Algorithms_practice
/python_textbook_questions/BinaryTree/binary_tree_q29_construct_BT_preorder_inorder_lists.py
UTF-8
2,543
3.59375
4
[]
no_license
class Node: def __init__(self, data): self.data = data self.left = None self.right = None class BinaryTree: def __init__(self): self.root = None def print(self): curr = self.root if curr == None: print("Empty tree") return ...
true
a5e9a1d33bf38d1c0b0390ddb21bdcc43d540f3a
mkwardakov/bumblebee-status
/bumblebee/popup.py
UTF-8
2,162
3.484375
3
[ "MIT" ]
permissive
"""Pop-up menus.""" try: import Tkinter as tk except ImportError: # python 3 try: import tkinter as tk except ImportError: pass import logging class PopupMenu: """The popup-menu.""" def __init__(self): """Initialize.""" # menu widget self.root = tk.Tk(...
true
e1eb3c44606088d9d1af47f09d4a9e2ac3a547d9
JJHAirylin/2048-api
/game2048/agents.py
UTF-8
2,531
3.25
3
[ "Apache-2.0" ]
permissive
import numpy as np class Agent: '''Agent Base.''' def __init__(self, game, display=None): self.game = game self.display = display def play(self, max_iter=np.inf, verbose=False): n_iter = 0 while (n_iter < max_iter) and (not self.game.end): direction = self.step...
true
e9bdc0f9ad75d9fcef28c01f3614e4abe153c1a8
Sohan-Rai/Porto-Seguro-Safe-Driver-Prediction
/FeatureSelection_RandomForest.py
UTF-8
2,529
2.796875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sat Nov 11 23:52:03 2017 @author: Sohan Rai """ # -*- coding: utf-8 -*- """ Spyder Editor This is a temporary script file. """ print(__doc__) import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn.ensemble import RandomForestCla...
true
0f76c090b918ceb710f90aed90110a1ed73383cf
ManiBlitz/server_clients_threaded
/client.py
UTF-8
999
2.765625
3
[]
no_license
import socket import select import sys def main(): soc = socket.socket(socket.AF_INET, socket.SOCK_STREAM) host = "127.0.0.1" port = 8888 try: soc.connect((host, port)) except: print("Connection error") sys.exit() print("Enter 'quit' to exit") message = "Connected ...
true
f553a377f2cd0dff62cde0d7bc8102c1f47b23ae
rohxander/Learn_Python
/ex6.py
UTF-8
346
3.609375
4
[]
no_license
print("Mary had a little lamb.") print("Its fleece was white as {}.".format('snow')) print("And everywhere that Mary went.") print("." * 10) end1 = "C" end2 = "h" end3 = "a" end4 = "r" end5 = "l" end6 = "i" end7 = "e" end8 = "C" end9 = "o" end10 = "p" print(end1 + end2 + end3 + end4 + end5 + end6 + end7, end=' ') pr...
true
6aedc8a673100316eb50ebc89147153f5307529d
LamThanhNguyen/HackerEarth-Solutions
/Case-Conversion.py
UTF-8
234
2.75
3
[]
no_license
for i in range(int(input())): a,b=input(),'' b+=a[0].lower() for j in range(1,len(a)): if(a[j].isupper()==True): b=b+'_'+a[j].lower() elif(a[j].islower()==True): b+=a[j] print(b)
true
3fb54da19fdf5ae002fec1d8dd2a7bab0c65326a
Nabellaleen/fhir-pipe
/fhirpipe/parse/checks.py
UTF-8
1,497
3.234375
3
[ "Apache-2.0" ]
permissive
import re def _is_empty(value): return value is None or value == "NaN" or value == "" def assert_has_sql_type(name_type, value): """ State if value is of type name_type. Is used to compare the type described in the fhir documentation and the type returned from the sql query and the cleaning scri...
true
8be3f22ffd6b97c409aab8a41cff1daa765cf48a
amandamurray2021/Programming-Semester-One
/labs/Week04-flow/guess2.py
UTF-8
577
4.46875
4
[]
no_license
# This program prompts the user to guess a number # It will tell the user if their guess is too high or too low # each time that they guess until they guess the right one. # Author: Amanda Murray import random numberToGuess = random.randint(1, 100) # As per Q4 random number between 0 and 100 will be generated guess =...
true
4b18c32a298ed2ff83da00a748d6136dd4e4ccce
lmburns/webscraping
/trulia/trulia_model.py
UTF-8
1,540
2.609375
3
[]
no_license
# --- # jupyter: # jupytext: # formats: ipynb,py # text_representation: # extension: .py # format_name: light # format_version: '1.5' # jupytext_version: 1.9.1 # kernelspec: # display_name: Python 3 # language: python # name: python3 # --- # + import numpy as np import ...
true
3fd27cc3710ad1b96d8a2a73a1469f15586bcae2
KaranJaswani/Codes
/LeetCode-Python/189. Rotate Array.py
UTF-8
659
2.9375
3
[]
no_license
class Solution(object): def rotate(self, nums, k): """ :type nums: List[int] :type k: int :rtype: void Do not return anything, modify nums in-place instead. """ if len(nums) == 0 or k % len(nums) == 0: return count = 0 i = 0 start...
true
621beb632e59a5039c381c7338d485907ed3e3f7
XanderBys/Tic_Tac_Toe
/State.py
UTF-8
406
2.921875
3
[ "MIT" ]
permissive
import numpy as np class State: hashed = [] def __init__(self, board): self.board = board self.shape = self.board.shape self.hash = str(board) def get_empty_lower_layer(self): return State(self.board.copy()) def __str__(self): return str(self.board...
true
caad34023b08f1500bd861cc839ff1427b2c5c1d
timqsh/advent2020
/Day_24_Lobby_Layout/test_d24.py
UTF-8
736
2.671875
3
[]
no_license
from pathlib import Path import pytest from Day_24_Lobby_Layout.sol import get_black_tiles, step_n @pytest.fixture(scope="module") def current_path(): return Path(__file__).parent @pytest.fixture(scope="module") def example_data(current_path): return (current_path / "test.txt").read_text() @pytest.fixtu...
true
7a91e833fd90d1d09029728931a1363674aa997a
SincereXIA/BUAA-Service-Computing-Homework
/homework2/WS-DREAM/benchmarks/commons/dataloader.py
UTF-8
3,012
2.515625
3
[ "MIT" ]
permissive
######################################################## # dataloader.py # Author: Jamie Zhu <jimzhu@GitHub> # Created: 2014/2/6 # Last updated: 2015/8/29 ######################################################## import numpy as np from commons.utils import logger import os #==========================================...
true
6e2d164df96a283ccc1f70181f5a42b9f71f895d
annehomann/python_crash_course
/03_if_statements/website.py
UTF-8
436
3.0625
3
[]
no_license
current_users = ['anne', 'cathy', 'mike', 'eli', 'laura', 'shane'] new_users = ['doris', 'jane', 'DAVE', 'eli', 'ash', 'cathy'] for new_user in new_users: if new_user in current_users: print(new_user + " has already been taken. Select another username.") elif new_user != new_user.lower(): print...
true
67a84bf37041553697b4d4486f6b00c38cd3904a
009shanshukla/tkinter_tut_prog
/tkinter12.py
UTF-8
268
2.984375
3
[]
no_license
from tkinter import* import tkinter.messagebox root = Tk() tkinter.messagebox.showinfo('window title','windows is shutting down') answer = tkinter.messagebox.askquestion('question 1-','do you like pizza ?') if answer == 'yes': print(")()()()(") root.mainloop()
true
04f4930e920fa925dcab2b67317ab4d0aa123107
jorgegarba/CodiGo9
/BackEnd/Semana4/Dia6/05-programas.py
UTF-8
238
2.8125
3
[]
no_license
# forma para invocar una sola funcion de nuestro modulo # añadir un alias por si el modulo no ha dada un nombre claro al funcionamiento de la funcion # as => como from modulo import despedir as adiocito adiocito("Eduardo") print("HOLA")
true
f79056322f4725caa9b5ea72aeea0e28ff5aec41
inkollusaipavani/python3
/64.py
UTF-8
90
3.1875
3
[]
no_license
x,y=map(int,raw_input().split()) if ((x+y)%2==0): print "even" else: print "odd"
true
452477db0e9f54c6525400bf791061803d16b374
gerard1801/StockTracker
/Stocks/views.py
UTF-8
3,150
2.921875
3
[]
no_license
from django.shortcuts import render import pandas as pd from yahoofinancials import YahooFinancials # Create your views here. def Home(request): #Stock data stock_data = pd.read_csv("/Users/gerardvanderwel/Documents/Stock_data.csv", sep=';') #extract and calculate total amount of stocks amount_data =...
true
82489c437d9cb9e1e75f9eb5e55cfe34fd0bc8a2
fjafjan/Tracker
/StepControlAux.py
UTF-8
1,998
2.703125
3
[]
no_license
##### In this file are a number of functions that were implemented into StepControl.py but ##### were made redundant or never actually needed. However it is possible they will find some future use. import ctypes from time import sleep, clock from numpy import array from math import sqrt, copysign Step4 = ctypes.Win...
true
f11c325020cf76622352fda34c7a8493847db7a3
tofergregg/gdb_online
/cgi-bin/compileProg.cgi
UTF-8
1,254
2.515625
3
[]
no_license
#!/usr/sup/bin/python import cgi,cgitb import sys import json import subprocess cgitb.enable() PROG_FOLDER = "programs/" def compile(uuid,program): # save the file as programs/[uuid].cpp and compile it # with -g -O0 programs/[uuid].cpp -o programs/bin/[uuid] prog_name = PROG_FOLDER+uuid+".cpp" # save the progr...
true
d98b757a6ea9dde7bc08e97fdadc32d35ee36e49
RobertABT/Image_analysis
/colourcapture(2).py
UTF-8
620
2.78125
3
[ "MIT" ]
permissive
import numpy as np import cv2 import datetime # loading in a colour image as greyscale (could help see edges?) cap = cv2.VideoCapture(1) while(True): # capture frame-by-frame ret, frame = cap.read() #our operations on the frame come here gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) # Display the resulting fram...
true
5878c5ee8157b2b4eb2e320525a0a4c6bf449ca1
enginBozkurt/PythonMyArchive
/Lists.py
UTF-8
2,247
4.75
5
[]
no_license
# -*- coding: utf-8 -*- """ Created on Wed Oct 31 17:47:20 2018 @author: LEngin Bozkurt """ # Unlike strings, Lists are mutable, meaning the elements inside a list can be changed! # Assign a list to an variable named my_list my_list = [1,2,3] #We just created a list of integers, but lists can actually hold differen...
true
14c9a69c78c05e80321f6bf3d563421fe4d7b831
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/python/rna-transcription/914a40f8339545dc95c62524961e87c9.py
UTF-8
355
3.46875
3
[]
no_license
def to_rna(dna): dna = dna.upper() rna = [] solution = "" for i in range(len(dna)): if dna[i] == "A": rna.append("U") elif dna[i] == "T": rna.append("A") elif dna[i] == "C": rna.append("G") elif dna[i] == "G": rna.append("C") for foo in rna: solution =...
true
05bf8049827ce43acde8ade108b4b0bcfdfe0519
brillandthomas/Song-Lyrics-Scraper
/src/utils.py
UTF-8
818
3.609375
4
[]
no_license
import os import re def clean_lyrics(lyrics: str) -> str: """ Removes the [] and the newlines from the lyrics. Can be useful to train NLP models. Input lyrics (str): the lyrics as string Returns lyrics (str): the cleaned lyrics """ lyrics = re.sub(r'[\(\[].*?...
true
bdd773971a22950383f84dd2217d0524727a5299
syamajala/euler
/nonworking/p38.py
UTF-8
557
3.140625
3
[]
no_license
import euler_lib import itertools def nine_pandigital(n): return map(n.count, range(1, 10)) def good_product(n): return all(map(lambda x: True if (x == 1 or x == 0) else False, n)) def concatenate(ns): l = map(euler_lib.num_to_list, ns) return list(itertools.chain(*l)) def products(n): i = 1...
true
42b9eaf902fbee0b24ca44cd3af9516afc18c834
sailll/leetcode-solution-by-myself
/leetcode 846.py
UTF-8
448
2.796875
3
[]
no_license
import Queue class Solution(object): def canVisitAllRooms(self, rooms): n = len(rooms) finish = [] keys = Queue.Queue() keys.put(0) while(not keys.empty()): i = keys.get() if i in finish: continue finish.append(i) ...
true
74f5d6db6badace0cba6037a2b31c4fd46bbf8be
muhammadNassef/SWEproject
/dataAccess/productDA.py
UTF-8
2,360
2.671875
3
[]
no_license
from dataAccess.baseDA import BaseDA from dataAccess.connectionmanagment import ConnectionManagment from entities.product import Product class ProductDA(BaseDA): def findAll(self): conn = ConnectionManagment.getConnection() cursor = conn.cursor() sql = 'select * from product' cu...
true
eed329a9bcbf251bfd1fc80f7a9fc31316fc5374
tiyu0203/feature_detection
/imageClassifierFeatureDetectors.py
UTF-8
1,657
2.625
3
[]
no_license
import cv2 import numpy as np import os path = 'train' orb = cv2.ORB_create(nfeatures=1000) #import images images = [] classNames = [] myList = os.listdir(path) print(myList) for cl in myList: imgCur = cv2.imread(f'{path}/{cl}',0) images.append(imgCur) classNames.append(os.path.splitext(cl)[0]) print(clas...
true
3406e9bb0c9b30a736a06e8c70138f4350b13b35
syurskyi/Algorithms_and_Data_Structure
/_algorithms_challenges/codeabbey/_CodeAbbey_Challenges-master/Problem32_JosephusProb.py
UTF-8
536
3.234375
3
[]
no_license
with open("prob32.txt") as infile: data = infile.readline() n,k = data.split(" ") people = [0 for i in range(int(n))] # 0 is alive i=0 while people.count(0) > 1: count = 0 while count < int(k)-1 or people[i]!=0: if people[i]==0: count+=1 ...
true