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
6d9ab272bf8cf5e2da6cc16d7bf3dd1af39bb7ab
pwchen21/pros
/python/Leetcode/Apr.30day_challenge/0411.py
UTF-8
588
3.4375
3
[]
no_license
class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def diameterOfBinaryTree(self, root: TreeNode) -> int: if not root: return 0 ans = self.dep(root.left) + self.dep(root.right) return max(ans, ma...
true
b19323fdf6fd157bbd4109f49604721e09ecb66a
thejxp/spotlight
/backup_demo.py
UTF-8
549
2.71875
3
[]
no_license
from spotlight import * def parseID(url, apps): ID = "" i = len(url)-1 while(url[i] != "/"): ID = url[i] + ID i = i - 1 text = apps.api.get_status(ID) return (text.text) machine = MachineSpotlight() machine.manage_data() machine.build_classifier() application = Spotlight() ...
true
d160bc2859d65d9e4b1688498bb8d9cc5311d837
DECKHANDANT5277/hacks
/hacks/errors/json_errors/404.py
UTF-8
422
2.890625
3
[ "MIT" ]
permissive
# coding: utf-8 """ hacks~errors~json(404) status_code -> 404 { 'message': 'not found' } """ class NotFound(Exception): status_code = status_code message = 'not found' def __init__(self, payload=None): Exception.__init__(self) self.status_code = status_code self.message = message self.payload = p...
true
96bc8de76716d376319db2ea577f90410bf54beb
kishore-narendran/Lippi
/search.py
UTF-8
3,295
2.953125
3
[]
no_license
from pymongo import MongoClient from nltk.corpus import stopwords import re from nltk.stem.lancaster import LancasterStemmer from math import log import json import operator import argparse class Search: def __init__(self, search_query): self.search_query = search_query self.tokens = [] se...
true
6bbed0a16015415dd539a779fc810155c253ab0b
RenegaDe1288/pythonProject
/lesson21/mission06.py
UTF-8
1,003
3.984375
4
[]
no_license
def choise(question, one_more='Неверный ввод. Пожалуйста, введите да или нет.', time=4): while time != 0: answer1 = input(question) if answer1 == 'да': print('Сделано') break elif answer1 == 'нет': print('Оставлено') break else: ...
true
23634beb6c81cf438909f07eeb19d91c90286fae
StevenClontz/spring-2013-programming-challenges
/110401/main.py
UTF-8
613
3.515625
4
[]
no_license
def medianish(list_of_ints): middle = len(list_of_ints) / 2 return sorted(list_of_ints)[middle] import sys readlines = sys.stdin.readlines() # reads input to list of strings for each line inputString = "" for item in readlines: inputString += item inputListStrs = inputString.split() inputList = [int(item) for...
true
dd62378aaeba577505bf4443f7b8d0f8d6dc7473
r3cgm/ArchiveR3
/backup.py
UTF-8
22,220
2.765625
3
[]
no_license
#!/usr/bin/env python from ArchiveR3 import * import argparse from colorlog import ColoredFormatter try: from hurry.filesize import size except ImportError, e: print e print 'Hint: try running "pip install hurry.filesize"' sys.exit(1) import logging import math import re import subprocess import sys im...
true
53c502e2eb3a6fe34c1453dec0734e3aa78ac91f
James-Lappin/advent-of-code
/day2/day2.py
UTF-8
1,067
3.140625
3
[]
no_license
from operator import add, mul codes = {1: add, 2: mul} def run_intcode(position, input): opcode = input[position] if opcode == 99: return input lookup1 = input[position + 1] lookup2 = input[position + 2] lookup3 = input[position + 3] if len(input) <= lookup1 | len(input) <= lookup2 | ...
true
d9353b2a9311c7a4e31d6c3a2fc815e2ee6b72f5
chrisjanusa/PoGoChatBot
/ChatBot/Info/GenericResponses.py
UTF-8
3,292
3.125
3
[ "MIT" ]
permissive
INRODUCTION = [ "Hi, my name is Pogo. What is your name?", "Hey, Pogo here. Have we met before? Remind me of your name either way!", "I'm Pogo and I am super excited to be your friend just tell me your name cause mommy says I'm not allowed to talk to strangers" ] NO_NAME = [ "Sorry I think I missed you...
true
2bea4a2e5d28fe0d8290b16c6b884aa0d93d36cc
TudicEdward/Diverse-Programe
/compunere_pentru_patrate.py
UTF-8
395
3.28125
3
[]
no_license
n=int(input("introduceti numarul: ")) lista_patrate=[] for i in range(1,n): if i**2>=n: break else: lista_patrate.append(i**2) for a in lista_patrate: for b in lista_patrate: for c in lista_patrate: for d in lista_patrate: if n==a+b+c+d: ...
true
b4cec13db65b750b75e3eb129b6246f629a4d677
stroke-one/ProjectEuler_Python
/Euler_021.py
UTF-8
518
3.25
3
[ "MIT" ]
permissive
import time t = time.time() def facts(n): divisors = [1] for test_number in range(2, int(n**.5)): if n % test_number == 0: divisors.append(test_number) divisors.append(n//test_number) return(divisors) amicable = [] for test_limit in range(1, 10001): if not test_limit i...
true
0d5bc01065912588b0fe415156eacf5dfe6acb29
chrisvoncsefalvay/sadie
/sadie/agents/walkers.py
UTF-8
7,550
3.265625
3
[ "MIT" ]
permissive
from scipy import stats import numpy as np from numpy import pi as π from sadie.agents.exceptions import NoTargetError from sadie.agents.spatial import TargetableAgent, AgentStates class BaseWalker(TargetableAgent): """ The `BaseWalker` is a base class that implements the basic notion of a _walker_: an agent ...
true
f99c770138c05bd5aa4b2d8f0785aa96c441ce6a
JKP0/PG_Academic_Projects
/Optimization/LineSearch_DirectionSearch/LS_Wolfe_Powell_with_Goldstein_Update.py
UTF-8
1,582
3.015625
3
[ "MIT" ]
permissive
#Modified Wolfe_Powell Algorithm. import numpy as np from InputFunction import func, gradf #def MdLineSearchWP(X, d, mxiter=30, rho=0.15, sigma=0.30, err=0.0001): def MdLineSearchWP(X, d, pd={}): dpd={'mxiter':30, 'rho':0.15, 'sigma':0.30, 'err':10**-4} if(bool(pd)): for key in pd.keys(): ...
true
e1c0ed8d6cacb7387873e627c573344a35c5e24f
SunHwan-Park/problem-solving
/swea/1865/1865_장현준.py
UTF-8
865
2.640625
3
[]
no_license
import sys sys.stdin = open('input.txt') def go(s, percent): v = [] res = 0 while s: r, c = s.pop() # v도착후 행동 now = percent.pop() #확률 while len(v) != r: v.pop() v.append(c) if now > res: #백트래킹 if r == N-1: # 일 분배완료 & now > res ...
true
7634880263340b0d23ea7b2975f99a6fa8886d28
fxyyy123/book_codes
/ch5/exercises/ans5_7.py
UTF-8
237
2.6875
3
[ "MIT" ]
permissive
# 先确认在VSCode的Settings中,勾选“Terminal:Excute In File Dir” # 将hello_world_bak.txt文件重命名为hello_world_copied.txt src = r'hello_world_bak.txt' dst = r'hello_world_copied.txt' import os os.rename(src, dst)
true
e108c30c7659724080ad33912a36a79945a32d5a
haileyhansard/CS2-Notes-and-Algorithm-Problems-Week-5
/Day_1_Artems_Lecture_Notes.py
UTF-8
2,730
4.75
5
[]
no_license
''' HASH TABLES - First two days: build your own hash table from scratch - Second two days: applications of hash tables DAY 1 NOTES: HASH FUNCTIONS: - Any string input ---> returns/outputs a Specific Number (within some range) - This function is deterministic, meaning, the same input will always return the same out...
true
c8afcf5e1f7dbec7c8d680aef1f34e3b94ed6042
mp3201/COMS_W4705--Natural-Language-Processing
/02-PCFG and CKY/python/parse_p1.py
UTF-8
1,018
2.828125
3
[]
no_license
import pickle import json def update_tree_with_rare(tree): if isinstance(tree, basestring): #tree can NOT be a string return if len(tree) == 3: # It is a binary rule.. Recursively count the children. update_tree_with_rare(tree[1]) update_tree_with_rare(tree[2]) elif len(tree) == 2: # It is a unary ...
true
2652d55362e22c4a6c40b6c2a58ce8fde80ca6a6
fughilli/router_table_scripts
/generate_offsets.py
UTF-8
1,119
3.078125
3
[]
no_license
import fractions from util import FormatImproper kFootInches = 12 board_width = 5 * kFootInches inner_spacing = fractions.Fraction('7.75') wall_thickness = fractions.Fraction('0.75') num_ribs = 6 outer_spacing = (board_width - (num_ribs - 1) * inner_spacing - (num_ribs + 2) * wall_thickness) / 2 p...
true
2fcbae71295cde78eff1749ff7a6d0339b097428
tktwr/samples
/py/tkinter/image.py
UTF-8
681
3.0625
3
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- import tkinter import cv2 from PIL import Image, ImageTk root = tkinter.Tk() root.title("Show Image from OpenCV in Tkinter canvas") image_bgr = cv2.imread("../../data/sample.jpg") image_rgb = cv2.cvtColor(image_bgr, cv2.COLOR_BGR2RGB) # imreadはBGRなのでRGBに変換 image_pil = Im...
true
09a0f92fc104ca2502c7198852d415fa56dff784
digidotcom/xbee-micropython
/samples/remote_manager/drm_http_requests/main.py
UTF-8
3,639
2.5625
3
[ "MIT", "LicenseRef-scancode-free-unknown" ]
permissive
# Copyright (c) 2019, Digi International, Inc. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, pu...
true
4030246619b83783cde9570a3faf5754d7a71f45
likai28/Robot_Autonomy_HW4
/code/HerbEnvironment.py
UTF-8
5,818
2.8125
3
[]
no_license
import numpy import time class HerbEnvironment(object): def __init__(self, herb): self.herb = herb self.robot = herb.robot # add a table and move the robot into place #table = self.robot.GetEnv().ReadKinBodyXMLFile('models/objects/table.kinbody.xml') #self.robot.GetEnv...
true
4ed468dd79c9380f42d8e27c3c863d49a9fcbba1
toddrme2178/pyccel
/tests/syntax/test_syntax.py
UTF-8
1,014
2.71875
3
[ "MIT" ]
permissive
# coding: utf-8 # Note that we need to change the directory for tests involving the import # statement from pyccel.parser import Parser from pyccel.parser.errors import Errors import os def test_syntax(): print('*********************************') print('*** ***') print('*** ...
true
4fee842ac53de36d2f9dd1244ae7c6f31569b8bf
green-fox-academy/judashgriff
/Week 2/Day 1/Py11.py
UTF-8
859
3.984375
4
[]
no_license
a = 3 # make it bigger by 10 a += 10 print(a) b = 100 # make it smaller by 7 b -= 7 print(b) c = 44 # please double c's value c += c print(c) d = 125 # please divide by 5 d's value d /= 5 print(d) e = 8 # please cube of e's value e **= 3 print(e) f1 = 123 f2 = 345 # tell if f1 is bigger than f...
true
3264aa7c5f62802394549143be1bfb288066be5d
maykim51/ctci-alg-ds
/17.2.shuffle.py
UTF-8
1,029
3.875
4
[]
no_license
''' #popular!! CTCI 17.2 Shuffle: Write a method to shuffle a deck of cards. It must be a perfect shuffle- in other words, each of the 52! permutations of the deck has to be equally likely. Assume that you are given a random number generator which is perfect. SOLUTION (2options) option 1 recursion : n-1을 ...
true
4ac622126312487a8fad6378adb04ce5d60c8e0d
Iambrijeshrana/FreeCodeCamp-DS
/With Python/KNN-Algo/KNN.py
UTF-8
1,942
3.296875
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sat Sep 12 14:37:27 2020 @author: Brijesh.R """ import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns from sklearn.preprocessing import StandardScaler from sklearn.model_selection import train_test_split df = pd.read_csv("D:/personal/Dat...
true
68a34f259631e9f8b2441bc8a2ba772c831f1172
VKeiby/Python_less
/LearnPy/dict.py
UTF-8
1,887
4.03125
4
[ "MIT" ]
permissive
# Тип данных СЛОВРИ (dict)------------------------ #------------------------------------------ # Инициализация dict_temp = {} print(type(dict_temp), dict_temp) dict_temp = {'dict1': 1, 'dict2': 2.1, 'dict3': 'name', 'dict4':[1,2,3]} print(type(dict_temp), dict_temp) dict_temp = dict.fromkeys(['a', 'b'], [12,'20...
true
0e9e6cac504f8182c9ded9e315a3a1f562ea7e9a
zuxinlin/leetcode
/hackerrank/ThirdLatestDate.py
UTF-8
504
2.921875
3
[]
no_license
#! /usr/bin/env python # coding: utf-8 import datetime def third_latest(dates): date_list = list(set([datetime.datetime.strptime(str(d), '%d-%m-%Y') for d in dates])) date_list = sorted(date_list) print [i.strftime('%Y-%m-%d') for i in date_list] return date_list[-3].strftime('%Y-%m-%d') def main(...
true
ce2e63449c56df6f7299ab25fb0832d989cb0755
yeboahd24/Python201
/PYTHON LIBRARY/SUB_6/hmac_base64.py
UTF-8
284
2.65625
3
[]
no_license
import base64 import hmac import hashlib with open('lorem.txt', 'rb') as f: body = f.read() hash = hmac.new( b'secret-shared-key-goes-here', # The secret key body, # content hashlib.sha1, # key type ) digest = hash.digest() print(base64.encodebytes(digest))
true
6aef497bc2294f1e695ad50c9afa5e596f212503
Pranay1906/tathastu_week_of_code
/Day01/Program04.py
UTF-8
220
3.5625
4
[]
no_license
c_price= int(input("Entert a cost price")) s_price= int(input("Entert a sell price")) profit =(s_price-c_price) print(f"profit = {profit}") print(f"seeling price should be :{s_price+profit*(5/100)} for 5 % more profit")
true
45d32908e019e3c2f68a421ce3f87b130470e57d
billdback/stringer
/stringer/stringer.py
UTF-8
669
4.21875
4
[ "MIT" ]
permissive
class Stringer: """ Simple class that will convert strings to upper and lower and write the results. """ def __init__(self): """Creates a new stringer.""" pass @staticmethod def to_upper(s): """ Converts the string to upper case. :param s: The string t...
true
ace35669aa7f48337b9ea5058db7bbe3d492723a
Eternally1/web
/python/fullstacks/week2/day1/mydict_test.py
UTF-8
699
2.953125
3
[]
no_license
# @author: "QiuJunan" # @date: 2018/3/6 14:08 import unittest from mydict import Dict class TestDict(unittest.TestCase): def test_init(self): d = Dict(a=1,b='test') self.assertEqual(d.a,1) self.assertEqual(d.b,'test') self.assertTrue(isinstance(d,dict)) def test_key(self): ...
true
5074f2dcbf9c9c88d20b5b2c8a2ed7c8eb8377e3
taddyb/597-009
/midterm/cavity_new/cavity/plotUnNormal.py
UTF-8
1,293
2.59375
3
[]
no_license
#!/usr/bin/env python import os, sys import math import numpy as np from numpy import loadtxt import matplotlib.pyplot as plt #plt.rc('text', usetex=True) plt.rc('font', family='serif') plt.figure(1); plt.ylabel("U (log scale)", fontsize=16); plt.xlabel("Time", fontsize=16); plt.title(" Ux and Uy un-normalized for ...
true
db0f3e3769ddd98d9bf07b4cd320d8551f4023e8
alexander-svendsen/ev3-python
/examples/behavior/fuzzy/test.py
UTF-8
2,081
3.171875
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- from behaviors.fuzzy import * MIN_BLOCKING_DISTANCE = 0.0 MAX_BLOCKING_DISTANCE = 0.20 DISTANCE = 0.25 # in meters class Forward(Behavior): def update(self): self.fuzzy_if(rising_fuzzy(MIN_BLOCKING_DISTANCE, MAX_BLOCKING_DISTANCE, DISTANCE), 'translate', 0.25) self.fuzz...
true
f781ad7852a3bfc862ad873e9fa9d835c8c67b9f
neusinn/digilab-aws
/aws-cdk-ex/demo_stack.py
UTF-8
2,189
2.515625
3
[]
no_license
from aws_cdk import core from aws_cdk import aws_ec2 as ec2 from aws_cdk import aws_autoscaling as autoscaling from aws_cdk import aws_elasticloadbalancingv2 as elbv2 # Hint 1: Add modules in setup.py and run pip install -r requiremnts.txt # Hint 2: Cleanup resources with $ cdk destroy ! Otherwise you get charged cl...
true
b28fa44abf597eee4bfc176551b571ec2f70b0f4
ppppdm/mtcpsoft
/test/addup_log.py
UTF-8
985
3.09375
3
[]
no_license
# -*- coding : gbk -*- # author : pdm # add up total recv of server , each client sending client_list = list() count_list = list() TOTAL_RECV = 0 def __add(name): if name in client_list: i = client_list.index(name) count_list[i] += 1 else: client_list.append(name) ...
true
ed696988f5acc9d3e0175720765b2080347e7bb7
ivelinakaraivanova/SoftUniPythonAdvanced
/src/Tuples_and_Sets_Lab/02_Average_Student_Grades.py
UTF-8
432
3.859375
4
[]
no_license
def average(some_list): return sum(some_list) / len(some_list) n = int(input()) students = {} for i in range(n): info = input().split() name = info[0] grade = float(info[1]) if name not in students: students[name] = [] students[name] += [grade] for student, grades in students.items(...
true
ec7dc1de8acbc11ccfd22a439952073b599f25fd
kep-w/python_basic
/basic_exercise/no_repeat_number.py
UTF-8
533
4.1875
4
[]
no_license
# 1、有四个数字:1、2、3、4,能组成多少个互不相同且无重复数字的三位数?各是多少? # 程序分析:可填在百位w、十位、个位的数字都是1、2、3、4。 # 组成所有的排列后再去 掉不满足条件的排列。 l = [] for x in range(1,5): for y in range(1,5): for z in range(1,5): a_re = x*100 + y*10 +z if x != y and x != z and y != z: l.append(a_re) print('能组成%d个无重复的数字,他们是...
true
da6d5896a7481beb23929832a30388e71fe87b12
AndrewCMartin/idb
/selenium/TestSearch.py
UTF-8
2,531
2.578125
3
[ "MIT" ]
permissive
from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.common.keys import Keys from selenium.webdriver.support.ui import Select import selenium.webdriver.support.ui as ui from selenium.common.exceptions import NoSuchElementException from selenium.common.exceptions import NoAl...
true
0f55749703435905d1364eb9cd21db4e8f8d3e37
huigoing/algorithm
/程序员面试宝典/61.无缓存交换.py
UTF-8
492
3.5625
4
[]
no_license
# -*- coding: utf-8 -*- """ Created on Sun Jul 14 16:07:23 2019 @author: Tang """ ''' 题目描述 请编写一个函数,函数内不使用任何临时变量,直接交换两个数的值。 给定一个int数组AB,其第零个元素和第一个元素为待交换的值,请返回交换后的数组。 测试样例: [1,2] 返回:[2,1] ''' def exchangeAB( AB): # write code here AB[0]+=AB[1] AB[1]=AB[0]-AB[1] AB[0]=AB[0]-AB[1] ...
true
9b8bc108d4ccdfb5b80068cdf8e47d02ef1caba7
ClaytonStudent/leetcode-
/OfferPython/18_delete_next_node.py
UTF-8
599
4
4
[]
no_license
# 题目:在O(1)时间内删除链表的节点 class ListNode(object): def __init__(self, x): self.val = x self.next = None class Soluton(object): def deleteNode(self,head,val): if head.val == val: return head.next pre,cur = head, head.next while cur and cur.val != val: ...
true
61262a4eb1541dc055bc1e512a3ee9837d65f13c
kjhurley/workspace-for-learnign
/newmystuff/src/guide/test_guide_model.py
UTF-8
9,850
2.546875
3
[]
no_license
import guide_model import unittest # pylint: disable W054 class GuideTests(unittest.TestCase): def test_add_a_channel(self): chan=guide_model.Channel( 7, '4Music', 18, ) g=guide_model.Guide() g.add_a_channel(chan) self.assertEqual(g.channel(7).name, "4Music") def test_...
true
a424bc5b3f0edea6efc7b2545b9b67ade1e0a702
edallon/qbb2018-answers
/day4-homework/03-timecourse_reps14.py
UTF-8
1,570
2.78125
3
[]
no_license
#!/usr/bin/env python3 """ Usage: ./03-timecourse_reps14.py <t_name> <samples.csv> <replicates.csv> <ctab_dir> """ import sys import os import pandas as pd import matplotlib.pyplot as plt def plot(csv, gender): frame = pd.read_csv(csv) soi = frame.loc[:, "sex"] == gender frame = frame.loc[soi, :] f...
true
34b2d5fa71df6a265c54c2be96ca36b7d8be7943
andremcmullan/AM_pbd
/CA1/calculator_app.py
UTF-8
3,818
3.96875
4
[]
no_license
import unittest from calculatorA import Calculator def welcome(): print(''' Welcome to Andrea's Calculator ''') welcome() def calculate(): #the calculator will ask the user to select any of the options below operation = raw_input(''' Please type in the math operation you would like to c...
true
ff598f8661ca148294ef4fec97726c1602f3804a
rohanath123/D-Rex
/ocr_test.py
UTF-8
1,501
2.6875
3
[]
no_license
from ocr_test import * import os import matplotlib import matplotlib.pyplot as plt from helper import * def detect_document(path): """Detects document features in an image.""" from google.cloud import vision import io client = vision.ImageAnnotatorClient() with io.open(path, 'rb') as...
true
f06be232a4b7bb8fa9e6946a342ca87ef6a91a46
halitcelik/cookiecutter-django
/{{cookiecutter.project_slug}}/apps/cruncher/auth_backends.py
UTF-8
532
2.625
3
[]
no_license
from django.contrib.auth.models import User from django.contrib.auth.hashers import check_password class EmailBackend(object): def authenticate(self, email="", password=""): users = User.objects.filter(email=email) for user in users: if user.is_active and check_password(password, user....
true
c62ee35bf1bb9a45dc0f28042551c0f1a97fe365
yigo3000/backtest
/backtest/test/rq.py
UTF-8
2,897
2.6875
3
[]
no_license
from rqalpha import run_code import pickle code = """ from rqalpha.api import * import talib # 在这个方法中编写任何的初始化逻辑。context对象将会在你的算法策略的任何方法之间做传递。 def init(context): context.s1 = "000001.XSHE" # 设置这个策略当中会用到的参数,在策略中可以随时调用,这个策略使用长短均线,我们在这里设定长线和短线的区间,在调试寻找最佳区间的时候只需要在这里进行数值改动 context.SHORTPERIOD = 2...
true
3fcbf60e096b9b402a177cbb6c7a83d64b5d6691
rcrowther/django_languages
/language_choices.py
UTF-8
8,627
2.53125
3
[]
no_license
from django.utils.encoding import force_text import locale import collections from itertools import chain, islice from .langbase import LANGBASE from .langbase_specials import LANGBASE_SPECIALS from .lang_models import Language, LangData from .selectors import UNITED_NATIONS, DJANGO_TRANSLATED try: import pyuca ...
true
1ff06ce724154a516764088660e013e320edc488
EricxY211/lsbate
/part2/test_template2.py
UTF-8
4,185
2.75
3
[ "MIT" ]
permissive
# -*- coding: utf-8 -*- import sys import pytest sys.path.insert(0, '../part1/') from test_template1 import TestTemplateD as TestTemplate1D # noqa from template2a import Template as TemplateA # noqa from template2b import Template as TemplateB # noqa from template2c import Template as Temp...
true
dc3fddb32ef62758779fa6752e198e5a6ad89cb8
mgrebenets/fastlane-plugin-xcconfig_actions
/lib/fastlane/plugin/xcconfig_actions/helper/scripts/parse.py
UTF-8
404
2.65625
3
[ "MIT" ]
permissive
from bs4 import BeautifulSoup import re soup = BeautifulSoup(open("page.html"), "html.parser") entries = soup.find_all("div", id=re.compile("dev.*")) title_re = re.compile(".*\((.*)\)") settings = [] for e in entries: text = e.find("h2", class_="Name").text m = title_re.match(text) if m == None: ...
true
d5b323e10f7ad602bd057a8f02916b45461ca8b3
CMU-IDS-2020/fp-airbnb-rats
/clustering/js/backend.py
UTF-8
3,189
2.65625
3
[ "BSD-3-Clause" ]
permissive
from flask import Flask from flask_cors import CORS from flask import request import json import pandas as pd from sklearn.cluster import KMeans from sklearn.preprocessing import StandardScaler from sklearn.decomposition import PCA from sklearn.cluster import AgglomerativeClustering import numpy as np app = Flask(__na...
true
5042edaffe1fb1fad02ce26c6725f96468c8ee82
Amal548/QAMA
/tests/android/hpbridge/regression/Binding/test_05_add_or_delete_customize_group.py
UTF-8
4,414
2.890625
3
[]
no_license
# coding: utf-8 import pytest from MobileApps.libs.flows.android.hpbridge.utility.api_utility import APIUtility from MobileApps.libs.flows.android.hpbridge.utility import utlitiy_misc from MobileApps.libs.flows.android.hpbridge.utility.random_utility import RandomUtility pytest.app_info = "hpbridge" class TestAddOrD...
true
2d76b3f703362b3159a94be54cd3165f3a963153
sasanrz/Codility
/Lsson2_OddOccurrencesInArray.py
UTF-8
374
2.828125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Wed Oct 10 13:09:53 2018 @author: Sasan Raeissian sasanrz@gmail.com """ import numpy as np import pandas as pd A= [9, 3, 9, 3, 9, 7, 9] def solution(A): stat=1 while(stat==1): s=A[0] if A.count(s)!=1: A.remove(s) A.remove(s) ...
true
478c4c341bb950c641ace2bdb37d0e49412e1711
hazel-nut-old/euler-python
/p1to10.py
UTF-8
3,280
3.640625
4
[ "MIT" ]
permissive
from math import log import constants import helper def problem_1(): """Find the sum of all the multiples of 3 or 5 below 1000.""" return sum([i for i in range(1000) if i % 3 == 0 or i % 5 == 0]) def problem_2(): """By considering the terms in the Fibonacci sequence whose values do not exceed four mi...
true
790487c0627beeae74a5d55e29d967a723c7df7a
bvermeulen/seismic-analysis-and-plotting
/Utils/utils.py
UTF-8
2,945
4.0625
4
[]
no_license
import numpy as np from datetime import date ''' module for general purpose utility functions ''' def string_to_value_or_nan(string_value, type): ''' convert string value to a value of type type which can be int, float or date if string cannot be converted the value will be a np.NaN Date format...
true
587c3b3f904dfc911b54a1a92a730f29b3964c0a
juiyangchang/LeetCoding
/python/322_Coin_Change.py
UTF-8
722
2.828125
3
[]
no_license
from collections import defaultdict class Solution: def coinChange(self, coins, amount): """ :type coins: List[int] :type amount: int :rtype: int """ if not amount: return 0 edges = coins[::-1] queue = [amount] vis...
true
87615ad6787ca83400405b51c8b257e4c47468ee
frenetic-be/picontrol_server
/picontrol_server/threads.py
UTF-8
3,171
3.375
3
[]
no_license
""" .. module:: picontrol_server.threads .. moduleauthor:: Julien Spronck .. created:: March 2017 This module contains everything related to threading. In particular, multi-threading will be used for pushing data about the GPIO input pins from the server to the client. """ import threading def start_new_thread(targe...
true
a4f8e8bbc6a500cecc1a64b4457cef7117f47f67
TBAALi/tbaali
/Python/test_numpy.py
UTF-8
111
3.140625
3
[]
no_license
# test numpy import numpy as np a = np.array([1, 2, 3]) print(a) b = np.array([[1, 2], [3, 4]]) print (b)
true
546921db696cde60f0a50de56d806970a43209c7
Amitnijjar008/CSE150
/Assignment 3/CSE150_Assignment_3/CSE150_Assignment_3/solutions/p4_ac3.py
UTF-8
1,991
3.109375
3
[]
no_license
# -*- coding: utf-8 -*- from collections import deque def ac3(csp, arcs=None): """Executes the AC3 or the MAC (p.218 of the textbook) algorithms. If the parameter 'arcs' is None, then this method executes AC3 - that is, it will check the arc consistency for all arcs in the CSP. Otherwise, this method s...
true
92a1426c6498a8b59e162b8c995c8033197bb163
jw3329/leetcode-problem-solving
/Top Interview Questions/related/653. Two Sum IV - Input is a BST/solution2.py
UTF-8
708
3.375
3
[]
no_license
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def findTarget(self, root: Optional[TreeNode], k: int) -> bool: arr = [] def dfs(ro...
true
4e62793b00a6f2ad4f0e5192f03a6eefe9cc5360
170311z/python
/bhnet.py
UTF-8
5,866
2.765625
3
[]
no_license
# -*- coding: utf-8 -*- import sys import socket import getopt import threading import subprocess # グローバル変数の定義 listen = False command = False upload = False execute = "" target = "" upload_destination = "" port = 0 # もし定義していないコマンドラインパラメーターが指定されていた場合は,このスクリプトの使い方を表示する def usage(): print "BHP Net Tool" print pri...
true
f7379ea3bfd3100809f5be0692064fa60ac8d01e
lhoangan/dot
/mylibs/plotex.py
UTF-8
2,883
3.234375
3
[]
no_license
import os if 'FIGSIZE' not in os.environ: os.environ['FIGSIZE'] = '496.7855' print ('Default Figure size is set to ', os.environ['FIGSIZE']) print ('Check your number by running \\the\\linewidth or \\the\\textwidth in LaTeX') print ('Apply the new number by overwrite it to os.environ[\'FIGSIZE\'] and reload') print...
true
d2070d4c77689186c707bc8955840667261cae5a
Aasthaengg/IBMdataset
/Python_codes/p03495/s689963723.py
UTF-8
332
2.671875
3
[]
no_license
import sys from collections import Counter input = lambda: sys.stdin.readline().rstrip() def main(): n, k = map(int, input().split()) a = list(map(int, input().split())) a_cnt = sorted(list(Counter(a).values())) s = set(a) t = max(0, len(s) - k) print(sum(a_cnt[0:t])) if __name__ == '__main__'...
true
0eca6444da4ac14306a27c4f6de6291ae050f96d
ucabqze/Cinema-Booking-System
/main.py
UTF-8
1,264
3.5
4
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Dec 23 21:47:14 2018 @author: cengqiqi """ # '/Users/cengqiqi/Desktop/qiqizeng' import os import employee import customer def display_text(): """ display the welcome text. """ os.system('clear') print("\t***************************...
true
71b601e25e1fadcfeb5043074c3cd0ddfdcae37a
SicongLiu/TopK
/Python_Analysis/Candidate_Score_Checker.py
UTF-8
5,709
2.53125
3
[]
no_license
# script to generate .sh file for execution # bash file includes execution of Ground Truth, LSH Scheme and Overall Performance import math import os def cal_cumsum(input_num): i = 0 count = 0 while i <= input_num: count = count + i i = i + 1 return count # dimensions = [4, 5] dimens...
true
79f7a490ffaeebcc66bc7deecb678589d828fb87
cyrillkin/DLA_105
/Lesson-2/hw02.py
UTF-8
2,648
4.59375
5
[]
no_license
__author__ = 'Маштаков Кирилл Владимирович' # Задача-1: Запросите у пользователя его возраст. # Если ему есть 18 лет, выведите: "Доступ разрешен", # иначе "Извините, пользоваться данным ресурсом можно только с 18 лет" age = int(input('How old are you:')) if age >= 18: print('\nДоступ разрешён') else: print(...
true
a712bbc1155f4966b1a389ce1f81c747ce2c8f2d
sank2000/py_oop
/magic or dunder method.py
UTF-8
353
3.859375
4
[]
no_license
class Employee: def __init__(self,name,salary): self.name = name self.pay = salary def __len__(self): return len(self.name) def __add__(self, other): return self.pay+other.pay e1 = Employee("san",10000) print(len(e1)) e2 = Employee("vel",20000) print(len(e2)) pr...
true
ba61262a5531227a0fb6bc2057bf527a31d8e5ad
rocity/programming-problems
/exercises/jellybean/models.py
UTF-8
3,168
3.6875
4
[ "Apache-2.0" ]
permissive
from random import randint class Jellybean(object): """docstring for JellyBean""" def __init__(self, color, poisonous): self.color = color self.poisonous = poisonous super(Jellybean, self).__init__() def printProperties(self): print ("Color: %s" % self.color) print...
true
b409204e1e3d7b43c3788ac23a1d9210c1a76172
klevis-a/process-vicon-biplane
/biplane_tasks/performance/cs_transform_mats_one_mat.py
UTF-8
1,736
3.453125
3
[ "MIT" ]
permissive
"""This script tests whether matmul or einsum is faster at transforming a collection of matrices into a different coordinate system. In biomechanics this operation is performed when transforming a segment pose trajectory into a different coordinate system. """ import numpy as np import time # transform all frames in...
true
1b919b5f548339f97751804e627835209242862b
Thewoahest/My-Projects
/Python-projects/Savings/Savings.py
UTF-8
147
3.109375
3
[]
no_license
import random amount = ['$50', '$75', '$125', '$175', '$200'] print(f"This paycheck we are going to put {random.choice(amount)} in your savings")
true
17593b3c658f5407f402242e030001c2b8c2c352
enrique-rodriguez/Django-CA
/app/entities/product.py
UTF-8
199
2.5625
3
[]
no_license
from .entity import Entity class Product(Entity): def __init__(self, name, price, *args, **kwargs): super().__init__(*args, **kwargs) self.name = name self.price = price
true
67016c34c0ac962a078d9b02bea3f7361ae53fd2
DarkAnfi/TideBlocksUCT
/src/Component/media/containers-blocks/process.py
UTF-8
1,470
2.59375
3
[ "MIT" ]
permissive
from PIL import Image names = [ "default", "primary", "success", "info", "warning", "danger", "default-selected", "primary-selected", "success-selected", "info-selected", "warning-selected", "danger-selected" ] imgs = [(Image.open(name+".png"), name) for name in names] for img, name in imgs: img.crop((0,0...
true
d6c445e593b94dc61adb2e9e15bec59c410d4135
chrixrux/da-assignment
/dataset/utils.py
UTF-8
404
3.484375
3
[]
no_license
import csv def load_csv(filename, delimiter=','): data = [] with open(filename, 'rb') as csvfile: reader = csv.reader(csvfile, delimiter=delimiter) next(reader, None) # skip header for row in reader: data.append(row) return data def save_csv(filename, data, delimiter=','): with open(filename, 'wb') as cs...
true
f5618426e6c345fb7fe3ee502f9b367c28091ed4
hyunurban/image_clustering
/src/data/make_dataset.py
UTF-8
1,941
2.8125
3
[ "MIT" ]
permissive
import requests import zipfile import os from tqdm import tqdm def download_file_from_google_drive(id, destination): URL = 'https://docs.google.com/uc?export=download' session = requests.Session() response = session.get(URL, params = { 'id' : id }, stream = True) token = None for key, value in r...
true
3febac3420985b6e7f4985f0d647bb835921187b
ECE1780/CoreMLConversion
/checkpoint_to_protobuf.py
UTF-8
1,277
2.90625
3
[]
no_license
import tensorflow as tf import os # TensorFlow checkpoint saves (.meta, .data) keep separate information # about the graph definition and the variables, respectively # # Much of that information is not necessary when you want to # use your model in production (e.g. space for the gradients of variables # during gradien...
true
76d9093a8b269eb151449f9e70b98d624b049d0d
Deepanshu276/AlgorithmToolbox
/divideAndConquer/quickSort.py
UTF-8
1,789
3.40625
3
[]
no_license
# def partition(customList, low, high): # i = low - 1 # pivot = customList[high] # for j in range(low,high): # if customList[j] <= pivot: # i += 1 # customList[i], customList[j] = customList[j], customList[i] # customList[i+1], customList[high] = customList[high], customL...
true
8437d40668ba8a75bccba9e856450f7f7734fdd9
craiglobo1/sudoku
/old/sudoku.py
UTF-8
6,832
3.640625
4
[]
no_license
import copy import random class SudokuBoard: def __init__(self,rows=9,columns=9): self.rows = rows self.columns = columns def makeBoard(self): # self.board = self.construct_puzzle_solution() # self.board = self.pluck() self.board = [ [7, 8, 0, 4, 0, 0, 1, 2, 0], ...
true
539727bc691ed863e3df986dcc619e4b09de0ee6
heromayank2/FaceRecognition2
/takephoto.py
UTF-8
1,306
2.75
3
[]
no_license
import PIL from PIL import Image,ImageTk import pytesseract import os import cv2 from tkinter import * from tkinter.messagebox import * root = Tk() frame = Frame(root, relief=RIDGE, borderwidth=2) root.configure(background='light green') root.title('Face Recognition by Mayank') root.geometry("700x600") root.bind('<Es...
true
e3b38d143afd35c1aa1a40a292c35023f2a7bb47
kynligbein/roll-for-init
/Python_Practice/Question.py
UTF-8
423
2.71875
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Mar 26 08:39:26 2020 Following the "giraffe academy" freecodecamp.org python tutorial. These are attempts to get better and more knowledgeable about python for class. Tutorial uses PyCharm to code, I am using Spyder. @author: kynligbein """ class Ques...
true
a5240eada186ec6a40983bb9ab80fe1ce7bd8f02
Crafty-Code/golfly
/Golfly.py
UTF-8
1,475
3.15625
3
[]
no_license
import pandas print("Welcome to Golfly") print("Importing Data...") data = pandas.read_csv( "./Data/PGA_Data_Historical.csv", sep=',', quotechar='"', dtype={ "player_name" : str, "tournament": str, "statistic": str, "variable": str, "value": str }, pa...
true
292e76f2d03d4c8d1f54c7100f7301fb894a165f
bitmovin/bitmovin-python
/bitmovin/resources/models/encodings/drms/cenc_fairplay_entry.py
UTF-8
426
2.671875
3
[ "Unlicense" ]
permissive
from bitmovin.utils import Serializable class CENCFairPlayEntry(Serializable): def __init__(self, iv, uri): super().__init__() self.iv = iv self.uri = uri @classmethod def parse_from_json_object(cls, json_object): iv = json_object.get('iv') uri = json_object.get('...
true
777eb37326cf1c6f46bb446d9886f58ddcc56ea8
fangguo1/HyperMine
/aux/AuxiliaryFunctions.py
UTF-8
830
3.109375
3
[]
no_license
import numpy as np # Input file with format of word2vec output. # Parse into a dict of {node: row_index} and a numpy array of embedding vectors def parse_embedding(input_file): with open(input_file, "r") as f_in: num_nodes, dim = map(int, f_in.readline().strip().split()) node_index_dict = {} # {no...
true
fb8632a8c90e0f50839ba6a5d1123689a1691dfc
utkarsh3142/data-structures
/Stack & Queue/queueCircularLinkedList.py
UTF-8
1,981
4.34375
4
[]
no_license
# Implementing Queue using Circular Linked List class Node: def __init__(self, value): self.value = value self.next = None class QueueCLinkedList: def __init__(self): self.tail = None def is_empty(self): return not self.tail def size(self): if not self.tail: ...
true
50b2ce47cd7ac38bb0b64ba6da27959b5a1f5b08
PrajwalSood/Machine-Learning
/data_preprocessing/labelencoder.py
UTF-8
734
3.421875
3
[]
no_license
import numpy as np def scan_data(): X = list(input().split()) return np.array(X) def convert_to_numerical_labels(X): uniques_values = list(set(X)) uniques_values.sort() #preparing map of unique values to numerical labels unique_values_labels_map = {} for i in range(0,len(uniques_values)):...
true
cd7cc7b1da2f662b144e502b5372ceaf34421d73
ckorikov/WSS-19
/Final Project/Research/assets/download.py
UTF-8
2,673
2.59375
3
[]
no_license
from __future__ import absolute_import, print_function, unicode_literals import asyncio import functools import io import os import zipfile from itertools import islice from urllib.parse import urlparse import aiohttp from github import Github HERE = os.path.abspath(os.path.dirname(__file__)) timeout = aiohttp.Clien...
true
b29692a57bba6106886af2afa626be802809b3d4
AdnanZahid/Chess_Neural_Networks_With_Python_Chess
/tests/game_logic_and_player_tests/game_logic_tests.py
UTF-8
1,893
2.90625
3
[]
no_license
import unittest from tests.test_utils.test_constants import * from src.models.board import * from src.models.game_logic import * from src.models.player import * from src.models.pieces.piece_factory import * from src.others.constants import * from src.others.structures import * # This class tests if game logic is worki...
true
2ee82ebcebf5caf65a9b77080b7a295e36c6d177
mederbekovael/pyton
/test1.py
UTF-8
795
2.578125
3
[]
no_license
print "vy doljny vybrat shkatulku gde est podskazka kak spasti planetu ot zombi 1 ili 2" shkatulka = raw_input("> ") if shkatulka == "1": print" tam zagadka" print" 1.otgadaete zagadku" print" chto razgovarivaet na vsex yazykax" print" 2.ne otgadaete zagadku" vyberete = raw_input("> ") if v...
true
067db2f1a6ccae2b699e1bd75e1993ec711f5add
kevindoyle/lyrics-sentiment-analysis
/liwc_processing.py
UTF-8
3,878
2.765625
3
[]
no_license
import nltk from nltk.collocations import * import time import re import word_category_counter import sys import pickle def process_lyrics( artist_name ): filename = artist_name + "EXT.txt" with open(filename, 'r') as f: raw_songs = f.read() print "Processing: ", filename # Taking the title and cre...
true
68bdf55dde44b610d1e8e8ec206fedff78176b2e
rmsg23/android
/deeplearnig/redneuronal/sok.py
UTF-8
895
2.796875
3
[]
no_license
import SocketServer import threading class MyTCPHandler(SocketServer.BaseRequestHandler): def handle(self): # se lanza automaticamente al hacer un request self.data = self.request.recv(1024).strip() #datos de donde corre #print "{} wrote:".format(self.client_address[0]) #p...
true
9d34098c2ac6478ab984d00d02bceea10c72c14f
f-r-e-d-eth/orbit_001
/v006_Price_Profit
UTF-8
7,366
3.171875
3
[]
no_license
#!/usr/bin/python3 import math import plotly.graph_objects as go # # Name Product [Price in SWAY/kg, Available mass in kg] data = [ [123,"Rock A",[ # Price, Volume ["Product A", 30 , 1000], ["Product B", 20 , 200], ["Product C", 10 , 50] ]], [...
true
448bb0055a5aa331c818167cf646fc373f13af75
dcowgill/codejunk
/algorithms/combinatoric.py
UTF-8
861
3.140625
3
[]
no_license
#!/usr/bin/env python3 def power_set(xs): ps = 2**len(xs) for c in range(ps): subset = [] for i, x in enumerate(xs): if c&(1<<i): subset.append(x) yield subset def all_partitions(xs): if len(xs) == 1: yield [[xs]] elif len(xs) == 0: y...
true
a755d511627a590f2796a8e786955dee1bcf1fec
tung1404/flask_starter
/web/project/api/forms.py
UTF-8
2,530
2.53125
3
[ "MIT" ]
permissive
# project/recipes/forms.py from project import db from flask_wtf import Form from wtforms import validators, StringField, IntegerField from wtforms.fields.html5 import EmailField from wtforms.validators import DataRequired, NumberRange from project.models import User from sqlalchemy import or_ class LoginForm(Form):...
true
027156365234a0abddc00519307f1d5e3cd15c82
SeanSJeong/RestAPI
/RestAPI_Python/Login/login_example.py
UTF-8
459
2.609375
3
[]
no_license
import requests import json def login(mail, password): s = requests.Session() payload = { 'email': mail, 'password': password } res = s.post('http://localhost:9500/api/arden/user/login', json=payload) #json = payload data = json.dumps(payload) #s.headers.update({...
true
497ce13fe09fa1a6707aad0f205b783d1a590c27
BCHGreerlab/Dictyostelium
/Histone_MassSpec/bin/merge_groupcomparisons.py
UTF-8
3,738
2.84375
3
[]
no_license
import os import sys import argparse import pandas as pd # usage statement and input descriptions parser = argparse.ArgumentParser( description='A post-processing script to merge files from Skyline\'s Group Comparison report format.\ ' 'This script will return three outputs: a merged file with all ...
true
a5a7027212b59960d9571a63747a71d6a9c14303
qibin0506/YATF
/tensorslow.py
UTF-8
9,902
3.078125
3
[ "Apache-2.0" ]
permissive
import numpy as np _default_graph = None class Operation: def __init__(self, input_nodes=[]): self.input_nodes = input_nodes self.consumers = [] self.inputs = None self.output = None for input_node in self.input_nodes: input_node.consumers.append(self) ...
true
711a55309910cdc367f937c6d5573a8f086da7e3
MariaZork/Coursera-Python-Course
/week4 - Функции и рекурсия/week4 - Минимум 4 чисел.py
UTF-8
1,091
3.953125
4
[]
no_license
# -*- coding: utf-8 -*- """ Created on Tue Feb 6 19:12:51 2018 author: Maria Zorkaltseva """ # Напишите функцию min4(a, b, c, d), вычисляющую минимум четырех чисел, # которая не содержит инструкции if, а использует стандартную функцию min # от двух чисел. Считайте четыре целых числа и выведите их минимум. # Формат в...
true
dfa00edf0fa7e5a0a3ec7236a82a7f8aaf4f2e19
ShiryaevNikolay/ProgrammingOnPython
/Secure Hash Algorithm.py
UTF-8
221
3.078125
3
[]
no_license
from random import shuffle example_table = range(0, 256) shuffle(example_table) def hash8(message, table): hash = len(message) % 256 for i in message: hash = table[(hash + ord(i)) % 256] return hash
true
fac9c26b031bedc4c1d8b1c03a6ab4dc4bec1a1a
icebowl/python
/rew/rew-1.py
UTF-8
141
2.859375
3
[]
no_license
outF = open("myOutFile.txt", "w") for line in textList: # write line to output file outF.write(line) outF.write("\n") outF.close()
true
b27396f39bd5b9255fed8baf00ccbfb3eb9e624a
BitKnitting/wakey_circuitpython
/circuitpython/frozen/Adafruit_CircuitPython_LIS3DH/examples/tap.py
UTF-8
1,893
3.265625
3
[ "MIT" ]
permissive
# Tap detection example. # Will loop forever printing when a single or double click is detected. # Open the serial port after running to see the output printed. # Author: Tony DiCola import board import adafruit_lis3dh import busio import digitalio # Uncomment _one_ of the hardware setups below depending on your wiri...
true
a8a9e871f4917124bfe2ee352a6f230910095cff
osarabia/timezones
/timezones/timezones/utils.py
UTF-8
1,120
3.109375
3
[]
no_license
import os months = { 1: "January", 2: "February", 3: "March", 4: "April", 5: "May", 6: "June", 7: "July", 8: "August", 9: "September", 10: "October", 11: "November", 12: "Dece...
true
307b1441b5abcdfd806f4daa314e1ff85cd2a313
micahg/plugin.video.tsngo
/resources/lib/schedule.py
UTF-8
1,291
2.640625
3
[]
no_license
import requests, json from .utils import log from datetime import datetime, timedelta from dateutil.parser import * from dateutil.tz import * class Schedule: CHANNEL_PREFIX = 'tsn' TIME_FMT = '%Y-%m-%dT%H:%M:%S%z' DATE_FMT = '%Y-%m-%d' SCHEDULE_URL = 'https://capi.9c9media.com/destinations/tsn_web/plat...
true