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
4e71fefb433140301a19961f154a719c0460a947
mrfabroa/processing
/bullseye_function.py
UTF-8
656
4
4
[]
no_license
''' Draw a bullseye in the centre of the screen ''' def setup(): size(640, 360) background(51) noStroke() noLoop() def draw(): drawTarget("#0dc620", 100, 300) drawTarget("#0dc620", 400, 200) drawTarget("#ff0000", width/2, height/2) def drawTarget(colour, xloc, yloc): ...
true
84be03e390b74ccb3544205bd1be2a5c3efd53ec
taylanot/GP-INHOUSE
/opt.py
UTF-8
2,939
2.90625
3
[]
no_license
# (C) Ozgur Taylan TURAN 2019, Nov. (Delft University of Technology) # Import General Modules import numpy as np from scipy.stats import norm class BO(): """Bayesian Optimization""" def __init__(self, GPR, X, y, x, xi = 0.1): self.GPR = GPR self.X = X self.y = y se...
true
9e022f073aab5c49701386a02dd44e5a599502d4
kpsuperplane/MHacks
/Combiner.py
UTF-8
561
3.15625
3
[]
no_license
import os, wave # Concats a list of .wav file paths and produces a new .wav file # Make sure all .wav files have the same params # i.e. concat(['words/hi/0.wav']) def concat(wav_file_paths,out_path): data = [] for path in wav_file_paths: if os.path.isfile(path): w = wave.open(path, 'rb') ...
true
6466cec739c463fa8f4e6521a2c54a5691eecd01
frankyjquintero/drf-friendly-errors
/tests/test_utils.py
UTF-8
1,847
2.71875
3
[ "MIT" ]
permissive
from unittest import TestCase from rest_framework_friendly_errors.utils import update_field_settings class UpdateFieldSettingTestCase(TestCase): def setUp(self): self.FIELD_SETTING = { 'CharField': {'required': 2001, 'null': 2003, 'blank': 2004, 'max_length': 2005, ...
true
634978b98710644cffdf5aa1a14bf7a053199a31
obrokedo/LegaciesOfVeridocia
/latestBuild/scripts/Test Scripts/BattleEffect.py
UTF-8
5,931
2.65625
3
[]
no_license
from mb.jython import JBattleEffect from org.python.modules import jarray from java.lang import Math from java.lang import String from java.util import ArrayList; from tactical.game.sprite import CombatSprite import random from Effects.Petrify import Petrify class BattleEffect(JBattleEffect): def getBattleE...
true
78efa12292d8e644dc36b01ecbde17149df0a4a6
lovedaybrooke/Shelvd
/shelvd/messages.py
UTF-8
2,868
2.65625
3
[]
no_license
#!flask/bin/python # -*- coding: utf-8 -*- import os from pyparsing import ParseException import shelvd.grammar as grammar from shelvd.models import Book, Reading, MessageException from shelvd import app class Instruction(object): def __init__(self, incoming_message): self.incoming_message = incoming_m...
true
0429071413697489a957cbcbfb71d9aae5d11557
pkdism/leetcode
/june-leetcoding-challenge/d16-validate-ip-addresses.py
UTF-8
2,309
3.875
4
[]
no_license
""" Write a function to check whether an input string is a valid IPv4 address or IPv6 address or neither. IPv4 addresses are canonically represented in dot-decimal notation, which consists of four decimal numbers, each ranging from 0 to 255, separated by dots ("."), e.g.,172.16.254.1; Besides, leading zeros in the IPv4...
true
628c75e4e0c1b5b30019157730dc92860dd0a067
IndustAI/visual-domain-randomization
/visual_cartpole/experiments/train_dqn.py
UTF-8
1,963
2.65625
3
[ "MIT" ]
permissive
""" Trains normal, regularized, or randomized agents on the visual cartpole environment. Networks for trained agents are saved in the results folder. """ import pickle import numpy as np from env import gym import matplotlib.pyplot as plt import cv2 cv2.ocl.setUseOpenCL(False) from agent.dqn import DQN from env.vis...
true
26b5e7de4a3111c1abf5cc083e72694ac51d830f
obniz/partsjs2partspy
/prestring/output.py
UTF-8
1,624
2.71875
3
[]
no_license
# -*- coding:utf-8 -*- import logging import os.path import glob from collections import namedtuple, defaultdict logger = logging.getLogger(__name__) File = namedtuple("File", "name, m") class SeparatedOutput(object): @staticmethod def module_factory(): raise NotImplementedError("e.g. python.PythonM...
true
1bee38d311c8616305c1e32a1c14cf9a5bea4ab1
Ran243/pythonproject
/uniquePalindrome.py
UTF-8
364
3.1875
3
[]
no_license
def unique(y): # insert the list to the set list_set = set(y) # convert the set to the list for x in list_set: reverseString = reversed (x) if list(x) == list(reverseString): print (x) else: continue file_content = "akdfadskj snns racecar...
true
ea06f008fd79f3c9032e42368ee0140a1dc6a30e
jkfer/LeetCode
/Shortest_path_in_binary_matrix.py
UTF-8
1,702
3.640625
4
[]
no_license
# https://leetcode.com/problems/shortest-path-in-binary-matrix/ # 1091 """ Provided is a adjacency matrix BFS """ import queue class Solution: def getNeighbours(self, point, grid): D = [(0, -1), (0, 1), (1, 0), (1, -1), (1, 1), (-1, 0), (-1, -1), (-1, 1)] r, c = point ANS =...
true
8fd7a4a99304aca6a1f8afbfa72332cda35be6da
sasakamanman/pycompiler
/src/functions/parse_file.py
UTF-8
4,017
2.921875
3
[]
no_license
import pathlib import ast import sys from typing import List, Set, Union _init_path = pathlib.Path('__init__.py') def parse_file(target_path: pathlib.Path, package_set: Set[str] = set()) -> Set[str]: target_file = _get_target_file(target_path) base_dir = target_file.parent ast_file = _make_ast(target_fil...
true
679c48380a27afa7d6303cd2dca63e78ec266979
segl2014/Python-Programming
/swap_two_nums.py
UTF-8
183
3.796875
4
[]
no_license
x = int(input("Enter value of X:")) y = int(input("Enter value of Y:")) print("Brfore Swapping \n X=", x, "Y=",y) temp = x x=y y=temp print("After Swapping \n X=",x, "Y=",y)
true
079b5ea11eb67381f8addae3d2a58b4fd41f94c3
daigo0927/ProgrammingContest
/AtCoder/ABC063/ProbD.py
UTF-8
678
3.328125
3
[]
no_license
import math def solve(): n, a, b = list(map(int, input().split())) h = [int(input()) for _ in range(n)] h = sorted(h) def is_enough(t): t_check = 0 for hh in h: hh -= b*t if hh > 0: t_check += math.ceil(hh/(a-b)) if t_check > t: return Fa...
true
b78583d2a5cff8ec06cf6e2818633cbb25804269
ody1205/Daily-Coding
/Programmers/skill_tests/lvl3/2.py
UTF-8
1,540
2.6875
3
[]
no_license
''' ''' from collections import defaultdict def solution(a,w): s = defaultdict(list) link = defaultdict(list) w = w.lower() k = 0 for i in a: website = '' for j in (i.split('\n')): for z in j.split(' '): if 'content' in z.split('='): w...
true
55db9ce9a4067b85845132e2821ab2e1d073f748
legolasundgimli/pypomodoro
/pomodoro/src/data/task.py
UTF-8
2,995
2.75
3
[]
no_license
''' Created on Dec 28, 2009 @author: uolter ''' import datetime class MyTask(): ''' classdocs ''' #__timeformat__='%A, %d. %B %Y %I:%M%p' __timeformat__='%d/%m/%Y %I:%M%p' def __init__(self, name=''): self.name=name self._startAt=datetime.datetime.now() ...
true
5d718a767c8fe89bc0e68e283b66b17125c63bff
pakreinbold/skyrim-alchemy
/apps/tabbed_skyrim_app.py
UTF-8
8,532
2.796875
3
[]
no_license
import dash from dash import dcc, html, dash_table from dash.dependencies import Input, Output import numpy as np import pandas as pd from collections import defaultdict def check_first(s): bads = {'Collected', 'Harvested', 'collected', 'harvested'} for bad in bads: if bad in s: return Fa...
true
dedbb874f79673c98b5fdf0af56646ac735e0002
jiudian123/first
/run_rnn.py
UTF-8
4,523
2.640625
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Fri May 18 16:14:02 2018 @author: zhu """ import os #os模块调用系统命令 import time from datetime import timedelta#计时用。timedelta代表两个datetime之间的时间差 import numpy as np #由多维数组对象和用于处理数组的例程集合 import tensorflow as tf from sklearn import metrics #数据挖掘与分析,评估用...
true
7765f501e8b6841fe3d0c1f04f186ef283e79269
jihongeek/Algo
/baekjoon/13333.py
UTF-8
369
3.0625
3
[]
no_license
n = int(input()) papers = sorted(list(map(int, input().split()))) maxcitation = max(papers) qindex = 0 for i in range(maxcitation+1): kCitation = 0 nminuskCitation = 0 for j in papers: if j >= i: kCitation+=1 else: nminuskCitation+=1 if kCitation >= i and nminus...
true
89db8ec9189b8e006e174154ce261c0073aa3c18
melike-eryilmaz/pythonProgrammingLanguageForBeginners
/classesPart3.py
UTF-8
854
3.96875
4
[]
no_license
""" 25/12/2020 Object Orianted Programmimng -Class -İnit functions and self details Class lar çağrıldığı zaman her zaman arkada çalışan bir constructor bloğu bulunur. Python da constructor init fonksiyonudur. Constructor içerisinde fonksiyonların alacağı parametreleri belirleyip fonksiyonların içe...
true
e1deffe6e498093e091aaf0042ac46b96a24b004
locogato88/ProjectEuler
/Problem40.py
UTF-8
166
3.234375
3
[]
no_license
#Problem 40 s = '' for i in range(1000000): s +=str(i) a = int(s[1])*int(s[10])*int(s[100])*int(s[1000])*int(s[10000])*int(s[100000])*int(s[1000000]) print(a)
true
785ed9cccfbc72a1ef413f6805869480bea9671a
ZAKAUDD/AbdomenNet
/quickNAT_pytorch/utils/preprocessor.py
UTF-8
4,015
2.78125
3
[ "MIT" ]
permissive
import numpy as np ORIENTATION = { 'coronal': "COR", 'axial': "AXI", 'sagital': "SAG" } def remove_black(data, labels): clean_data, clean_labels = [], [] for i, frame in enumerate(labels): unique, counts = np.unique(frame, return_counts=True) if counts[0] / sum(counts) < .99: ...
true
613ee499261959f6a66f501bac0e812797338068
whglamrock/leetcode_series
/leetcode378 Kth Smallest Element in a Sorted Matrix.py
UTF-8
3,742
3.765625
4
[]
no_license
# O(nlogn) time complexity # the idea is to use binary search to cut the search range by half (logn search times); # within each search, count how many elements <= the mid with O(n) time class Solution(object): def kthSmallest(self, matrix, k): n = len(matrix) l, r = matrix[0][0], matrix[n - 1]...
true
9c0755394c79e5f4028ef900f76930c38f2b17b1
omdv/kaggle-bimbo
/xgboost_01.py
UTF-8
3,917
2.828125
3
[]
no_license
import pandas as pd import numpy as np import xgboost as xgb from xgboost.sklearn import XGBRegressor from sklearn import cross_validation, metrics #Additional scklearn functions from sklearn.grid_search import GridSearchCV #Performing grid search # --------------------------------------------------------- def rms...
true
3c76adb8b47537ec5cbc3f8a936a11963ce5f420
Mumulhy/LeetCode
/171-Excel表列序号/TitleToNumber.py
UTF-8
451
3.375
3
[]
no_license
# -*- coding: utf-8 -*- # LeetCode 171-Excel表列序号 """ Created on Fri Jun 29 14:22 2021 @author: _Mumu Environment: py38 """ class Solution: def titleToNumber(self, columnTitle: str) -> int: columnNumber = 0 for i in range(len(columnTitle)): columnNumber += (ord(columnTitle[-i - 1]) - ...
true
e9c16c0c6de3067c61c72ed3316a35e0cf49b5ad
VeronikaValeryevna/Lesson5
/test_slide_4.py
UTF-8
206
3.21875
3
[]
no_license
import math def test_1(): num = 25 assert math.sqrt(num) == 5 def test_2(): lst = [12, 4, 23, 5] assert max(lst) == 23 def test_3(): lst = [12, 4, 23, 5] assert max(lst) == 24
true
c5e7d643f07d102ebbbeaa783325407ba1c2b269
Aasthaengg/IBMdataset
/Python_codes/p02577/s103372279.py
UTF-8
113
3.421875
3
[]
no_license
x = input() s = 0 for i in range(len(x)): s = s + int(x[i]) if s % 9 == 0: print("Yes") else: print("No")
true
93b256f2f8a1be052b4ffad64db3f48e00a653a2
CptAswadu/DoTNet
/Dot_Net/creatingfolder.py
UTF-8
226
2.8125
3
[]
no_license
import os from os import walk def folder(path): os.mkdir(path) return path def gettingfilenames(path): f = [] for (dirpath, dirnames, filenames) in walk(path): f.extend(filenames) return f
true
66c1cca491bb9d85f0017a66eea38e82f7b21a19
arunkumar786/assignment
/mergedictionary2.py
UTF-8
679
3.515625
4
[]
no_license
#!/bin/python def merge_dictionary(D1): D1 = D1 inner_list_dict = []; append_list = [] for i,j in D1.items(): if type(j) == dict: inner_list_dict.append(j) for i,j in inner_list_dict[0].items(): if type(j) == list: append_list = append_list + j return appen...
true
6372cfd8c458413cc49c843ec8b1c93e3e9e827c
aideyisu/Information-hiding-in-pinture
/src/site_jiemi_test.py
UTF-8
2,701
2.65625
3
[]
no_license
#!/usr/bin/python # -*- coding: utf-8 -*- import cv2 import numpy as np import random from matplotlib import pyplot as plt # 每行的间距 strand_site_col = 180 # 每个单词的间距 strand_site_row = 200 # 字母映射表 zi = { 1:"A", 2:"B", 3:"C", 4:"D", 5:"E", 6:"F", 7:"G", 8:"H", 9:"I", 10:"J", 11:...
true
6feed31da7e3d2003a1793a2d714c24dedfa22f0
eru27/Automated-Bechdel-Test
/ScriptParser/ClassifyNames.py
UTF-8
702
3
3
[]
no_license
FEMALE_NAMES = 'names/femaleNamesCleanedLC.csv' MALE_NAMES = 'names/maleNamesCleanedLC.csv' def classifyNames(namesList): with open(FEMALE_NAMES, 'r') as femaleFile: femaleBase = femaleFile.read().split(',') with open(MALE_NAMES, 'r') as maleFile: maleBase = maleFile.read().split(',') femal...
true
87d94c2692181b6beaa6bf0ebb71df67c7db13a2
Nachtfeuer/engine
/tests/test_engine_threed_triangle.py
UTF-8
4,049
3.421875
3
[ "MIT" ]
permissive
"""Testing of class Triangle.""" # pylint: disable=no-self-use from unittest import TestCase from hamcrest import assert_that, equal_to, calling, raises from engine.threed.point import Point from engine.threed.triangle import Triangle from engine.threed.line import Line class TestTriangle(TestCase): """Testing o...
true
7cdfbecfde2d0ed3fd99891adc8c0edea5bd47de
michaelmilleryoder/fanfiction-nlp-archive
/select_character_clusters.py
UTF-8
4,457
3.28125
3
[]
no_license
import os from collections import Counter, defaultdict import itertools import pdb """ Script to select a subset of all characters found in fics in a fandom. Have to run in the top level of fanfiction-nlp directory. """ def clean_character_list(chars): new_chars = [] for char in chars: # Don't co...
true
b4ee28511c1558f3ca95a2bb9d10079032f74124
endland/SpectrumSensing
/controller.py
UTF-8
10,647
2.890625
3
[]
no_license
#gr-spacebase project github.com/wirrell/gr-spacebase #This file contains the class for the main controller #The controller instances channel objects and stores #them in a channel banks whilst continuously monitoring #their status and last scan time. from sensingTools.channel_list import uhfchanlist from datafunnel im...
true
d24a9f7b2c1725a9f049666d935931e58ae91223
TheRedLady/nemetschek_internship
/04-metaprogramming/simple_orm/inject.py
UTF-8
729
3
3
[]
no_license
class Injected(object): injected_value = None injected = {} @classmethod def inject(cls, **injected): for name, value in injected.iteritems(): for field in cls.injected.get(name, []): field.injected_value = value def __init__(self, service_name): self...
true
69941482b5738296125ee89f98f0b716e339faad
BigApeJohny/Python-tutorial
/dictionaries.py
UTF-8
395
2.828125
3
[]
no_license
set = {1,2,3} dict = { 'name': 'Jose', 'age': 23, 'grades': [12,42,23,23] } lott_players = [ { 'name': 'Rolf', 'numbers': (12,32,32,12,3) }, { 'name': 'Lol', 'numbers': (14,23,52,34,34) } ] universities = [ { 'name': 'Oxford', 'location':...
true
87ef461932d23f86d77fb8e2d45e7c2b1a40b118
ShanXiY/meiduo
/mall/utils/cart.py
UTF-8
2,951
3.03125
3
[]
no_license
""" 在登录的时候 ,将cookie数据合并到redis中 cookie: {sku_id:{count:xxx,selected:xxxx}} redis: hash: {sku_id:count} set: {sku_id} 把抽象的问题具体化 cookie: {1:{count:20,selected:True}, 3:{count:10,selected:False}} Redis hash: {2:100,3:50} set: {2} ####################################################...
true
8c56b0b42a5d0f345e53309bd1a48cf1eec67369
AvaPL/ARM
/ARM/arm/Arm.py
UTF-8
1,772
2.9375
3
[]
no_license
from adafruit_servokit import ServoKit from arm.ArmKinematics import ArmKinematics class Arm: def __init__(self, servoNumber, pulseWidths, initialAngles): self.servoNumber = servoNumber self.servoKit = ServoKit(channels=16) for index in range(servoNumber): servo = self.servoKi...
true
be2535137ba0fa1163bbbeff80d21f81a90989b7
LeenaKH123/Python2
/06_advanced-python-concepts/codingnomads/recipes/soup.py
UTF-8
118
3.0625
3
[]
no_license
# soup.py def make_soup(ingredient): soup = f"{ingredient} soup" print(f"You've made {soup}") return soup
true
b29b44dc41c44a9c57e1d461450badd23defcd25
sanjayait/core-python
/19-Chapter 19/write_csv_by_Dictwriter.py
UTF-8
424
3.125
3
[]
no_license
from csv import DictWriter with open('file2.csv','w',newline="") as f: wf=DictWriter(f,fieldnames=['first_name','last_name','age']) wf.writeheader() # writerow method wf.writerow({'first_name':'Sanjay','last_name':'Goyal','age':29}) wf.writerow({'first_name':'kunno','last_name':'Goyal','age':2...
true
064bc93091e09aef1a7ca43892f480584d79e9cb
Savitha-python23/python-classes
/fnction.py
UTF-8
906
3.765625
4
[]
no_license
# def hyper(): # print("HELLO") # hyper() # Single return # def up(): # s = "SAVITHA" # return s[::-1] # print(up()) # def d2(): # data = up() # return data # print(d2()) #------------------------------------------------------- # Multiple return # def evvi(): # say = "Hello" # bye = "bye" # return say, ...
true
e878ca1284f42c0aacdf94dd0440dea9c750c020
jieunin1213/NLP
/nlp_class_day1-master/05_word_cloud_ex01.py
UTF-8
1,255
2.828125
3
[]
no_license
''' !pip install wordcloud ''' import pandas as pd df = pd.read_csv('./data/smartphone.csv', encoding='utf-8') galexy_posts = df.get('Title') + " " + df.get('Description') from konlpy.tag import Mecab tagger = Mecab(dicpath="C:\\mecab\\mecab-ko-dic") galexy_stop_words = "은 이 것 등 더 를 좀 즉 인 옹 때 만 원 이때 개 일 기 시 럭 갤 성 삼 스...
true
12b37b301cbe6845be16601d6a3927b662a39ce2
n3n/poker
/poker.py
UTF-8
6,830
3.140625
3
[]
no_license
import os import random def poker(hands): """ ([hand, hand, ...])-> hands Return the best hand from list of hands >>> sf = ['JC', 'TC', '9C', '8C', '7C'] >>> fk = ['5S', '5H', '5D', '5C', 'KS'] >>> sf2 = ['JS', 'TS', '9S', '8S', '7S'] >>> poker([sf, sf2]) [['JC', 'TC', '9C', '8C'...
true
6f1511a7c621920c432d287ee52d057959bbf47a
bbarnickel/bmm-podcast-downloader
/watcher.py
UTF-8
3,396
2.75
3
[ "MIT" ]
permissive
import os.path import json class PodcastWatcher: def __init__(self, bmm_api, path): self.api = bmm_api self.path = path self.db = {} self._readDb() def _readDb(self): try: with open(os.path.join(self.path, 'database.json'), 'r') as fin: self...
true
e47c801d3edca83b1663cd30ae13219ff9a74c3c
zbraniecki/pyast
/pyast/dump/js.py
UTF-8
883
2.921875
3
[]
permissive
import json import pyast from collections import OrderedDict import sys if sys.version >= '3': basestring = str else: pass def _dump_node(node, name=None, indent=0): if node is None: return None if isinstance(node, (int, bool, basestring)): return node struct = OrderedDict({'typ...
true
0f9d92c11225ef707789d04876801bd0c37cadb8
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/python/atbash-cipher/7bbbcae87fe74bfa89a2e0c7d39231a7.py
UTF-8
510
3.015625
3
[]
no_license
import re KEY = '1234567890zyxwvutsrqponmlkjihgfedcba' ALPHABET = '1234567890abcdefghijklmnopqrstuvwxyz' def decode(msg): msg = re.sub('[\W]', '', msg) msg = list(msg.lower()) msg = cipher(msg) return ''.join(msg) def encode(msg): #msg = msg.replace(' ', '') msg = re.sub('[\W]', '', msg) msg = list(msg.lower...
true
44098739f37e40e32ae489616a4f2e0e3936990f
futnag/AOJ
/ITP1/Triangle.py
UTF-8
217
3.328125
3
[]
no_license
import math a,b,C = map(int, input().split()) C = math.radians(C) c = math.sqrt(a**2 + b**2 - 2*a*b*math.cos(C)) L = a + b + c S = a * b * math.sin(C) / 2 h = 2 * S / a print("%f" % S) print("%f" % L) print("%f" % h)
true
b2fb92746dfc54b5180d33d61e1c2448c857ce0d
iHexel/deep-sentiment-analysis
/Time_Series_Analysis/Graphs_by_state.py
UTF-8
604
2.578125
3
[]
no_license
"""Graphs for sentiment analysis by state""" import numpy as np import matplotlib.pyplot as plt %matplotlib inline # created series from Deep_Sentiment_Analysis.Sentiment_Analysis.Statewide_Sentiment import approval_rating_series, disapproval_rating_series # sort index values approval_rating_series.sort_index(inplace...
true
b4dc86645d8f86317d86ccef866b2c05b02b8f0e
IvanWoo/coding-interview-questions
/tests/test_swap_nodes_in_pairs.py
UTF-8
363
2.96875
3
[]
no_license
import pytest from puzzles.swap_nodes_in_pairs import swap_pairs from puzzles.utils import make_linked_list @pytest.mark.parametrize( "head, expected", [ ([1, 2, 3, 4], [2, 1, 4, 3]), ([], []), ([1], [1]), ], ) def test_swap_pairs(head, expected): assert swap_pairs(make_linked...
true
cda3757d6f385611c9e41f750ff234b2d147efc3
hoperunChen/pythonlearn
/robot.py
UTF-8
779
2.890625
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- #机器人 import db.dbhelper as db import uuid dbh = db.DbHelper('db/test.db') def getAnwser(question): print u'我不知道应该回答什么,请告诉我我应该回答什么呢?' anwser = raw_input() if None == anwser or len(anwser) < 1: print u'小气鬼不告诉我算了' else: dbh.insert('question_anwser',(str(uuid.uuid1...
true
bfd0414a4a0dd3d6e33faef0800e7f1db6b34e58
prachinawathe/underactuated
/src/pendulum/visualizer.py
UTF-8
2,035
2.71875
3
[ "BSD-3-Clause" ]
permissive
import numpy as np import math import matplotlib.animation as animation from pydrake.systems.framework import ( Context, PortDataType, ) from underactuated.pyplot_visualizer import PyPlotVisualizer class PendulumVisualizer(PyPlotVisualizer): a1 = 0.75 ac1 = 0.75 av = np.linspace(0,math.pi,20) ...
true
26a92678b9ad8c2ff0702e834377cd4157d46a2d
neha-sharmaa/python-practice
/p_prime.py
UTF-8
221
3.46875
3
[]
no_license
num = int(input("enter any no.\n")) prime = True for i in range (2,num): if (num%i == 0): prime = False break if prime: print("this is prime no.") else: print("this is non prime no.")
true
59bcde00c0034900f12eb074495b1dce652327ca
pmvera/SpeechAndText
/text2speech.py
UTF-8
460
2.765625
3
[]
no_license
from gtts import gTTS import sys import os class TextToSpeech: def __init__(self): text = raw_input("Write your text: ") audio = gTTS(text=text, lang=sys.argv[1], slow=False) audio.save(sys.argv[2]) os.system("mpg321 " + sys.argv[2]) os.remove(sys.argv[2]) if __name__ == ...
true
151cd7d932dd74c0c0c76f09076aa438573f3304
rogamba/algorithms-python
/sorting/mergesort_class.py
UTF-8
2,083
4.21875
4
[]
no_license
""" Merge sort is based in the divide and conquer approach, it first divides the initial array into sub arrays recursively until they're 2 elements arrays. Then the merge is applied comparing every element of each array and putting the smaller in the next position and so on. """ class SuperList(list):...
true
36495ef787e414ceb11691c95721536f66ee3162
ladbc/T2-SD-Temperaturas
/server.py
UTF-8
636
2.71875
3
[]
no_license
#Autoras #Jessica Antunes - 619612 #Leticia Amaral da Cunha - 628190 import time import zmq import json from main import pack from random import randrange, gauss salas = int(input("Qual a quantia de salas?: \n")) context = zmq.Context() socket = context.socket(zmq.PUB) socket.bind("tcp://*:5555") temperaturas = [] ...
true
e09787a7e366aacca18faf40d3ec59bc784f4950
daniel-laurival-comp19/slider-game-1o-bimestre
/MakeText.py
UTF-8
270
3.203125
3
[]
no_license
def makeText(text, color, bgcolor, top, left): # create the Surface and Rect objects for some text. textSurf = BASICFONT.render(text, True, color, bgcolor) textRect = textSurf.get_rect() textRect.topleft = (top, left) return (textSurf, textRect)
true
41574c1d71524a5c1257868a24f9c0e6cdee55e7
LorgeN/TDT4120
/oving09/transfer_grid.py
UTF-8
4,206
2.78125
3
[]
no_license
from functools import lru_cache from heapq import heapify, heappop, _siftdown @lru_cache(maxsize=8192) def dist(x0, y0, x1, y1): return abs(x0 - x1) + abs(y0 - y1) def power_grid_sparse(nodes): x0, y0 = nodes.pop(0) nodes = [[dist(x0, y0, x1, y1), x1, y1] for x1, y1 in nodes] heapify(nodes) tot...
true
3b53ae389e49e4bc03c0e80e9ef1fd55af2cbd3e
dom-0/python
/Munich/lists.py
UTF-8
405
3.953125
4
[]
no_license
parrot = ["what", "who", "why", "when's"] parrot.append("whatever") for question in parrot: print("The parrot is asking " + question) even = [2, 4, 6, 8] odd = [1, 3, 5, 7, 9] numbers = even + odd numbers.sort() print(numbers) even = [2, 4, 6, 8] odd = [1, 3, 5, 7, 9] numbers = even + odd print(sorted(numbers)...
true
a2e904857bc9af1e5c0b8a7354ae5829183ccd44
lipoja/URLExtract
/tests/unit/test_extract_email.py
UTF-8
1,556
2.609375
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ .. Licence MIT .. codeauthor:: Jan Lipovský <janlipovsky@gmail.com>, janlipovsky.cz """ import pytest @pytest.mark.parametrize( "text, expected", [ ( "URI with User info in Authority ftp://jan@example.com:123/test", ["ftp://jan...
true
6aa216458f2b4a86b507a1a09d4701a7daf3dcf6
ugurcan-sonmez-95/HackerRank
/Algorithms/Greedy/Marcs_Cakewalk/main.py
UTF-8
262
3.59375
4
[ "MIT" ]
permissive
### Marc's Cakewalk - Solution def marcsCakewalk(calorie): calorie.sort(reverse=True) sum = 0 for i in range(len(calorie)): sum += 2**i * calorie[i] print(sum) n = int(input()) calorie = list(map(int, input().split()[:n])) marcsCakewalk(calorie)
true
db662015dff00f2f65c94868855c65c4036e78b4
wonghang/jleague_rating
/jleague_rating.py
UTF-8
3,063
2.59375
3
[]
no_license
#!/usr/bin/python3 # -*- coding: utf-8 -*- import datetime import csv import operator import sys from collections import deque import numpy as np import matplotlib.pyplot as plt from matplotlib import dates from matplotlib.font_manager import FontProperties import pandas as pd from brent_rating import * def convert_...
true
608d2ea1fd764512a6e28ca001bfc129ae8642e9
shinaisorensen/udemypython
/Milestone Project 2/Player.py
UTF-8
405
3.109375
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Tue Sep 1 18:27:21 2020 @author: Shinai @date: September 2, 2020 This class creates a player with a total amount of money, a hand and number of points """ class Player(): def __init__(self,total): self.total = total # Total amount of money the pl...
true
70b63a240f932b5aed1f70178cef3c7310159dc0
Sandy4321/m5-1
/src/models/preprocess.py
UTF-8
579
2.96875
3
[ "MIT" ]
permissive
import numpy as np import pandas as pd from sklearn.preprocessing import LabelEncoder def le_cat_features(feature_df, cat_features): """ Label encodes categorical features and saves the fitted label encoders to be used to transform test data. """ les = [] features = np.empty((feature_df.shape[0...
true
a11f835575f6de0d9ef9a6c29647b09ea0fc3daa
anurag3/2019-CVPR-AIC-Track-2-UWIPL
/Video-Person-ReID/video_loader.py
UTF-8
14,361
2.609375
3
[ "MIT" ]
permissive
from __future__ import print_function, absolute_import import os from PIL import Image import numpy as np import torch from torch.utils.data import Dataset import random from math import exp, atan2 #import cv2 def read_image(img_path): """Keep reading image until succeed. This can avoid IOError incurred by h...
true
28df880a5398fd2c8f01f18dfbd725e116b30ecc
L271828R/tech-media-school
/day.05/ccy_matrix.py
UTF-8
3,243
3.546875
4
[]
no_license
from currency import Currency from itertools import combinations def get_value(ccy_pair, arr): for item in arr: if item.name == ccy_pair: return item.xrate if item.inverse_name == ccy_pair: return item.inverse_xrate def get_lookup_matrix(curreny_list): rows = [] f...
true
a92b097d9c8d69d06cec2f00d940a2e6a9acf6f0
melank/atCoder
/lib/指定した値の正の約数を求める.py
UTF-8
379
3.421875
3
[]
no_license
def get_divisors(num, except_self=False): if num < 1: return [] elif num == 1: return [1] else: divisor_list = [] divisor_list.append(1) for i in range(2, num // 2 + 1): if num % i == 0: divisor_list.append(i) if except_self: ...
true
2b430248482638c622914e52691a67e36a00045d
Mini-Pingu/studious-giggle
/past_apps/app4.py
UTF-8
325
3.609375
4
[]
no_license
def greet(first_name, last_name=1): print(f"{first_name}, {last_name}") # greet("a", "b") greet("a") def multiply(*numbers): total = 1 for number in numbers: total *= number return total print("hihi") multiply(2, 3, 4, 5) def save_user(**user): print(user) save_user(id=1, name="chr...
true
13a736b825c4f7f7d3029b59cc3dbac582ae72e8
tejasarackal/algo
/arrays_and_strings/permutationpalindrome.py
UTF-8
727
3.515625
4
[]
no_license
def create_char_freq_dist(istring): freq = {} for ch in istring: if ch.isalpha(): if ch in freq: freq[ch] += 1 else: freq[ch] = 1 return freq def is_max_one_odd(freq): max_one = 0 for k in freq: if freq[k] % 2 == 1 and max_o...
true
ef4cefa809b2c57304d207e57e33e8d660e622b6
ryan-workFromHome/msdsl
/msdsl/generator/case_statement.py
UTF-8
705
2.734375
3
[ "MIT" ]
permissive
from typing import List from msdsl.generator.generator import CodeGenerator def case_statment(gen: CodeGenerator, sel, var, values: List, default=None): gen.writeln('always @(*) begin') gen.indent() gen.writeln(f'case ({sel})') gen.indent() for k, value in enumerate(values): ge...
true
41c5febc6f32d896cb418e308b7fb04b5e6c279a
i-am-traveller/Codechef
/Beginner/INTEST.py
UTF-8
131
2.953125
3
[]
no_license
n,k=map(int,input().split()); count=0; for i in range(n): t=int(input()); if(t%k==0): count+=1; print(count);
true
aa35149b5ca5b707139753e1243cdbb8665482e1
AntonZhao/studyNotes
/hetao/fileRename.py
UTF-8
1,173
3.34375
3
[]
no_license
import os from nt import chdir def renameF(preName,newName): ''' rename之前要先用chdir()函数进入到目标文件所在的路径,告诉python编译器要重命名的文件在哪儿,然后才可以修改;   Python不是可怕的终结者,她其实很幼小,自己找不到文件,需要我们详细又耐心的告诉她该去哪儿找~ 路径通过 os.path.dirname()函数获得: ''' chdir(os.path.dirname(preName)) os.rename(preName,newName) def readTxt(path): #读取文本中...
true
8cd6a564794f768c3222cc846018608012bdeeee
Arshdeep-kapoor/Python
/chapter5-ques09.py
UTF-8
336
3.09375
3
[]
no_license
tution = 10000 rate = 5 total = 0 tution1 = 0 for i in range(1,11): tution1 = tution * .05 tution = tution + tution1 print(tution,"tution after 10 years") for i in range(1,3): total += tution tution1 = tution * .05 tution = tution + tution1 total+=tution print(total,"amount for 4 years ...
true
232ae345a130e9418cb0f56da1e5e2fec7f13f49
AstroCB/Swift-COVID
/pop_preprocessor.py
UTF-8
699
3
3
[]
no_license
# Preprocess the population data to reorganize into a format that's # more useful for our purposes import json IN_FILE = "population.json" ABBRV_FILE = "abbreviations.json" OUT_FILE = "swift-challenge.playground/Resources/population.json" out_data = {} with open(IN_FILE) as input_file: with open(ABBRV_FILE) as ab...
true
ec93ca95d7ca203e0bcaa006de29d84278578e93
sdivakarrajesh/Interview-Prep-questions
/Product Based company - Fit2/4/answer-py.py
UTF-8
122
3.296875
3
[]
no_license
n = input() nums = input().split() ans = [] for i in nums: if i not in ans: ans.append(i) print("".join(ans))
true
602c38a811629b35b4f917d2e14c0bffd6478a42
sarthmit/MNIST
/MNIST_Conv.py
UTF-8
2,204
2.71875
3
[]
no_license
import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data def initializer(shape): initial = tf.truncated_normal(shape, stddev=0.1) return tf.Variable(initial) def conv2d(x,W): return tf.nn.conv2d(x , W , [1,1,1,1] , padding="SAME") def max_pool(x): return tf.nn.max_pool(x , [1,2,2,1] ,...
true
319bf9fed3457e385b33a496cb687c426c862875
f1yyy/example_for_class
/exp.py
UTF-8
1,150
2.59375
3
[]
no_license
from pwn import * s = process("./test") def add_note(pay): s.recvuntil("Your choice:") s.sendline("2") s.recvuntil("Length of new note:") s.sendline(str(len(pay))) s.recvuntil("Enter your note:") s.send(pay) def delete_note(idx): s.recvuntil("Your choice:") s.sendline("4") s.recvuntil("Note number:")...
true
3baba48aea9aadc33a0e8def7a1ba6bc7a5095bd
umar-ahmed/xdtools
/xdtools/artwork/path.py
UTF-8
905
3.296875
3
[ "MIT" ]
permissive
""" Contains the definition of Path. """ from xdtools.utils import Point from xdtools.artwork import Artwork class Path(Artwork): """ A Path. === Attributes === name - The name of this Path as it appears in the Layers panel. uid - The unique id of this Path. position - The position of this Path. ...
true
6bf4d019482aa70af4d0d115c6bee9d37a05fbe9
lhannest/nnetevolution
/src/tools/uniquelist.py
UTF-8
299
3.703125
4
[]
no_license
def getUniqueItems(items): result = [] for item in items: if item not in result: result.append(item) return result class UniqueList(list): def __init__(self, items=[]): list.__init__(self, getUniqueItems(items)) def append(self, item): if item not in self: list.append(self, item)
true
6a85683099046627138f203a627b3bfaf174e710
danksalot/AdventOfCode
/2020/Day02/Program.py
UTF-8
563
3.46875
3
[]
no_license
with open('Input') as inFile: lines = inFile.read().splitlines() validCount1 = 0 validCount2 = 0 for line in lines: parts = line.split(' ') bounds = parts[0].split('-') lower = int(bounds[0]) upper = int(bounds[1]) letter = parts[1].rstrip(':') password = parts[2] count = password.count(letter) if count >= ...
true
e704b38781a9b1191fbefcc36aff13ef2512a9d1
azimmuhammad10/Python
/Octawave/Assignment_ 5(Completed).py
UTF-8
1,022
3.640625
4
[]
no_license
try: class CalC: #def __init(self): def CharChk(self,a): self.z=a count=0 for x in self.z: if x.isalpha(): count=count+1 return count def NoChk(self,a): self.z=a count=0 for x in self.z: if x.isdigit(): count=count+1 return count def SpecialChk(self,a): self.z=...
true
4553b746b818c7d2cf9535402fa9e83e107b1ddb
ruffner/globe-clock
/img2globe-nox.py
UTF-8
1,383
3.015625
3
[]
no_license
#!/usr/bin/python import sys import numpy as np import Image rmat = [[1.,0,0],[0,0,-1.],[0,1.,0]] def gen_points(w,h,tex_map): points = [] for x in range(w): percx = ((x+(1./w)) / w) lat = 2 * np.pi * percx - np.pi for y in range(h): percy = ((y+(1./h)) / h) ...
true
2df39111a0321accce601696dbcdb428ba4e5af7
ajaypraj/Python_learning
/python_interview_prep/event_queue.py
UTF-8
2,481
3.1875
3
[]
no_license
class Queue_handler: def __init__(self): self.list = [] self.status_list = [] def push(self, item): self.list.append(item) def __len__(self): return len(self.list) def pop(self): x = self.list.pop(0) # print(x.return_object().event_type) ...
true
df48f152edfe7cc7edae9a5dff344a9558cb0603
thomasvolk/R_ev3dev
/R_ev3dev/motor/motor.py
UTF-8
1,974
2.578125
3
[ "Apache-2.0" ]
permissive
from R_ev3dev.peripheral import BackgroundPeripheralCommand, PeripheralAction from R_ev3dev.interpreter import Command from R_ev3dev.ev3 import ev3dev2 class ListMotors(Command): """ list all motors """ def invoke(self, interpreter_context, args): return [{'driver_name': m.driver_name, 'address': m.ad...
true
e75fc9c95b005c6f10c4e7225d25a312d22a7fd6
raudiez/tfg
/src/raspberry/tests/createuser_and_getlights_v2.py
UTF-8
758
2.59375
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Test that, if user not exist, create it. """ import sys from libs.hue import Bridge username = 'otrousuariomas' bridge = Bridge(device={'ip':'192.168.2.121'}, user={'name':username}) def createConfig(): created = False print 'Press the button on the Hue bridge' ...
true
201bbac813ee14dd59a5271fe7047ebf73b1a03a
higorpo/dso_exercicios_05
/cachorro.py
UTF-8
216
3.015625
3
[]
no_license
from animal import Animal from mamifero import Mamifero class Cachorro(Mamifero): def __init__(self): super().__init__(3, 3) def latir(self) -> str: return self.produzir_som() + " SOM: AU"
true
fa49947627081f48a29a5a2fa704e66178f67a3d
Marcelo391/Curso-Python-Coti
/Pandas/pandas_9.py
UTF-8
1,085
2.8125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sat May 9 11:38:58 2020 @author: Marcelo Oliveira """ import pandas as pd import numpy as np df = pd.read_csv('../Arquivos_base/primary-results.csv') df.head() #Candidatos da campanha df['candidate'].unique() # PIVOT -> pivotagem, reorganização de dados tabulates dfp = pd...
true
7702bdbbf7f02afa55e38058d8bf29479917a4fe
naveen6797/python-tutorials
/programs/while_loop/reverse_list_while.py
UTF-8
129
3.296875
3
[]
no_license
A = [1,2,3,4,5,6] i = 0 length = len(A) while (length//2)> i: A[i],A[length-1-i]=A[length-1-i],A[i] print(A) i = i+1
true
e8df2dc9534c980b393959ad87ee7b2d356710b4
dergkat/HEAD
/EST/batchprocess.py
UTF-8
4,739
2.75
3
[]
no_license
import numpy as np import analysis as alysis import preprocess as prep import synthesis as synth import rospy def process_variables(x,fs,CHUNK_SIZE): """ process_variables(x,fs,CHUNK_SIZE) computes basic variables important for the entire process. Parameters: x-discrete data from the wavefile fs-sampling f...
true
ba3a6ab46f8c40f5ea4e20a159c908aaae8c3c4a
brobeson/vta
/unit_tests/test_bounding_box.py
UTF-8
2,929
3.015625
3
[ "MIT" ]
permissive
"""Unit tests for bounding box functionality.""" import unittest import vta.iou.bounding_box as bounding_box class BoundingBoxTest(unittest.TestCase): """Test cases for bounding box funcationality.""" def test_box_area(self): """Validate calculation of a bounding box's area.""" a = bounding...
true
2e4ace78b2edd8ce8b6cfa928e57f0af3b85802a
falenn/opencv-tutorial
/chapter4.py
UTF-8
1,292
3.21875
3
[]
no_license
#!/usr/bin/env python import cv2 import numpy as np # create an empty (black) color (RGB) image img = np.zeros((512,512,3),np.uint8) cv2.imshow("Image", img) print(img.shape) # color just part of the image img[200:300, 100:300] = 255, 0, 0 cv2.imshow("Image", img) cv2.waitKey(2) # color the whole matrix blue img[:...
true
c7b9da64297bbe22c2a03ce19c5b92788e5c2241
balaraman-08/digitizer-backend
/flaskr/extract.py
UTF-8
2,131
2.578125
3
[]
no_license
import sys import os import json import cv2 import pytesseract from pytesseract import Output from pandas import DataFrame from numpy import dtype def extract_data(image_path): pytesseract.pytesseract.tesseract_cmd = os.getenv("TESSARACT_PATH") print("[INFO] loading image...") img = cv2.imread(image_path)...
true
586c8323d1e617ee92e1a5aea7df6dfdbe22a436
gn0/sacsv
/sacsv/widecsv2long.py
UTF-8
4,403
2.59375
3
[ "CC-BY-4.0" ]
permissive
import argh import sys import csv import re import operator as op def drop_dups(iterable): seen = set() for item in iterable: if item not in seen: seen.add(item) yield item @argh.arg("-v", "--var-re", type=str, nargs="+") @argh.arg("-r", "--repeat-var-re", type=str, nargs="...
true
59b3128a3b00f47eaab1d71f51c89fed38a2c1aa
KenT2/pipresents-beep-examples
/pp_home/pp_profiles/pp_multidisplay_1p4/pp_track_plugins/krt_time_concurrent.py
UTF-8
3,009
3.015625
3
[]
no_license
""" This example writes to the screen directly using Tkinter. The local time is read and is written direct to the Tkinter canvas that is used by Pi Presents to display its output. """ import time from tkinter import NW class krt_time_concurrent(object): def __init__(self,root,canvas,plugin_params,track_params,...
true
c6ff09c2e22c696270d52fb9571a3a7feedb67b3
iranpy/ghanat
/ghanat/source/source_configs.py
UTF-8
3,685
2.59375
3
[]
no_license
from typing import List from enum import Enum from pyspark.sql.types import MapType,StringType from pyspark.sql.dataframe import DataFrame from pyspark.sql.functions import from_json, col from pyspark.sql.types import StringType, StructType, StructField, IntegerType class SourceConfig: def read(self) -> DataFrame...
true
6296cde9c4e30a6c292e0f1a6d2be912f1c636c3
girtel/AIML4Diabetes
/simglucose/analysis/risk.py
UTF-8
809
2.578125
3
[ "MIT" ]
permissive
import numpy as np import warnings def risk_index(BG, horizon): # BG is in mg/dL # horizon in samples with warnings.catch_warnings(): warnings.simplefilter('ignore') BG_to_compute = BG[-horizon:] #print('BG=',BG,'BG_to_compute=',BG_to_compute) fBG = 1.509 * (np.log(BG_to_co...
true
f2a66c068a24fe65bdf8eda589c38967481f6d8b
parmarjh/100day-coding-challenge
/day 15/nth_node.py
UTF-8
818
3.890625
4
[]
no_license
class Node(): def __init__(self,data): self.data = data self.next = None class linkedlist(): def __init__(self): self.head = None def push(self,new_data): new_node = Node(new_data) new_node.next = self.head self.head = new_node def get...
true
35ed73b9da843cdbfe7d2b9447243e1b5ef91beb
nisholics/Practical-Python
/p3_2.py
UTF-8
587
3.5
4
[]
no_license
# A Python program to retrieve all rows from employee table and display the # column values in tabular form. import mysql.connector mydb = mysql.connector.connect( host="localhost", user="root", password="root", database="demo") sql="SELECT * from emp;" cur=mydb.cursor() cur.execute(sql) result_set = ...
true
4d7e4da9cf34626c172cf6018b4f2ebf56efa8fa
awaybrave/voicePython
/Test/Notes.py
UTF-8
1,563
3.453125
3
[]
no_license
#Test is to make code do something and see how it works. #Change has its danger. If program is well designed, then the effect of #change should be local and debugging is easier if you spot the bug. #The 1-2-3(and 4) of Testing #1.Figure out what the new feature is. #2.Write skeleton code and make the tests fail. #3.Wr...
true
e0f51848b67a8862b58cd12bcc6b235f68419b1a
masasin/advent_of_code_2015
/tests/test_day_13.py
UTF-8
2,128
3.390625
3
[ "MIT" ]
permissive
from itertools import permutations from day_13 import Arranger inputs = ("Alice would gain 54 happiness units by sitting next to Bob.\n" "Alice would lose 79 happiness units by sitting next to Carol.\n" "Alice would lose 2 happiness units by sitting next to David.\n" "Bob would gain 83 ...
true
0d26e85cc2ea08584971247ef9ea7d0b34b06197
rporumalla/Interview_Programming_Practice
/LCA.py
UTF-8
928
3.625
4
[]
no_license
# O(n) class Node: def __init__(self,key): self.key=key self.left=None self.right=None def findPath(root,path,n): if not root: return False path.append(root.key) if root.key==n: return True if (root.left and findPath(root.left,path,n)) or (root.right and findPath(root.right,path,n)): ...
true